Class: LanguageServer::Protocol::Interface::CompletionParams

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

Overview

Completion parameters

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context: nil, text_document:, position:, work_done_token: nil, partial_result_token: nil) ⇒ CompletionParams

Returns a new instance of CompletionParams.



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

def initialize(context: nil, text_document:, position:, work_done_token: nil, partial_result_token: nil)
  @attributes = {}

  @attributes[:context] = context if context
  @attributes[:textDocument] = text_document
  @attributes[:position] = position
  @attributes[:workDoneToken] = work_done_token if work_done_token
  @attributes[:partialResultToken] = partial_result_token if partial_result_token

  @attributes.freeze
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



62
63
64
# File 'lib/language_server/protocol/interface/completion_params.rb', line 62

def attributes
  @attributes
end

Instance Method Details

#contextCompletionContext | nil

The completion context. This is only available it the client specifies to send this using the client capability ‘textDocument.completion.contextSupport === true`

Returns:



25
26
27
# File 'lib/language_server/protocol/interface/completion_params.rb', line 25

def context
  attributes.fetch(:context)
end

#partial_result_tokenProgressToken | nil

An optional token that a server can use to report partial results (e.g. streaming) to the client.

Returns:

  • (ProgressToken | nil)


58
59
60
# File 'lib/language_server/protocol/interface/completion_params.rb', line 58

def partial_result_token
  attributes.fetch(:partialResultToken)
end

#positionPosition

The position inside the text document.

Returns:



41
42
43
# File 'lib/language_server/protocol/interface/completion_params.rb', line 41

def position
  attributes.fetch(:position)
end

#text_documentTextDocumentIdentifier

The text document.



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

def text_document
  attributes.fetch(:textDocument)
end

#to_hashObject



64
65
66
# File 'lib/language_server/protocol/interface/completion_params.rb', line 64

def to_hash
  attributes
end

#to_json(*args) ⇒ Object



68
69
70
# File 'lib/language_server/protocol/interface/completion_params.rb', line 68

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

#work_done_tokenProgressToken | nil

An optional token that a server can use to report work done progress.

Returns:

  • (ProgressToken | nil)


49
50
51
# File 'lib/language_server/protocol/interface/completion_params.rb', line 49

def work_done_token
  attributes.fetch(:workDoneToken)
end