Class: Kapusta::LSP

Inherits:
Object
  • Object
show all
Defined in:
lib/kapusta/lsp.rb

Constant Summary collapse

NOT_INITIALIZED =
-32_002
METHOD_NOT_FOUND =
-32_601
SEVERITY_ERROR =
1
FULL_SYNC =
1

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(input:, output:, log:) ⇒ LSP

Returns a new instance of LSP.



19
20
21
22
23
24
25
26
# File 'lib/kapusta/lsp.rb', line 19

def initialize(input:, output:, log:)
  @input = input.binmode
  @output = output.binmode
  @log = log
  @sources = {}
  @initialized = false
  @shutdown = false
end

Class Method Details

.start(input: $stdin, output: $stdout, log: $stderr) ⇒ Object



15
16
17
# File 'lib/kapusta/lsp.rb', line 15

def self.start(input: $stdin, output: $stdout, log: $stderr)
  new(input:, output:, log:).run
end

Instance Method Details

#runObject



28
29
30
31
32
# File 'lib/kapusta/lsp.rb', line 28

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