Class: Kapusta::LSP
- Inherits:
-
Object
show all
- Defined in:
- lib/kapusta/lsp.rb,
lib/kapusta/lsp/rename.rb,
lib/kapusta/lsp/definition.rb,
lib/kapusta/lsp/formatting.rb,
lib/kapusta/lsp/identifier.rb,
lib/kapusta/lsp/diagnostics.rb,
lib/kapusta/lsp/scope_walker.rb,
lib/kapusta/lsp/workspace_index.rb
Defined Under Namespace
Modules: Definition, Diagnostics, Formatting, Identifier, Rename
Classes: ScopeWalker, WorkspaceIndex
Constant Summary
collapse
- NOT_INITIALIZED =
-32_002
- METHOD_NOT_FOUND =
-32_601
- FULL_SYNC =
1
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(input:, output:, log:) ⇒ LSP
Returns a new instance of LSP.
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/kapusta/lsp.rb', line 33
def initialize(input:, output:, log:)
@input = input.binmode
@output = output.binmode
@log = log
@debug = %w[1 true yes on].include?(ENV['KAPUSTA_LS_DEBUG'].to_s.downcase)
@sources = {}
@workspace_index = WorkspaceIndex.new
@initialized = false
@shutdown = false
end
|
Class Method Details
.start(input: $stdin, output: $stdout, log: $stderr) ⇒ Object
18
19
20
|
# File 'lib/kapusta/lsp.rb', line 18
def self.start(input: $stdin, output: $stdout, log: $stderr)
new(input:, output:, log:).run
end
|
.uri_to_path(uri) ⇒ Object
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/kapusta/lsp.rb', line 22
def self.uri_to_path(uri)
return unless uri.is_a?(String)
parsed = URI.parse(uri)
return URI::DEFAULT_PARSER.unescape(parsed.path) if parsed.scheme == 'file'
uri
rescue URI::InvalidURIError
nil
end
|
Instance Method Details
#run ⇒ Object
44
45
46
47
48
|
# File 'lib/kapusta/lsp.rb', line 44
def run
until (message = read_message).nil?
handle(message)
end
end
|