Class: Rfmt::LSP::Server
- Inherits:
-
Object
- Object
- Rfmt::LSP::Server
- Defined in:
- lib/rfmt/lsp/server.rb
Constant Summary collapse
- TEXT_DOCUMENT_SYNC_FULL =
1- METHOD_NOT_FOUND =
-32_601
- INTERNAL_ERROR =
-32_603
Instance Method Summary collapse
- #handle_message(message) ⇒ Object
-
#initialize(input: $stdin, output: $stdout) ⇒ Server
constructor
A new instance of Server.
- #run ⇒ Object
Constructor Details
#initialize(input: $stdin, output: $stdout) ⇒ Server
Returns a new instance of Server.
19 20 21 22 23 24 |
# File 'lib/rfmt/lsp/server.rb', line 19 def initialize(input: $stdin, output: $stdout) @io = MessageIO.new(input: input, output: output) @documents = DocumentStore.new @workspace = Workspace.new @shutdown_requested = false end |
Instance Method Details
#handle_message(message) ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/rfmt/lsp/server.rb', line 34 def () method = ['method'] id = ['id'] params = ['params'] || {} (method, id, params) rescue StandardError => e respond_error(id, INTERNAL_ERROR, e.) if id end |
#run ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/rfmt/lsp/server.rb', line 26 def run while ( = @io.) return @shutdown_requested ? 0 : 1 if () == :exit end 0 end |