package linol

  1. Overview
  2. Docs

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_server
val mutable status : [ `ReceivedExit | `ReceivedShutdown | `Running ]
val docs : (Lsp.Types.DocumentUri.t, doc_state) Stdlib.Hashtbl.t
method get_status : [ `ReceivedExit | `ReceivedShutdown | `Running ]

Check if exit or shutdown request was made by the client.

  • since NEXT_RELEASE
method find_doc : Lsp.Types.DocumentUri.t -> doc_state option

Find 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.t

Override to process other requests

method config_sync_opts : Lsp.Types.TextDocumentSyncOptions.t

Parameter for how to synchronize content with the editor

method config_completion : Lsp.Types.CompletionOptions.t option

Configuration for the completion API.

  • since 0.4
method config_code_lens_options : Lsp.Types.CodeLensOptions.t option
  • since 0.3
method config_definition : [ `Bool of bool | `DefinitionOptions of Lsp.Types.DefinitionOptions.t ] option
  • since 0.3
method config_hover : [ `Bool of bool | `HoverOptions of Lsp.Types.HoverOptions.t ] option
  • since 0.3
method config_symbol : [ `Bool of bool | `DocumentSymbolOptions of Lsp.Types.DocumentSymbolOptions.t ] option
  • since 0.3
method config_code_action_provider : [ `Bool of bool | `CodeActionOptions of Lsp.Types.CodeActionOptions.t ]
  • since 0.3
method config_modify_capabilities : Lsp.Types.ServerCapabilities.t -> Lsp.Types.ServerCapabilities.t

Modify capabilities before sending them back to the client. By default we just return them unmodified.

  • since 0.3
method config_list_commands : string list

List of commands available

method on_req_initialize : notify_back:notify_back -> Lsp.Types.InitializeParams.t -> Lsp.Types.InitializeResult.t IO.t
method on_req_hover : notify_back:notify_back -> id:Req_id.t -> uri:Lsp__Types.DocumentUri.t -> pos:Lsp__Types.Position.t -> workDoneToken:Lsp__Types.ProgressToken.t option -> doc_state -> Lsp.Types.Hover.t option IO.t

Called 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 -> workDoneToken:Lsp__Types.ProgressToken.t option -> partialResultToken:Lsp__Types.ProgressToken.t option -> doc_state -> [ `CompletionList of Lsp__.Types.CompletionList.t | `List of Lsp__.Types.CompletionItem.t list ] option IO.t

Called 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 -> workDoneToken:Lsp__Types.ProgressToken.t option -> partialResultToken:Lsp__Types.ProgressToken.t option -> doc_state -> Lsp.Types.Locations.t option IO.t

Called 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 -> workDoneToken:Lsp__Types.ProgressToken.t option -> partialResultToken:Lsp__Types.ProgressToken.t option -> doc_state -> Lsp.Types.CodeLens.t list IO.t

List code lenses for the given document

  • since 0.3
method on_req_code_lens_resolve : notify_back:notify_back -> id:Req_id.t -> Lsp.Types.CodeLens.t -> Lsp.Types.CodeLens.t IO.t

Code lens resolution, must return a code lens with non null "command"

  • since 0.3
method on_req_code_action : notify_back:notify_back -> id:Req_id.t -> Lsp.Types.CodeActionParams.t -> Lsp.Types.CodeActionResult.t IO.t

Code action.

  • since 0.3
method on_req_execute_command : notify_back:notify_back -> id:Req_id.t -> workDoneToken:Lsp__Types.ProgressToken.t option -> string -> Yojson.Safe.t list option -> Yojson.Safe.t IO.t

Execute a command with given arguments.

  • since 0.3
method on_req_symbol : notify_back:notify_back -> id:Req_id.t -> uri:Lsp__Types.DocumentUri.t -> workDoneToken:Lsp__Types.ProgressToken.t option -> partialResultToken:Lsp__Types.ProgressToken.t option -> unit -> [ `DocumentSymbol of Lsp__.Types.DocumentSymbol.t list | `SymbolInformation of Lsp__.Types.SymbolInformation.t list ] option IO.t

List symbols in this document.

  • since 0.3
method on_unknown_request : notify_back:notify_back -> server_request:(server_request_handler_pair -> Req_id.t IO.t) -> id:Req_id.t -> string -> Jsonrpc.Structured.t option -> Yojson.Safe.t IO.t
method on_req_inlay_hint : notify_back:notify_back -> id:Req_id.t -> uri:Lsp__Types.DocumentUri.t -> range:Lsp.Types.Range.t -> unit -> Lsp.Types.InlayHint.t list option IO.t

Provide inlay hints for this document.

  • since 0.5
method on_request : 'a. notify_back:(Lsp.Server_notification.t -> unit IO.t) -> server_request:send_request -> id:Req_id.t -> 'a Lsp.Client_request.t -> 'a IO.t
method virtual on_notif_doc_did_open : notify_back:notify_back -> Lsp.Types.TextDocumentItem.t -> content:string -> unit IO.t

Called when a document is opened

method virtual on_notif_doc_did_close : notify_back:notify_back -> Lsp.Types.TextDocumentIdentifier.t -> unit IO.t
method 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.t

Called when the document changes.

method on_unknown_notification : notify_back:notify_back -> Jsonrpc.Notification.t -> unit IO.t
method on_notification_unhandled : notify_back:notify_back -> Lsp.Client_notification.t -> unit IO.t

Override to handle unprocessed notifications

method on_notification : notify_back:(Lsp.Server_notification.t -> unit IO.t) -> server_request:send_request -> Lsp.Client_notification.t -> unit IO.t
OCaml

Innovation. Community. Security.