Module: Ibex::LSP::RequestHandlers

Includes:
DocumentHandlers, InitializationHandlers, NavigationHandlers, RequestSupport
Included in:
Server
Defined in:
lib/ibex/lsp/request_handlers.rb,
sig/ibex/lsp/request_handlers.rbs

Overview

Dispatches the finite LSP surface to focused lifecycle, document, and navigation handlers.

Constant Summary collapse

HANDLERS =

Returns:

  • (Hash[String, Symbol])
{
  "initialize" => :initialize_workspace,
  "initialized" => :initialized_notification,
  "shutdown" => :shutdown_request,
  "exit" => :exit_notification,
  "textDocument/didOpen" => :did_open,
  "textDocument/didChange" => :did_change,
  "textDocument/didSave" => :did_save,
  "textDocument/didClose" => :did_close,
  "textDocument/definition" => :definition,
  "textDocument/references" => :references,
  "textDocument/prepareRename" => :prepare_rename,
  "textDocument/rename" => :rename,
  "textDocument/hover" => :hover,
  "$/cancelRequest" => :cancel_request
}.freeze

Instance Method Summary collapse

Methods included from RequestSupport

#hash_member, #integer_member, #params_hash, #publish, #require_running!, #require_state!, #stale_publication?, #store, #string_member, #workspace

Methods included from NavigationHandlers

#definition, #hover, #prepare_rename, #references, #rename, #with_index

Methods included from DocumentHandlers

#did_change, #did_close, #did_open, #did_save

Methods included from InitializationHandlers

#capabilities, #exit_notification, #initialization_roots, #initialize_workspace, #initialized_notification, #shutdown_request

Instance Method Details

#cancel_request(_params) ⇒ nil

RBS:

  • (untyped params) -> nil

Parameters:

  • params (Object)

Returns:

  • (nil)


40
41
42
# File 'lib/ibex/lsp/request_handlers.rb', line 40

def cancel_request(_params)
  nil
end

#dispatch(method, params) ⇒ Object

RBS:

  • (String method, untyped params) -> untyped

Parameters:

  • method (String)
  • params (Object)

Returns:

  • (Object)


32
33
34
35
36
37
# File 'lib/ibex/lsp/request_handlers.rb', line 32

def dispatch(method, params)
  handler = HANDLERS[method]
  raise ProtocolError.new("method not found: #{method}", code: -32_601) unless handler

  send(handler, params)
end