### Snippet Syntax: Variable Transformation Example Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification This example demonstrates how to insert the current filename without its extension. It uses a regular expression to capture the base name before the final dot and suffix. ```plaintext ${TM_FILENAME/(.*)\..+$1/} ``` -------------------------------- ### Example JSON-RPC Message for Dynamic Capability Registration Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification An example of a JSON-RPC message used to dynamically register for the 'textDocument/willSaveWaitUntil' feature for JavaScript documents. ```json { "method": "client/registerCapability", "params": { "registrations": [ { "id": "79eee87c-c409-4664-8102-e03263673f6f", "method": "textDocument/willSaveWaitUntil", "registerOptions": { "documentSelector": [ { "language": "javascript" } ] } } ] } } ``` -------------------------------- ### Initialize Request Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/metaModel/metaModel.ts The initialize request is sent from the client to the server once after starting up. It is used to exchange initialization parameters and results. ```APIDOC ## POST /initialize ### Description Sent from the client to the server once after starting up. Used to exchange initialization parameters and results. ### Method POST ### Endpoint /initialize ### Parameters #### Request Body - **params** (InitializeParams) - Required - Initialization parameters. ### Response #### Success Response (200) - **result** (InitializeResult) - The result of the initialization. #### Error Response - **errorData** (InitializeError) - Error information if initialization fails. ``` -------------------------------- ### Client Initiated Progress Example Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification Demonstrates how a client initiates work done progress by including a `workDoneToken` in a request's parameters, and how a server uses this token to report progress via the `$/progress` notification. ```APIDOC ## Client Initiated Progress Consider a client sending a `textDocument/reference` request to a server and the client accepts work done progress reporting on that request. To signal this to the server the client would add a `workDoneToken` property to the reference request parameters. Something like this: ```json { "textDocument": { "uri": "file:///folder/file.ts" }, "position": { "line": 9, "character": 5 }, "context": { "includeDeclaration": true }, // The token used to report work done progress. "workDoneToken": "1d546990-40a3-4b77-b134-46622995f6ae" } ``` The corresponding type definition for the parameter property looks like this: ```typescript export interface WorkDoneProgressParams { /** * An optional token that a server can use to report work done progress. */ workDoneToken?: ProgressToken; } ``` A server uses the `workDoneToken` to report progress for the specific `textDocument/reference`. For the above request the `$/progress` notification params look like this: ```json { "token": "1d546990-40a3-4b77-b134-46622995f6ae", "value": { "kind": "begin", "title": "Finding references for A#foo", "cancellable": false, "message": "Processing file X.ts", "percentage": 0 } } ``` The token received via the `workDoneToken` property in a request’s param literal is only valid as long as the request has not send a response back. Canceling work done progress is done by simply canceling the corresponding request. There is no specific client capability signaling whether a client will send a progress token per request. The reason for this is that this is in many clients not a static aspect and might even change for every request instance for the same request type. So the capability is signal on every request instance by the presence of a `workDoneToken` property. To avoid that clients set up a progress monitor user interface before sending a request but the server doesn’t actually report any progress a server needs to signal general work done progress reporting support in the corresponding server capability. For the above find references example a server would signal such a support by setting the `referencesProvider` property in the server capabilities as follows: ```json { "referencesProvider": { "workDoneProgress": true } } ``` The corresponding type definition for the server capability looks like this: ```typescript export interface WorkDoneProgressOptions { workDoneProgress?: boolean; } ``` ``` -------------------------------- ### URI Encoding Example Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification Demonstrates valid URI formats, highlighting potential encoding differences for drive letters between clients and servers. Consistency in encoding is crucial for correct URI interpretation. ```plaintext file:///c:/project/readme.md file:///C%3A/project/readme.md ``` -------------------------------- ### Range Example Object (JSON) Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification Illustrates the structure of a range within a text document, defined by its start and end positions. The end position is exclusive. ```json { "start": { "line": 5, "character": 23 }, "end" : { "line": 6, "character": 0 } } ``` -------------------------------- ### Code Action Example Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification A basic code action object that can be resolved further via the codeAction/resolve request. ```json { "title": "Do Foo" } ``` -------------------------------- ### Python Notebook Cell Synchronization Example Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification This example demonstrates how to synchronize Python notebook cells to the server using a document filter. It specifies that only Python cells within Jupyter notebooks stored on disk should be synchronized. ```json { "notebookDocumentSync": { "notebookSelector": [ { "notebook": { "scheme": "file", "notebookType": "jupyter-notebook" }, "cells": [{ "language": "python" }] } ] } } ``` -------------------------------- ### Client Initiated Progress: Request Parameters Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification Example of a request with a `workDoneToken` property to initiate client-side progress reporting. The token is used by the server to send progress notifications. ```json { "textDocument": { "uri": "file:///folder/file.ts" }, "position": { "line": 9, "character": 5 }, "context": { "includeDeclaration": true }, // The token used to report work done progress. "workDoneToken": "1d546990-40a3-4b77-b134-46622995f6ae" } ``` -------------------------------- ### Request Parameters with Progress Tokens Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification This example shows how request parameters can include tokens for reporting work done progress and partial results. The `partialResultToken` indicates that the client accepts streaming results. ```json { "textDocument": { "uri": "file:///folder/file.ts" }, "position": { "line": 9, "character": 5 }, "context": { "includeDeclaration": true }, // The token used to report work done progress. "workDoneToken": "1d546990-40a3-4b77-b134-46622995f6ae", // The token used to report partial result progress. "partialResultToken": "5f6f349e-4f81-4a3b-afff-ee04bff96804" } ``` -------------------------------- ### Server Capabilities: Work Done Progress Option Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification Example of server capabilities indicating support for work done progress reporting. The `workDoneProgress` boolean flag must be set to `true` for features like `referencesProvider`. ```json { "referencesProvider": { "workDoneProgress": true } } ``` -------------------------------- ### Example Notebook Cell Content Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification Illustrates the content of two notebook cells, where the second cell contains a cursor position indicating a request for code completion. ```plaintext function add(a, b) { return a + b; } ``` ```plaintext add/**/; ``` -------------------------------- ### Semantic Token Edit Example Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification An example of a semantic token edit operation, specifying the start index, number of elements to delete, and the data to insert. Edits are applied to the number array. ```json { start: 0, deleteCount: 1, data: [3] } ``` -------------------------------- ### Workspace Folders Initialize Parameters Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/metaModel/metaModel.ts Parameters for initialization that include workspace folder information. ```APIDOC ## Workspace Folders Initialize Parameters ### Description Parameters for initialization including workspace folders. ### Parameters #### Request Body - **workspaceFolders** (Array | null, optional) - The workspace folders. ``` -------------------------------- ### Example JSON-RPC Message for Unregistering Capability Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification An example of a JSON-RPC message used to unregister the 'textDocument/willSaveWaitUntil' feature. ```json { "method": "client/unregisterCapability", "params": { "unregisterations": [ { "id": "79eee87c-c409-4664-8102-e03263673f6f", "method": "textDocument/willSaveWaitUntil" } ] } } ``` -------------------------------- ### Initialize Parameters Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/metaModel/metaModel.ts The parameters sent from the client to the server during the initialization phase. ```APIDOC ## Initialize Parameters ### Description The initialize parameters. ### Parameters #### Request Body - **processId** (integer | null) - The process Id of the parent process that started the server. Is `null` if the process has not been started by another process. If the parent process is not alive then the server should exit. - **clientInfo** (object, optional) - Information about the client - **name** (string) - The name of the client as defined by the client. - **version** (string, optional) - The client's version as defined by the client. @since 3.15.0 - **locale** (string, optional) - The locale the client is currently showing the user interface in. This must not necessarily be the locale of the operating system. Uses IETF language tags as the value's syntax (See https://en.wikipedia.org/wiki/IETF_language_tag) @since 3.16.0 - **rootPath** (string | null, optional) - The rootPath of the workspace. Is null if no folder is open. @deprecated in favour of rootUri. - **rootUri** (DocumentUri | null) - The rootUri of the workspace. Is null if no folder is open. If both `rootPath` and `rootUri` are set `rootUri` wins. @deprecated in favour of workspaceFolders. - **capabilities** (ClientCapabilities) - The capabilities provided by the client (editor or tool) - **initializationOptions** (LSPAny, optional) - User provided initialization options. - **trace** (TraceValues, optional) - The initial trace setting. If omitted trace is disabled ('off'). This interface also mixes in `WorkDoneProgressParams`. ``` -------------------------------- ### ImplementationOptions Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/metaModel/metaModel.ts Options for implementation requests, potentially including work done progress. ```APIDOC ## ImplementationOptions ### Description Options for implementation requests, potentially including work done progress. ### Mixins - WorkDoneProgressOptions ``` -------------------------------- ### DocumentFilter Examples Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification Examples of DocumentFilter to specify language, scheme, or pattern for document matching. At least one property must be set for a filter to be valid. ```typescript { language: 'typescript', scheme: 'file' } ``` ```typescript { language: 'json', pattern: '**/package.json' } ``` -------------------------------- ### Example Notebook Cell Document Filter Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification An example of how to filter for Python cell documents within Jupyter notebooks stored on disk, specifically those in paths containing 'books1'. ```json { note: { scheme: 'file', pattern '**/books1/**', noteType: 'jupyter-notebook' }, language: 'python' } ``` -------------------------------- ### window/workDoneProgress/create Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/metaModel/metaModel.ts The `window/workDoneProgress/create` request is sent from the server to the client to initiate progress reporting from the server. ```APIDOC ## window/workDoneProgress/create ### Description Initiates progress reporting from the server. ### Method POST ### Endpoint /window/workDoneProgress/create ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **token** (ProgressToken) - Required - The token to use for progress reporting. ### Request Example { "token": "12345" } ### Response #### Success Response (200) - **null** (null) - The response is null. #### Response Example null ``` -------------------------------- ### FileCreate Interface Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification Represents information for a file or folder creation. Includes the URI where the file or folder will be created. ```typescript /** * Represents information on a file/folder create. * * @since 3.16.0 */ export interface FileCreate { /** * A file:// URI for the location of the file/folder being created. */ uri: string; } ``` -------------------------------- ### Relative Encoded Semantic Tokens Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification Represents semantic tokens with start characters relative to the previous token on the same line. Tokens on different lines have their start characters unaltered. ```json { deltaLine: 2, deltaStartChar: 5, length: 3, tokenType: 0, tokenModifiers: 3 } ``` ```json { deltaLine: 0, deltaStartChar: 5, length: 4, tokenType: 1, tokenModifiers: 0 } ``` ```json { deltaLine: 3, deltaStartChar: 2, length: 7, tokenType: 2, tokenModifiers: 0 } ``` -------------------------------- ### InlayHintClientCapabilities Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/metaModel/metaModel.ts Inlay hint client capabilities, including support for dynamic registration and lazy resolution of properties. ```APIDOC ## InlayHintClientCapabilities ### Description Inlay hint client capabilities. @since 3.17.0 ### Properties #### dynamicRegistration (boolean, optional) Whether inlay hints support dynamic registration. #### resolveSupport (object, optional) Indicates which properties a client can resolve lazily on an inlay hint. ##### Properties ###### properties (array of string, optional) The properties that a client can resolve lazily. ``` -------------------------------- ### Implementation Registration Options Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification Defines registration options for the implementation provider, combining text document, implementation, and static registration options. ```typescript export interface ImplementationRegistrationOptions extends TextDocumentRegistrationOptions, ImplementationOptions, StaticRegistrationOptions { } ``` -------------------------------- ### Range Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/metaModel/metaModel.ts Defines a range in a text document using zero-based start and end positions. ```APIDOC ## Range ### Description A range in a text document expressed as (zero-based) start and end positions. If you want to specify a range that contains a line including the line ending character(s) then use an end position denoting the start of the next line. For example: ```ts { start: { line: 5, character: 23 } end : { line 6, character : 0 } } ``` ### Properties - **start** (Position) - The range's start position. - **end** (Position) - The range's end position. ``` -------------------------------- ### InitializeParams Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/metaModel/metaModel.ts Parameters sent to the language server to initialize the connection. ```APIDOC ## InitializeParams ### Description Parameters sent to the language server to initialize the connection. ### Type Definition ```typescript interface InitializeParams extends _InitializeParams, WorkspaceFoldersInitializeParams {} ``` ### Properties This type extends {@link _InitializeParams} and {@link WorkspaceFoldersInitializeParams}. ``` -------------------------------- ### FoldingRange Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/metaModel/metaModel.ts Represents a folding range within a text document, defined by start and end lines and characters. ```APIDOC ## FoldingRange ### Description Represents a folding range in a text document. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **startLine** (uinteger) - Required - The zero-based start line of the range to fold. The folded area starts after the line's last character. To be valid, the end must be zero or larger and smaller than the number of lines in the document. - **startCharacter** (uinteger) - Optional - The zero-based character offset from where the folded range starts. If not defined, defaults to the length of the start line. - **endLine** (uinteger) - Required - The zero-based end line of the range to fold. The folded area ends with the line's last character. To be valid, the end must be zero or larger and smaller than the number of lines in the document. - **endCharacter** (uinteger) - Optional - The zero-based character offset before the folded range ends. If not defined, defaults to the length of the end line. - **kind** (FoldingRangeKind) - Optional - The kind of the folding range. ### Request Example ```json { "startLine": 10, "startCharacter": 0, "endLine": 15, "endCharacter": 5, "kind": "comment" } ``` ### Response #### Success Response (200) This section is not detailed in the source. Typically, it would describe the structure of a successful response, which might be an empty object or a confirmation. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### textDocument/hover Request Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification A client-to-server request to get hover information for a symbol at a specific text document position. ```APIDOC ## Request: textDocument/hover ### Description Requests hover information for a symbol at a given position in a text document. ### Method Request ### Endpoint `textDocument/hover` ### Parameters #### Request Body - **textDocument** (string) - Required - The text document's URI in string form. - **position** (object) - Required - The position in the text document. - **line** (uinteger) - Required - The line number. - **character** (uinteger) - Required - The character number. ### Response #### Success Response (200) - **value** (string) - The hover information to be presented. A `null` value indicates no result. ``` -------------------------------- ### InitializeResult Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/metaModel/metaModel.ts The result returned from an initialize request, containing server information. ```APIDOC ## InitializeResult ### Description The result returned from an initialize request. ### Properties - **serverInfo** (InitializeResult.ServerInfo) - Optional - Information about the server. @since 3.15.0 ``` -------------------------------- ### Define Notebook Document Sync Registration Options Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification Extends `NotebookDocumentSyncOptions` with `StaticRegistrationOptions` for registering notebook synchronization capabilities. ```typescript /** * Registration options specific to a notebook. * * @since 3.17.0 */ export interface NotebookDocumentSyncRegistrationOptions extends NotebookDocumentSyncOptions, StaticRegistrationOptions { } ``` -------------------------------- ### SemanticTokensEdit Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/metaModel/metaModel.ts Represents an edit to semantic tokens, including the start offset, number of elements to delete, and optional data to insert. ```APIDOC ## SemanticTokensEdit ### Description Represents an edit to semantic tokens, including the start offset, number of elements to delete, and optional data to insert. ### Properties - **start** (uinteger) - The start offset of the edit. - **deleteCount** (uinteger) - The count of elements to remove. - **data** (uinteger[]) - Optional - The elements to insert. ``` -------------------------------- ### textDocument/moniker Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/metaModel/metaModel.ts A request to get the moniker of a symbol at a given text document position. The response can be an array of Moniker objects or null. ```APIDOC ## textDocument/moniker ### Description A request to get the moniker of a symbol at a given text document position. The request parameter is of type `TextDocumentPositionParams`. The response is of type `Moniker[]` or `null`. ### Method `textDocument/moniker` ### Parameters #### Request Body - **params** (MonikerParams) - Required - Parameters for the moniker request. ### Response #### Success Response (200) - **result** (Moniker[] | null) - An array of `Moniker` objects or `null`. ``` -------------------------------- ### NotebookCellArrayChange Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/metaModel/metaModel.ts Describes changes to a notebook cell array, specifying the start index, number of cells to delete, and the new cells to insert. ```APIDOC ## NotebookCellArrayChange ### Description A change describing how to move a `NotebookCell` array from state S to S'. @since 3.17.0 ### Properties - **start** (uinteger) - The start of the cell that changed. - **deleteCount** (uinteger) - The number of cells deleted. - **cells** (NotebookCell[]) - Optional. The new cells, if any. ``` -------------------------------- ### Inlay Hint Registration Options Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/metaModel/metaModel.ts Specifies the options for registering inlay hint providers, combining general inlay hint options with document registration and static registration capabilities. ```APIDOC ## InlayHintRegistrationOptions ### Description Options used for static or dynamic registration of inlay hint providers. ### Properties This type extends `InlayHintOptions`, `TextDocumentRegistrationOptions`, and `StaticRegistrationOptions`. ``` -------------------------------- ### Constructing MarkdownContent in TypeScript Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/metaModel/metaModel.ts Example of creating a `MarkupContent` literal with `MarkupKind.Markdown` in TypeScript. Clients may sanitize the markdown, potentially removing HTML. ```typescript let markdown: MarkdownContent = { kind: MarkupKind.Markdown, value: [ '# Header', 'Some text', '```typescript', 'someCode();', '```' ].join('\n') }; ``` -------------------------------- ### Execute Command Client Capabilities Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification Defines client capabilities for executing commands. Supports dynamic registration. ```typescript export interface ExecuteCommandClientCapabilities { /** * Execute command supports dynamic registration. */ dynamicRegistration?: boolean; } ``` -------------------------------- ### SemanticTokensEdit Interface Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification Defines a single edit operation for semantic tokens, specifying the start offset, number of elements to delete, and elements to insert. ```typescript export interface SemanticTokensEdit { /** * The start offset of the edit. */ start: uinteger; /** * The count of elements to remove. */ deleteCount: uinteger; /** * The elements to insert. */ ``` -------------------------------- ### SignatureHelp Client Capabilities Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/metaModel/metaModel Defines client capabilities for the SignatureHelp request, including support for active parameter highlighting and additional context information. It specifies whether the client supports dynamic registration for signature help. ```json { "activeParameterSupport": true, "contextSupport": true } ``` -------------------------------- ### Prepare Rename Request Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification The prepare rename request is sent from the client to the server to setup and test the validity of a rename operation at a given location. ```APIDOC ## textDocument/prepareRename ### Description Sets up and tests the validity of a rename operation at a given location. ### Method POST ### Endpoint /textDocument/prepareRename ### Parameters #### Request Body - **textDocument** (TextDocumentIdentifier) - Required - The text document in which the rename is to be prepared. - **position** (Position) - Required - The position in the text document at which the rename is to be prepared. - **workDoneToken** (ProgressToken) - Optional - The token to be used to report progress. ### Response #### Success Response (200) - **result** (Range | { range: Range, placeholder: string } | { defaultBehavior: boolean } | null) - Describes a `Range` of the string to rename and optionally a placeholder text. If `{ defaultBehavior: boolean }` is returned, the client should use its default behavior. If `null` is returned, a rename is not valid at the given position. ``` -------------------------------- ### InitializeResult Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/metaModel/metaModel.ts The result returned by the language server after initialization. ```APIDOC ## InitializeResult ### Description The result returned by the language server after initialization. ### Type Definition ```typescript interface InitializeResult { capabilities: ServerCapabilities; serverInfo?: { name: string; version?: string; }; } ``` ### Properties - **capabilities** (ServerCapabilities) - The capabilities the language server provides. - **serverInfo** (object) - Optional - Information about the server, including its name and version. ``` -------------------------------- ### Semantic Token Legend Example Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification Defines the token types and modifiers used for encoding semantic tokens. This legend must be provided upfront on registration. ```json { tokenTypes: ['property', 'type', 'class'], tokenModifiers: ['private', 'static'] } ``` -------------------------------- ### NotebookCellArrayChange Interface Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification Describes how to modify a notebook's cell array, specifying the start index, number of cells to delete, and any new cells to insert. ```typescript export interface NotebookCellArrayChange { /** * The start offset of the cell that changed. */ start: uinteger; /** * The deleted cells */ deleteCount: uinteger; /** * The new cells, if any */ cells?: NotebookCell[]; } ``` -------------------------------- ### Goto Implementation Request Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification The go to implementation request is sent from the client to the server to resolve the implementation location of a symbol at a given text document position. The result type `LocationLink`[] got introduced with version 3.14.0 and depends on the corresponding client capability `textDocument.implementation.linkSupport`. ```APIDOC ## textDocument/implementation ### Description Resolves the implementation location of a symbol at a given text document position. ### Method POST ### Endpoint /textDocument/implementation ### Parameters #### Request Body - **textDocument** (TextDocumentIdentifier) - Required - The text document. - **position** (Position) - Required - The position in the text document. - **workDoneToken** (ProgressToken) - Optional - The token to be used for progress reporting. ### Response #### Success Response (200) - **result** (Location | Location[] | LocationLink[] | null) - The implementation location(s) of the symbol. - **partial result** (Location[] | LocationLink[]) - Partial results. #### Response Example { "example": "[\n {\n \"uri\": \"file:///path/to/implementation.ts\",\n \"range\": {\n \"start\": { \"line\": 0, \"character\": 0 },\n \"end\": { \"line\": 0, \"character\": 10 }\n }\n }\n]" } ``` -------------------------------- ### WorkDoneProgressBegin Interface Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification Defines the payload for starting a work done progress notification. Used to report the beginning of a long-running operation. Since version 3.15.0. ```typescript export interface WorkDoneProgressBegin { kind: 'begin'; /** * Mandatory title of the progress operation. Used to briefly inform about * the kind of operation being performed. * * Examples: "Indexing" or "Linking dependencies". */ title: string; /** * Controls if a cancel button should show to allow the user to cancel the * long running operation. Clients that don't support cancellation are * allowed to ignore the setting. */ cancellable?: boolean; /** * Optional, more detailed associated progress message. Contains * complementary information to the `title`. * * Examples: "3/25 files", "project/src/module2", "node_modules/some_dep". * If unset, the previous progress message (if any) is still valid. */ message?: string; /** * Optional progress percentage to display (value 100 is considered 100%). * If not provided infinite progress is assumed and clients are allowed * to ignore the `percentage` value in subsequent report notifications. * * The value should be steadily rising. Clients are free to ignore values * that are not following this rule. The value range is [0, 100]. */ percentage?: uinteger; } ``` -------------------------------- ### Call Hierarchy Registration Options Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification Combines text document, call hierarchy, and static registration options for servers. ```typescript export interface CallHierarchyRegistrationOptions extends TextDocumentRegistrationOptions, CallHierarchyOptions, StaticRegistrationOptions { } ``` -------------------------------- ### Define MarkupKind Constants and Type Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification Defines constants for supported markup content types: 'plaintext' and 'markdown'. These kinds are reserved for internal usage and should not start with a '$'. ```typescript /** * Describes the content type that a client supports in various * result literals like `Hover`, `ParameterInfo` or `CompletionItem`. * * Please note that `MarkupKinds` must not start with a `$`. This kinds * are reserved for internal usage. */ export namespace MarkupKind { /** * Plain text is supported as a content format */ export const PlainText: 'plaintext' = 'plaintext'; /** * Markdown is supported as a content format */ export const Markdown: 'markdown' = 'markdown'; } export type MarkupKind = 'plaintext' | 'markdown'; ``` -------------------------------- ### Execute Command Parameters and Options Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/metaModel/metaModel.ts Details the parameters for the Execute Command request and its registration options. ```APIDOC ## ExecuteCommandParams ### Description Parameters for the Execute Command request, specifying the command to execute and its arguments. ### Method Not applicable ### Endpoint Not applicable ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **command** (string) - Required - The identifier of the actual command handler. - **arguments** (array of LSPAny) - Optional - Arguments that the command should be invoked with. ### Request Example ```json { "command": "myExtension.runCustomCommand", "arguments": [ "arg1", 123, { "key": "value" } ] } ``` ### Response #### Success Response (200) Not explicitly defined in this snippet, but typically a {@link LSPAny} representing the command's result. #### Response Example ```json { "result": "command executed successfully" } ``` ## ExecuteCommandRegistrationOptions ### Description Registration options for the Execute Command request, allowing servers to advertise commands they support. ### Method Not applicable ### Endpoint Not applicable ### Parameters None ### Request Example ```json { "commands": [ "myExtension.runCustomCommand", "another.command" ] } ``` ### Response None ``` -------------------------------- ### TextEdit Array Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification Complex text manipulations are described using an array of TextEdits or AnnotatedTextEdits. Edits must not overlap, but multiple edits can start at the same position. ```APIDOC ## TextEdit[] Complex text manipulations are described with an array of `TextEdit`’s or `AnnotatedTextEdit`’s, representing a single change to the document. All text edits ranges refer to positions in the document they are computed on. They therefore move a document from state S1 to S2 without describing any intermediate state. Text edits ranges must never overlap, that means no part of the original document must be manipulated by more than one edit. However, it is possible that multiple edits have the same start position: multiple inserts, or any number of inserts followed by a single remove or replace edit. If multiple inserts have the same position, the order in the array defines the order in which the inserted strings appear in the resulting text. ``` -------------------------------- ### Implementation Client Capabilities Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification Defines client capabilities for the implementation request, including support for dynamic registration and link support. ```typescript export interface ImplementationClientCapabilities { /** * Whether implementation supports dynamic registration. If this is set to * `true` the client supports the new `ImplementationRegistrationOptions` * return value for the corresponding server capability as well. */ dynamicRegistration?: boolean; /** * The client supports additional metadata in the form of definition links. * * @since 3.14.0 */ linkSupport?: boolean; } ``` -------------------------------- ### ExecuteCommandClientCapabilities Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/metaModel/metaModel.ts Defines the client capabilities for the execute command request, including support for dynamic registration. ```APIDOC ## ExecuteCommandClientCapabilities ### Description The client capabilities of a `ExecuteCommandRequest`. ### Properties - **dynamicRegistration** (boolean) - Optional - Execute command supports dynamic registration. ``` -------------------------------- ### Range Interface Definition (TypeScript) Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification Defines the structure for a range in a text document, composed of a start and an end `Position` object. The end position is exclusive. ```typescript interface Range { /** * The range's start position. */ start: Position; /** * The range's end position. */ end: Position; } ``` -------------------------------- ### Signature Help Client Capabilities Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/metaModel/metaModel Details the client's capabilities for signature help requests. It covers dynamic registration support and specific capabilities for signature information, including documentation format and parameter information, such as label offset support. ```json { "dynamicRegistration": true, "signatureInformation": { "documentationFormat": [ "markdown", "plaintext" ], "parameterInformation": { "labelOffsetSupport": true } } } ``` -------------------------------- ### Progress Notification Payload Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification Example of a `$/progress` notification payload sent by a server to report progress. It includes the token and the progress value, which can be 'begin', 'report', or 'end'. ```json { "token": "1d546990-40a3-4b77-b134-46622995f6ae", "value": { "kind": "begin", "title": "Finding references for A#foo", "cancellable": false, "message": "Processing file X.ts", "percentage": 0 } } ``` -------------------------------- ### Define Inlay Hint Workspace Client Capabilities Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification Defines the client's workspace capabilities for inlay hints, specifically supporting a refresh request from the server. Use this with care as it forces a global refresh of all inlay hints. ```typescript /** * Client workspace capabilities specific to inlay hints. * * @since 3.17.0 */ export interface InlayHintWorkspaceClientCapabilities { /** * Whether the client implementation supports a refresh request sent from * the server to the client. * * Note that this event is global and will force the client to refresh all * inlay hints currently shown. It should be used with absolute care and * is useful for situation where a server for example detects a project wide * change that requires such a calculation. */ refreshSupport?: boolean; } ``` -------------------------------- ### MarkedString Usage Example Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/metaModel/metaModel.ts MarkedString can represent markdown or code blocks. Markdown strings are sanitized, escaping HTML. Use MarkupContent instead as MarkedString is deprecated. ```typescript { "documentation": "MarkedString can be used to render human readable text. It is either a markdown string\n or a code-block that provides a language and a code snippet. The language identifier\n is semantically equal to the optional language identifier in fenced code blocks in GitHub\n issues. See https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting\n\n The pair of a language and a value is an equivalent to markdown:\n```${language}\n${value}\n```\n\n Note that markdown strings will be sanitized - that means html will be escaped.\n@deprecated use MarkupContent instead.", "deprecated": "use MarkupContent instead." } ``` -------------------------------- ### Execute Command Options Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification Defines server capabilities for executing commands. Specifies the list of commands the server can execute. ```typescript export interface ExecuteCommandOptions extends WorkDoneProgressOptions { /** * The commands to be executed on the server */ commands: string[]; } ``` -------------------------------- ### Parameter Information Interface Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification Defines the structure for a parameter within a signature, including its label and optional documentation. The label can be a string or a range specified by start and end offsets. ```typescript export interface ParameterInformation { /** * The label of this parameter information. * * Either a string or an inclusive start and exclusive end offsets within * its containing signature label. (see SignatureInformation.label). The * offsets are based on a UTF-16 string representation as `Position` and * `Range` does. * * *Note*: a label of type string should be a substring of its containing * signature label. Its intended use case is to highlight the parameter * label part in the `SignatureInformation.label`. */ label: string | [uinteger, uinteger]; /** * The human-readable doc-comment of this parameter. Will be shown * in the UI but can be omitted. */ documentation?: string | MarkupContent; } ``` -------------------------------- ### FoldingRange Interface Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification Represents a folding range within a document, specifying start and end lines and optional character offsets and kind. Clients may ignore invalid ranges. ```typescript /** * Represents a folding range. To be valid, start and end line must be bigger * than zero and smaller than the number of lines in the document. Clients * are free to ignore invalid ranges. */ export interface FoldingRange { /** * The zero-based start line of the range to fold. The folded area starts * after the line's last character. To be valid, the end must be zero or * larger and smaller than the number of lines in the document. */ startLine: uinteger; /** * The zero-based character offset from where the folded range starts. If * not defined, defaults to the length of the start line. */ startCharacter?: uinteger; /** * The zero-based end line of the range to fold. The folded area ends with * the line's last character. To be valid, the end must be zero or larger * and smaller than the number of lines in the document. */ endLine: uinteger; /** * The zero-based character offset before the folded range ends. If not * defined, defaults to the length of the end line. */ endCharacter?: uinteger; /** * Describes the kind of the folding range such as `comment` or `region`. * The kind is used to categorize folding ranges and used by commands like * 'Fold all comments'. See [FoldingRangeKind](#FoldingRangeKind) for an * enumeration of standardized kinds. */ kind?: FoldingRangeKind; /** * The text that the client should show when the specified range is * collapsed. If not defined or not supported by the client, a default * will be chosen by the client. * * @since 3.17.0 - proposed */ collapsedText?: string; } ``` -------------------------------- ### Window Show Message Request Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/metaModel/metaModel.ts Sent from the server to the client to show a message and a set of optional actions to the user. ```APIDOC ## POST /window/showMessageRequest ### Description Sent from the server to the client to show a message and a set of optional actions to the user. The client responds with the selected action or null. ### Method POST ### Endpoint /window/showMessageRequest ### Parameters #### Request Body - **params** (ShowMessageRequestParams) - Required - Parameters for the show message request, including the message and actions. ### Response #### Success Response (200) - **result** (MessageActionItem | null) - The user's selected action item, or null if no action was selected or the request was cancelled. ``` -------------------------------- ### CreateFile Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/metaModel/metaModel.ts Represents a file creation resource operation. ```APIDOC ## CreateFile ### Description Create file operation. ### Properties - **kind** (stringLiteral) - A create - **uri** (DocumentUri) - The resource to create. - **options** (CreateFileOptions) - Optional - Additional options. ``` -------------------------------- ### FoldingRange Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/metaModel/metaModel.ts Represents a folding range in a document. It includes start and end lines, and an optional kind and collapsed text. The kind helps categorize ranges for commands like 'Fold all comments'. ```APIDOC ## FoldingRange ### Description Represents a folding range. To be valid, start and end line must be bigger than zero and smaller than the number of lines in the document. Clients are free to ignore invalid ranges. ### Properties - **kind** (string) - Optional - Describes the kind of the folding range such as 'comment' or 'region'. The kind is used to categorize folding ranges and used by commands like 'Fold all comments'. See {@link FoldingRangeKind} for an enumeration of standardized kinds. - **collapsedText** (string) - Optional - The text that the client should show when the specified range is collapsed. If not defined or not supported by the client, a default will be chosen by the client. @since 3.17.0 ``` -------------------------------- ### SignatureHelpOptions Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/metaModel/metaModel.ts Server Capabilities for a SignatureHelpRequest. ```APIDOC ## SignatureHelpOptions ### Description Server Capabilities for a {@link SignatureHelpRequest}. ### Properties - **triggerCharacters** (string[]) - Optional - List of characters that trigger signature help automatically. - **retriggerCharacters** (string[]) - Optional - List of characters that re-trigger signature help. These trigger characters are only active when signature help is already showing. All trigger characters are also counted as re-trigger characters. @since 3.15.0 ### Mixins - WorkDoneProgressOptions ``` -------------------------------- ### Encoded Semantic Tokens Example Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification Shows semantic tokens after token types and modifiers have been encoded as integers using the legend. Token types are looked up by index, and modifiers use bit flags. ```json { line: 2, startChar: 5, length: 3, tokenType: 0, tokenModifiers: 3 } ``` ```json { line: 2, startChar: 10, length: 4, tokenType: 1, tokenModifiers: 0 } ``` ```json { line: 5, startChar: 2, length: 7, tokenType: 2, tokenModifiers: 0 } ``` -------------------------------- ### Inlay Hint Client Capabilities Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/metaModel/metaModel Outlines client capabilities for inlay hints, including support for dynamic registration and lazy resolution of inlay hint properties. Clients can specify which properties they can resolve lazily. ```json { "dynamicRegistration": true, "resolveSupport": { "properties": [ "label", "documentation", "toolTip", "paddingLeft", "paddingRight" ] } } ``` -------------------------------- ### SignatureHelpRegistrationOptions Interface Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification Combines text document registration options with signature help options for dynamic registration of signature help providers. ```typescript export interface SignatureHelpRegistrationOptions extends TextDocumentRegistrationOptions, SignatureHelpOptions { } ``` -------------------------------- ### Type Hierarchy Registration Options Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification Combines text document registration, type hierarchy options, and static registration options for registering type hierarchy providers. ```typescript export interface TypeHierarchyRegistrationOptions extends TextDocumentRegistrationOptions, TypeHierarchyOptions, StaticRegistrationOptions { } ``` -------------------------------- ### Initialized Notification Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification The initialized notification is sent from the client to the server after the client received the result of the `initialize` request but before the client is sending any other request or notification to the server. The server can use the `initialized` notification, for example, to dynamically register capabilities. The `initialized` notification may only be sent once. ```APIDOC ## Initialized Notification ### Description Sent from the client to the server after the `initialize` request result is received, before other client requests/notifications. Used by the server for dynamic capability registration. Can only be sent once. ### Method `initialized` ### Parameters `InitializedParams` (empty interface) ``` -------------------------------- ### FileCreate Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/metaModel/metaModel.ts Information on a file or folder creation, including its URI. ```APIDOC ## FileCreate ### Description Information on a file or folder creation, including its URI. ### Properties - **uri** (string) - A file:// URI for the location of the file/folder being created. ``` -------------------------------- ### textDocument/moniker Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification The `textDocument/moniker` request is sent from the client to the server to get the symbol monikers for a given text document position. An array of Moniker types is returned as response to indicate possible monikers at the given location. If no monikers can be calculated, an empty array or `null` should be returned. ```APIDOC ## textDocument/moniker ### Description This method allows clients to request symbol moniker information for a specific position in a text document. This information is crucial for linking symbols across different LSIF indexes and enabling cross-service code navigation. ### Method POST ### Endpoint /textDocument/moniker ### Parameters #### Request Body - **textDocument** (TextDocumentIdentifier) - Required - The text document for which the monikers are requested. - **position** (Position) - Required - The position in the text document for which the monikers are requested. - **workDoneToken** (ProgressToken) - Optional - An identifier to be used when reporting progress. ### Request Example ```json { "textDocument": { "uri": "file:///path/to/your/document.ts" }, "position": { "line": 10, "character": 5 } } ``` ### Response #### Success Response (200) - **result** (Moniker[] | null) - An array of monikers found at the given position, or null if none are found. #### Response Example ```json [ { "scheme": "typescript", "identifier": "MyClass", "unique": "project", "kind": "export" } ] ``` #### Partial Response - **partialResultToken** (ProgressToken) - Optional - An identifier to be used when returning partial results. #### Error Handling - **code** (ErrorCodes) - The error code. - **message** (string) - A detailed error message. ``` -------------------------------- ### Document On Type Formatting Client Capabilities Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification Defines client capabilities for on-type formatting. Use this to indicate if the client supports dynamic registration for this feature. ```typescript export interface DocumentOnTypeFormattingClientCapabilities { /** * Whether on type formatting supports dynamic registration. */ dynamicRegistration?: boolean; } ``` -------------------------------- ### DocumentHighlight Client Capabilities Source: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/metaModel/metaModel Details client capabilities for the DocumentHighlight request, indicating support for dynamic registration. ```json { "dynamicRegistration": true } ```