Class: RubyLsp::Handler

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/ruby_lsp/handler.rb

Constant Summary collapse

VOID =
T.let(Object.new.freeze, Object)
Interface =
LanguageServer::Protocol::Interface
Constant =
LanguageServer::Protocol::Constant
Transport =
LanguageServer::Protocol::Transport

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeHandler



21
22
23
24
25
26
# File 'lib/ruby_lsp/handler.rb', line 21

def initialize
  @writer = T.let(Transport::Stdio::Writer.new, Transport::Stdio::Writer)
  @reader = T.let(Transport::Stdio::Reader.new, Transport::Stdio::Reader)
  @handlers = T.let({}, T::Hash[String, T.proc.params(request: T::Hash[Symbol, T.untyped]).returns(T.untyped)])
  @store = T.let(Store.new, Store)
end

Instance Attribute Details

#storeObject (readonly)

Returns the value of attribute store.



14
15
16
# File 'lib/ruby_lsp/handler.rb', line 14

def store
  @store
end

Instance Method Details

#config(&blk) ⇒ Object



35
36
37
# File 'lib/ruby_lsp/handler.rb', line 35

def config(&blk)
  instance_exec(&blk)
end

#startObject



29
30
31
32
# File 'lib/ruby_lsp/handler.rb', line 29

def start
  $stderr.puts "Starting Ruby LSP..."
  @reader.read { |request| handle(request) }
end