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)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeHandler

Returns a new instance of Handler.



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

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.



25
26
27
# File 'lib/ruby_lsp/handler.rb', line 25

def store
  @store
end

Class Method Details

.start(&blk) ⇒ Object



18
19
20
21
22
# File 'lib/ruby_lsp/handler.rb', line 18

def self.start(&blk)
  handler = new
  handler.instance_exec(&blk)
  handler.start
end

Instance Method Details

#startObject



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

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