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

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

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.

Parameters:

  • token_types: (Array[String])
  • token_modifiers: (Array[String])

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

#attributesHash[Symbol, untyped] (readonly)

Returns:

  • (Hash[Symbol, untyped])

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_hashHash[Symbol, untyped]

Returns:

  • (Hash[Symbol, untyped])

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) ⇒ String

Parameters:

  • (Object)

Returns:

  • (String)

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