package linol
Class Make.serverSource
An easily overloadable class. Pick the methods you want to support. The user must provide at least the callbacks for document lifecycle: open, close, update. The most basic LSP server should check documents when they're updated and report diagnostics back to the editor.
inherit base_servermethod find_doc : Lsp.Types.DocumentUri.t -> doc_state optionFind current state of the given document, if present.
method on_request_unhandled : 'r. notify_back:notify_back ->
id:Req_id.t ->
'r Lsp.Client_request.t ->
'r IO.tOverride to process other requests
Parameter for how to synchronize content with the editor
method config_definition : [ `Bool of bool
| `DefinitionOptions of
Lsp.Types.DefinitionOptions.t ]
optionmethod config_symbol : [ `Bool of bool
| `DocumentSymbolOptions of
Lsp.Types.DocumentSymbolOptions.t ]
optionmethod config_code_action_provider : [ `Bool of bool
| `CodeActionOptions of
Lsp.Types.CodeActionOptions.t ]method config_modify_capabilities : Lsp.Types.ServerCapabilities.t ->
Lsp.Types.ServerCapabilities.tModify capabilities before sending them back to the client. By default we just return them unmodified.
method on_req_initialize : notify_back:notify_back ->
Lsp.Types.InitializeParams.t ->
Lsp.Types.InitializeResult.t IO.tmethod on_req_hover : notify_back:notify_back ->
id:Req_id.t ->
uri:Lsp__Types.DocumentUri.t ->
pos:Lsp__Types.Position.t ->
doc_state ->
Lsp.Types.Hover.t option IO.tCalled when the user hovers on some identifier in the document
method on_req_completion : notify_back:notify_back ->
id:Req_id.t ->
uri:Lsp__Types.DocumentUri.t ->
pos:Lsp__Types.Position.t ->
ctx:Lsp__Types.CompletionContext.t option ->
doc_state ->
[ `CompletionList of Lsp__.Types.CompletionList.t
| `List of Lsp__.Types.CompletionItem.t list ]
option
IO.tCalled when the user requests completion in the document
method on_req_definition : notify_back:notify_back ->
id:Req_id.t ->
uri:Lsp__Types.DocumentUri.t ->
pos:Lsp__Types.Position.t ->
doc_state ->
Lsp.Types.Locations.t option IO.tCalled when the user wants to jump-to-definition
method on_req_code_lens : notify_back:notify_back ->
id:Req_id.t ->
uri:Lsp__Types.DocumentUri.t ->
doc_state ->
Lsp.Types.CodeLens.t list IO.tList code lenses for the given document
method on_req_code_lens_resolve : notify_back:notify_back ->
id:Req_id.t ->
Lsp.Types.CodeLens.t ->
Lsp.Types.CodeLens.t IO.tCode lens resolution, must return a code lens with non null "command"
method on_req_code_action : notify_back:notify_back ->
id:Req_id.t ->
Lsp.Types.CodeActionParams.t ->
Lsp.Types.CodeActionResult.t IO.tCode action.
method on_req_execute_command : notify_back:notify_back ->
id:Req_id.t ->
string ->
Yojson.Safe.t list option ->
Yojson.Safe.t IO.tExecute a command with given arguments.
method on_req_symbol : notify_back:notify_back ->
id:Req_id.t ->
uri:Lsp__Types.DocumentUri.t ->
unit ->
[ `DocumentSymbol of Lsp__.Types.DocumentSymbol.t list
| `SymbolInformation of Lsp__.Types.SymbolInformation.t list ]
option
IO.tList symbols in this document.
method virtual on_notif_doc_did_open : notify_back:notify_back ->
Lsp.Types.TextDocumentItem.t ->
content:string ->
unit IO.tCalled when a document is opened
method virtual on_notif_doc_did_close : notify_back:notify_back ->
Lsp.Types.TextDocumentIdentifier.t ->
unit IO.tmethod virtual on_notif_doc_did_change : notify_back:notify_back ->
Lsp.Types.VersionedTextDocumentIdentifier.t ->
Lsp.Types.TextDocumentContentChangeEvent.t list ->
old_content:string ->
new_content:string ->
unit IO.tCalled when the document changes.
method on_notification_unhandled : notify_back:notify_back ->
Lsp.Client_notification.t ->
unit IO.tOverride to handle unprocessed notifications