Class: Standard::Lsp::Server
- Inherits:
-
Object
- Object
- Standard::Lsp::Server
- Defined in:
- lib/standard/lsp/server.rb
Instance Method Summary collapse
-
#initialize(config) ⇒ Server
constructor
A new instance of Server.
- #start ⇒ Object
Constructor Details
#initialize(config) ⇒ Server
Returns a new instance of Server.
12 13 14 15 16 17 18 |
# File 'lib/standard/lsp/server.rb', line 12 def initialize(config) @writer = Proto::Transport::Io::Writer.new($stdout) @reader = Proto::Transport::Io::Reader.new($stdin) @logger = Logger.new @standardizer = Standard::Lsp::Standardizer.new(config) @routes = Routes.new(@writer, @logger, @standardizer) end |
Instance Method Details
#start ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/standard/lsp/server.rb', line 20 def start RuboCop::LSP.enable @reader.read do |request| if !request.key?(:method) @routes.handle_method_missing(request) elsif (route = @routes.for(request[:method])) route.call(request) else @routes.handle_unsupported_method(request) end rescue => e @logger.puts "Error #{e.class} #{e.[0..100]}" @logger.puts e.backtrace.inspect end end |