Class: Jade::LSP::Server

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

Instance Method Summary collapse

Constructor Details

#initialize(input: $stdin, output: $stdout) ⇒ Server

Returns a new instance of Server.



6
7
8
9
10
11
12
# File 'lib/jade/lsp/server.rb', line 6

def initialize(input: $stdin, output: $stdout)
  @input = input
  @output = output
  @input.binmode
  @output.binmode
  @output.sync = true
end

Instance Method Details

#runObject



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/jade/lsp/server.rb', line 14

def run
  state = State.empty
  loop do
    message = read_message
    break unless message

    state, outbound = safe_dispatch(state, message)
    outbound.each { write_message(it) }
    break if message['method'] == 'exit'
  end
end