13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/language_server/completion_provider/ad_hoc.rb', line 13
def call
(project.constants(uri: uri, line: line, character: character).map {|c|
Protocol::Interface::CompletionItem.new(
label: c.name,
detail: c.full_name,
documentation: "#{c.remote_path}##{c.lineno}",
kind: Protocol::Constant::CompletionItemKind::ENUM
)
} +
project.classes(uri: uri, line: line, character: character).map {|c|
Protocol::Interface::CompletionItem.new(
label: c.name,
detail: c.full_name,
documentation: "#{c.remote_path}##{c.lineno}",
kind: Protocol::Constant::CompletionItemKind::CLASS
)
} +
project.modules(uri: uri, line: line, character: character).map {|m|
Protocol::Interface::CompletionItem.new(
label: m.name,
detail: m.full_name,
documentation: "#{m.remote_path}##{m.lineno}",
kind: Protocol::Constant::CompletionItemKind::MODULE
)
}).uniq(&:label)
end
|