Skip to main content

Module handlers

Module handlers 

Source
Expand description

§LSP handlers — one module per capability

Every module here has the same two jobs:

1. a handler function with the signature the dispatch table calls:
     request:      async fn(ServerContextSnapshot, Params, CancellationToken) -> RequestOutcome<Result>
     notification: async fn(ServerContextSnapshot, Params) -> Option<()>
2. a `RegisterCapabilities` implementation, which is what the server advertises in `initialize`

Both are wired in two places and nowhere else: [request_handler] / [notification_handler] for the dispatch, and the capabilities! table at the bottom of this file for what the client is told. A module that is in one and not the other is a handler the client will never call (or a capability with no implementation), so the two lists are read together

The table below is deliberately short: it is the set of capabilities this server answers today. Adding one is three edits — the module, the dispatch row, the capability row — and the modules that were removed from the Lua skeleton (semantic_token, signature_help, …) come back the same way: completion, document_symbol, folding_range, references, rename, selection_range, workspace_symbol and inlay_hint all came back that way.

Modules§

call_hierarchy
textDocument/prepareCallHierarchy and its two follow-ups — who calls this, and what it calls.
diagnostic
Diagnostics — what the analysis reported about one file
hover
textDocument/hover — what the name under the cursor is
implementation
textDocument/implementation — the classes and functions that implement a declaration
references
textDocument/references — where else this name is written

Structs§

ClientConfig
What the client told this server about how to analyse the workspace.

Traits§

RegisterCapabilities
What a module has to answer to be advertised in initialize.

Functions§

initialized_handler
on_notification_handler
on_request_handler
on_response_handler
process_did_change_text_document
process_did_change_watched_files
process_did_close_document
process_did_open_text_document
process_did_save_text_document
A save is a statement that the buffer and the disk now agree.
read_the_modules
The module interface units this file imports, read in — the half of “read the file in first” that a project scan cannot do.
register_files_watch
server_capabilities
start_analysis
Open the analysis over the workspace and start reading it.