Class: LanguageServer::CompletionProvider::Rcodetools

Inherits:
Object
  • Object
show all
Defined in:
lib/language_server/completion_provider/rcodetools.rb

Instance Method Summary collapse

Constructor Details

#initialize(uri:, line:, character:, file_store:) ⇒ Rcodetools



17
18
19
20
21
22
# File 'lib/language_server/completion_provider/rcodetools.rb', line 17

def initialize(uri:, line:, character:, file_store:)
  @uri = uri
  @line = line
  @character = character
  @file_store = file_store
end

Instance Method Details

#callObject



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/language_server/completion_provider/rcodetools.rb', line 24

def call
  _, candidates = Filter.run(source, lineno: @line + 1, column: @character)
  candidates.map do |candidate|
    method_name, description = candidate.split(/\0/, 2)
    Protocol::Interface::CompletionItem.new(
      label: method_name,
      detail: description,
      kind: Protocol::Constant::CompletionItemKind::METHOD
    )
  end
end