Sha256: 3e0254dd67afa1c542908f152b888467762283f87e667cd6ec9767ba40ee024d

Contents?: true

Size: 1.07 KB

Versions: 38

Compression:

Stored size: 1.07 KB

Contents

module Redcar
  module SyntaxCheck
    class Annotation

      def self.type
        "syntax.annotation.type"
      end

      def icon
        "application--exclamation"
      end

      def color
        [255, 255, 255]
      end

      attr_accessor :line, :char, :message, :doc

      def initialize(doc, line, message, char=0)
        @doc       = doc
        @line      = line
        @message   = message
        @char      = char
      end

      def annotate
        edit_view = doc.edit_view
        edit_view.add_annotation_type(self.class.type, icon, color)
        edit_view.add_annotation(self.class.type, line, message, @char, doc.get_line(line).length-@char)
      end
    end

    class Error < Annotation
      def self.type
        "syntax.error.type"
      end

      def icon
        "compile-error"
      end

      def color
        [255, 32, 32]
      end
    end

    class Warning < Annotation
      def self.type
        "syntax.warning.type"
      end

      def icon
        "compile-warning"
      end

      def color
        [255, 194, 10]
      end
    end
  end
end

Version data entries

38 entries across 38 versions & 2 rubygems

Version Path
redcar-0.13 plugins/syntax_check/lib/syntax_check/annotation.rb
redcar-dev-0.13.5dev plugins/syntax_check/lib/syntax_check/annotation.rb
redcar-dev-0.13.4dev plugins/syntax_check/lib/syntax_check/annotation.rb
redcar-dev-0.13.3dev plugins/syntax_check/lib/syntax_check/annotation.rb
redcar-dev-0.13.2dev plugins/syntax_check/lib/syntax_check/annotation.rb
redcar-dev-0.13.1dev plugins/syntax_check/lib/syntax_check/annotation.rb
redcar-0.12.1 plugins/syntax_check/lib/syntax_check/annotation.rb
redcar-dev-0.13.0dev plugins/syntax_check/lib/syntax_check/annotation.rb
redcar-0.12 plugins/syntax_check/lib/syntax_check/annotation.rb
redcar-dev-0.12.27dev plugins/syntax_check/lib/syntax_check/annotation.rb
redcar-dev-0.12.26dev plugins/syntax_check/lib/syntax_check/annotation.rb
redcar-dev-0.12.25dev plugins/syntax_check/lib/syntax_check/annotation.rb
redcar-dev-0.12.24dev plugins/syntax_check/lib/syntax_check/annotation.rb
redcar-dev-0.12.23dev plugins/syntax_check/lib/syntax_check/annotation.rb
redcar-dev-0.12.22dev plugins/syntax_check/lib/syntax_check/annotation.rb
redcar-dev-0.12.21dev plugins/syntax_check/lib/syntax_check/annotation.rb
redcar-dev-0.12.20dev plugins/syntax_check/lib/syntax_check/annotation.rb
redcar-dev-0.12.19dev plugins/syntax_check/lib/syntax_check/annotation.rb
redcar-dev-0.12.18dev plugins/syntax_check/lib/syntax_check/annotation.rb
redcar-dev-0.12.17dev plugins/syntax_check/lib/syntax_check/annotation.rb