Class: LSP::SemanticTokens

Inherits:
LSPBase
  • Object
show all
Defined in:
lib/lsp/lsp_protocol_sematictokens.proposed.rb

Overview

export interface SemanticTokens

/**
 * 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 sematic tokens again simply
 * send a delta.
 */
resultId?: string;
/**
 * The actual tokens. For a detailed description about how the data is
 * structured pls see
 * https://github.com/microsoft/vscode-extension-samples/blob/5ae1f7787122812dcc84e37427ca90af5ee09f14/semantic-tokens-sample/vscode.proposed.d.ts#L71
 */
data: number[];

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from LSPBase

#to_h, #to_json

Constructor Details

#initialize(initial_hash = nil) ⇒ SemanticTokens

Returns a new instance of SemanticTokens.



48
49
50
51
# File 'lib/lsp/lsp_protocol_sematictokens.proposed.rb', line 48

def initialize(initial_hash = nil)
  super
  @optional_method_names = %i[resultId]
end

Instance Attribute Details

#dataObject

type: string # type: number[]



46
47
48
# File 'lib/lsp/lsp_protocol_sematictokens.proposed.rb', line 46

def data
  @data
end

#resultIdObject

type: string # type: number[]



46
47
48
# File 'lib/lsp/lsp_protocol_sematictokens.proposed.rb', line 46

def resultId
  @resultId
end

Instance Method Details

#from_h!(value) ⇒ Object



53
54
55
56
57
58
# File 'lib/lsp/lsp_protocol_sematictokens.proposed.rb', line 53

def from_h!(value)
  value = {} if value.nil?
  self.resultId = value['resultId']
  self.data = value['data'].map { |val| val } unless value['data'].nil?
  self
end