Class: LanguageServer::Protocol::Interface::SemanticTokens

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

Overview

Since:

  • 3.16.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(result_id: nil, data:) ⇒ SemanticTokens

Returns a new instance of SemanticTokens.

Since:

  • 3.16.0



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

def initialize(result_id: nil, data:)
  @attributes = {}

  @attributes[:resultId] = result_id if result_id
  @attributes[:data] = data

  @attributes.freeze
end

Instance Attribute Details

#attributesObject (readonly)

Since:

  • 3.16.0



36
37
38
# File 'lib/language_server/protocol/interface/semantic_tokens.rb', line 36

def attributes
  @attributes
end

Instance Method Details

#datauinteger[]

The actual tokens.

Returns:

  • (uinteger[])

Since:

  • 3.16.0



32
33
34
# File 'lib/language_server/protocol/interface/semantic_tokens.rb', line 32

def data
  attributes.fetch(:data)
end

#result_idstring | nil

An optional result id. If provided and clients support delta updating the client will include the result id in the next semantic token request. A server can then instead of computing all semantic tokens again simply send a delta.

Returns:

  • (string | nil)

Since:

  • 3.16.0



24
25
26
# File 'lib/language_server/protocol/interface/semantic_tokens.rb', line 24

def result_id
  attributes.fetch(:resultId)
end

#to_hashObject

Since:

  • 3.16.0



38
39
40
# File 'lib/language_server/protocol/interface/semantic_tokens.rb', line 38

def to_hash
  attributes
end

#to_json(*args) ⇒ Object

Since:

  • 3.16.0



42
43
44
# File 'lib/language_server/protocol/interface/semantic_tokens.rb', line 42

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