Class: RubyLsp::ResponseBuilders::SemanticHighlighting::SemanticToken
- Inherits:
-
Object
- Object
- RubyLsp::ResponseBuilders::SemanticHighlighting::SemanticToken
- Defined in:
- lib/ruby_lsp/response_builders/semantic_highlighting.rb
Instance Attribute Summary collapse
-
#length ⇒ Object
readonly
: Integer.
-
#modifier ⇒ Object
readonly
: Array.
-
#start_code_unit_column ⇒ Object
readonly
: Integer.
-
#start_line ⇒ Object
readonly
: Integer.
-
#type ⇒ Object
readonly
: Integer.
Instance Method Summary collapse
-
#initialize(start_line:, start_code_unit_column:, length:, type:, modifier:) ⇒ SemanticToken
constructor
: (start_line: Integer, start_code_unit_column: Integer, length: Integer, type: Integer, modifier: Array) -> void.
-
#replace_modifier(modifier_symbols) ⇒ Object
: (Array modifier_symbols) -> void.
-
#replace_type(type_symbol) ⇒ Object
: (Symbol type_symbol) -> void.
Constructor Details
#initialize(start_line:, start_code_unit_column:, length:, type:, modifier:) ⇒ SemanticToken
: (start_line: Integer, start_code_unit_column: Integer, length: Integer, type: Integer, modifier: Array) -> void
109 110 111 112 113 114 115 |
# File 'lib/ruby_lsp/response_builders/semantic_highlighting.rb', line 109 def initialize(start_line:, start_code_unit_column:, length:, type:, modifier:) @start_line = start_line @start_code_unit_column = start_code_unit_column @length = length @type = type @modifier = modifier end |
Instance Attribute Details
#length ⇒ Object (readonly)
: Integer
100 101 102 |
# File 'lib/ruby_lsp/response_builders/semantic_highlighting.rb', line 100 def length @length end |
#modifier ⇒ Object (readonly)
: Array
106 107 108 |
# File 'lib/ruby_lsp/response_builders/semantic_highlighting.rb', line 106 def modifier @modifier end |
#start_code_unit_column ⇒ Object (readonly)
: Integer
97 98 99 |
# File 'lib/ruby_lsp/response_builders/semantic_highlighting.rb', line 97 def start_code_unit_column @start_code_unit_column end |
#start_line ⇒ Object (readonly)
: Integer
94 95 96 |
# File 'lib/ruby_lsp/response_builders/semantic_highlighting.rb', line 94 def start_line @start_line end |
#type ⇒ Object (readonly)
: Integer
103 104 105 |
# File 'lib/ruby_lsp/response_builders/semantic_highlighting.rb', line 103 def type @type end |
Instance Method Details
#replace_modifier(modifier_symbols) ⇒ Object
: (Array modifier_symbols) -> void
126 127 128 129 130 131 132 133 |
# File 'lib/ruby_lsp/response_builders/semantic_highlighting.rb', line 126 def replace_modifier(modifier_symbols) @modifier = modifier_symbols.filter_map do |modifier_symbol| modifier_index = TOKEN_MODIFIERS[modifier_symbol] raise UndefinedTokenType, "Undefined token modifier: #{modifier_symbol}" unless modifier_index modifier_index end end |
#replace_type(type_symbol) ⇒ Object
: (Symbol type_symbol) -> void
118 119 120 121 122 123 |
# File 'lib/ruby_lsp/response_builders/semantic_highlighting.rb', line 118 def replace_type(type_symbol) type_int = TOKEN_TYPES[type_symbol] raise UndefinedTokenType, "Undefined token type: #{type_symbol}" unless type_int @type = type_int end |