Class: Kapusta::LSP

Inherits:
Object
  • 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.



22
23
24
25
26
27
28
29
30
31
# File 'lib/kapusta/lsp.rb', line 22

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

Instance Method Details

#runObject



33
34
35
36
37
# File 'lib/kapusta/lsp.rb', line 33

def run
  until (message = read_message).nil?
    handle(message)
  end
end