Class: LanguageServer::Protocol::Interface::SemanticTokensLegend

Inherits:
Object
  • Object
show all
Defined in:
lib/language_server/protocol/interface/semantic_tokens_legend.rb

Overview

Since:

  • 3.16.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token_types:, token_modifiers:) ⇒ SemanticTokensLegend

Returns a new instance of SemanticTokensLegend.

Since:

  • 3.16.0



8
9
10
11
12
13
14
15
# File 'lib/language_server/protocol/interface/semantic_tokens_legend.rb', line 8

def initialize(token_types:, token_modifiers:)
  @attributes = {}

  @attributes[:tokenTypes] = token_types
  @attributes[:tokenModifiers] = token_modifiers

  @attributes.freeze
end

Instance Attribute Details

#attributesObject (readonly)

Since:

  • 3.16.0



33
34
35
# File 'lib/language_server/protocol/interface/semantic_tokens_legend.rb', line 33

def attributes
  @attributes
end

Instance Method Details

#to_hashObject

Since:

  • 3.16.0



35
36
37
# File 'lib/language_server/protocol/interface/semantic_tokens_legend.rb', line 35

def to_hash
  attributes
end

#to_json(*args) ⇒ Object

Since:

  • 3.16.0



39
40
41
# File 'lib/language_server/protocol/interface/semantic_tokens_legend.rb', line 39

def to_json(*args)
  to_hash.to_json(*args)
end

#token_modifiersstring[]

The token modifiers a server uses.

Returns:

  • (string[])

Since:

  • 3.16.0



29
30
31
# File 'lib/language_server/protocol/interface/semantic_tokens_legend.rb', line 29

def token_modifiers
  attributes.fetch(:tokenModifiers)
end

#token_typesstring[]

The token types a server uses.

Returns:

  • (string[])

Since:

  • 3.16.0



21
22
23
# File 'lib/language_server/protocol/interface/semantic_tokens_legend.rb', line 21

def token_types
  attributes.fetch(:tokenTypes)
end