vscode-languageserver-protocol
Version:
VSCode Language Server Protocol implementation
1,423 lines • 115 kB
TypeScript
import { ProgressToken, RequestHandler, TraceValues } from 'vscode-jsonrpc';
import { MessageDirection, ProtocolRequestType, ProtocolRequestType0, ProtocolNotificationType, ProtocolNotificationType0 } from './messages';
import { Position, Range, Location, LocationLink, Diagnostic, Command, TextEdit, WorkspaceEdit, DocumentUri, TextDocumentIdentifier, VersionedTextDocumentIdentifier, TextDocumentItem, CompletionItem, CompletionList, Hover, SignatureHelp, Definition, ReferenceContext, DocumentHighlight, SymbolInformation, CodeLens, CodeActionContext, FormattingOptions, DocumentLink, MarkupKind, SymbolKind, CompletionItemKind, CodeAction, CodeActionKind, DocumentSymbol, CompletionItemTag, DiagnosticTag, SymbolTag, uinteger, integer, InsertTextMode, LSPAny, WorkspaceSymbol, URI, WorkspaceFolder } from 'vscode-languageserver-types';
import { ImplementationRequest, ImplementationClientCapabilities, ImplementationOptions, ImplementationRegistrationOptions, ImplementationParams } from './protocol.implementation';
import { TypeDefinitionRequest, TypeDefinitionClientCapabilities, TypeDefinitionOptions, TypeDefinitionRegistrationOptions, TypeDefinitionParams } from './protocol.typeDefinition';
import { WorkspaceFoldersRequest, DidChangeWorkspaceFoldersNotification, DidChangeWorkspaceFoldersParams, WorkspaceFoldersChangeEvent, WorkspaceFoldersInitializeParams, WorkspaceFoldersServerCapabilities } from './protocol.workspaceFolder';
import { ConfigurationRequest, ConfigurationParams, ConfigurationItem } from './protocol.configuration';
import { DocumentColorRequest, ColorPresentationRequest, DocumentColorOptions, DocumentColorParams, ColorPresentationParams, DocumentColorClientCapabilities, DocumentColorRegistrationOptions } from './protocol.colorProvider';
import { FoldingRangeClientCapabilities, FoldingRangeOptions, FoldingRangeRequest, FoldingRangeParams, FoldingRangeRegistrationOptions, FoldingRangeRefreshRequest, FoldingRangeWorkspaceClientCapabilities } from './protocol.foldingRange';
import { DeclarationClientCapabilities, DeclarationRequest, DeclarationOptions, DeclarationRegistrationOptions, DeclarationParams } from './protocol.declaration';
import { SelectionRangeClientCapabilities, SelectionRangeOptions, SelectionRangeRequest, SelectionRangeParams, SelectionRangeRegistrationOptions } from './protocol.selectionRange';
import { WorkDoneProgressBegin, WorkDoneProgressReport, WorkDoneProgressEnd, WorkDoneProgress, WorkDoneProgressCreateParams, WorkDoneProgressCreateRequest, WorkDoneProgressCancelParams, WorkDoneProgressCancelNotification } from './protocol.progress';
import { CallHierarchyClientCapabilities, CallHierarchyOptions, CallHierarchyRegistrationOptions, CallHierarchyIncomingCallsParams, CallHierarchyIncomingCallsRequest, CallHierarchyOutgoingCallsParams, CallHierarchyOutgoingCallsRequest, CallHierarchyPrepareParams, CallHierarchyPrepareRequest } from './protocol.callHierarchy';
import { SemanticTokensPartialResult, SemanticTokensDeltaPartialResult, TokenFormat, SemanticTokensClientCapabilities, SemanticTokensOptions, SemanticTokensRegistrationOptions, SemanticTokensParams, SemanticTokensRequest, SemanticTokensDeltaParams, SemanticTokensDeltaRequest, SemanticTokensRangeParams, SemanticTokensRangeRequest, SemanticTokensRefreshRequest, SemanticTokensWorkspaceClientCapabilities, SemanticTokensRegistrationType } from './protocol.semanticTokens';
import { ShowDocumentParams, ShowDocumentResult, ShowDocumentRequest, ShowDocumentClientCapabilities } from './protocol.showDocument';
import { LinkedEditingRangeClientCapabilities, LinkedEditingRanges, LinkedEditingRangeOptions, LinkedEditingRangeParams, LinkedEditingRangeRegistrationOptions, LinkedEditingRangeRequest } from './protocol.linkedEditingRange';
import { FileOperationOptions, FileOperationClientCapabilities, FileOperationRegistrationOptions, FileOperationPatternOptions, FileOperationPatternKind, DidCreateFilesNotification, CreateFilesParams, FileCreate, WillCreateFilesRequest, DidRenameFilesNotification, RenameFilesParams, FileRename, WillRenameFilesRequest, DidDeleteFilesNotification, DeleteFilesParams, FileDelete, WillDeleteFilesRequest } from './protocol.fileOperations';
import { UniquenessLevel, MonikerKind, Moniker, MonikerClientCapabilities, MonikerOptions, MonikerRegistrationOptions, MonikerParams, MonikerRequest } from './protocol.moniker';
import { TypeHierarchyClientCapabilities, TypeHierarchyOptions, TypeHierarchyRegistrationOptions, TypeHierarchyPrepareParams, TypeHierarchyPrepareRequest, TypeHierarchySubtypesParams, TypeHierarchySubtypesRequest, TypeHierarchySupertypesParams, TypeHierarchySupertypesRequest } from './protocol.typeHierarchy';
import { InlineValueClientCapabilities, InlineValueOptions, InlineValueRegistrationOptions, InlineValueWorkspaceClientCapabilities, InlineValueParams, InlineValueRequest, InlineValueRefreshRequest } from './protocol.inlineValue';
import { InlayHintClientCapabilities, InlayHintOptions, InlayHintRegistrationOptions, InlayHintWorkspaceClientCapabilities, InlayHintParams, InlayHintRequest, InlayHintResolveRequest, InlayHintRefreshRequest } from './protocol.inlayHint';
import { DiagnosticClientCapabilities, DiagnosticOptions, DiagnosticRegistrationOptions, DiagnosticServerCancellationData, DocumentDiagnosticParams, DocumentDiagnosticReportKind, FullDocumentDiagnosticReport, RelatedFullDocumentDiagnosticReport, UnchangedDocumentDiagnosticReport, RelatedUnchangedDocumentDiagnosticReport, DocumentDiagnosticReport, DocumentDiagnosticReportPartialResult, DocumentDiagnosticRequest, PreviousResultId, WorkspaceDiagnosticParams, WorkspaceFullDocumentDiagnosticReport, WorkspaceUnchangedDocumentDiagnosticReport, WorkspaceDocumentDiagnosticReport, WorkspaceDiagnosticReport, WorkspaceDiagnosticReportPartialResult, WorkspaceDiagnosticRequest, DiagnosticRefreshRequest, DiagnosticWorkspaceClientCapabilities } from './protocol.diagnostic';
import { NotebookDocumentSyncClientCapabilities, NotebookCellKind, ExecutionSummary, NotebookCell, NotebookDocument, NotebookDocumentIdentifier, VersionedNotebookDocumentIdentifier, NotebookDocumentSyncOptions, NotebookDocumentSyncRegistrationOptions, NotebookDocumentSyncRegistrationType, DidOpenNotebookDocumentParams, DidOpenNotebookDocumentNotification, NotebookCellArrayChange, NotebookDocumentChangeEvent, DidChangeNotebookDocumentParams, DidChangeNotebookDocumentNotification, DidSaveNotebookDocumentParams, DidSaveNotebookDocumentNotification, DidCloseNotebookDocumentParams, DidCloseNotebookDocumentNotification } from './protocol.notebook';
import { InlineCompletionClientCapabilities, InlineCompletionOptions, InlineCompletionParams, InlineCompletionRegistrationOptions, InlineCompletionRequest } from './protocol.inlineCompletion';
/**
* A document filter denotes a document by different properties like
* the {@link TextDocument.languageId language}, the {@link Uri.scheme scheme} of
* its resource, or a glob-pattern that is applied to the {@link TextDocument.fileName path}.
*
* Glob patterns can have the following syntax:
* - `*` to match one or more characters in a path segment
* - `?` to match on one character in a path segment
* - `**` to match any number of path segments, including none
* - `{}` to group sub patterns into an OR expression. (e.g. `**/*.{ts,js}` matches all TypeScript and JavaScript files)
* - `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …)
* - `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`)
*
* @sample A language filter that applies to typescript files on disk: `{ language: 'typescript', scheme: 'file' }`
* @sample A language filter that applies to all package.json paths: `{ language: 'json', pattern: '**package.json' }`
*
* @since 3.17.0
*/
export type TextDocumentFilter = {
/** A language id, like `typescript`. */
language: string;
/** A Uri {@link Uri.scheme scheme}, like `file` or `untitled`. */
scheme?: string;
/** A glob pattern, like **/*.{ts,js}. See TextDocumentFilter for examples. */
pattern?: string;
} | {
/** A language id, like `typescript`. */
language?: string;
/** A Uri {@link Uri.scheme scheme}, like `file` or `untitled`. */
scheme: string;
/** A glob pattern, like **/*.{ts,js}. See TextDocumentFilter for examples. */
pattern?: string;
} | {
/** A language id, like `typescript`. */
language?: string;
/** A Uri {@link Uri.scheme scheme}, like `file` or `untitled`. */
scheme?: string;
/** A glob pattern, like **/*.{ts,js}. See TextDocumentFilter for examples. */
pattern: string;
};
/**
* The TextDocumentFilter namespace provides helper functions to work with
* {@link TextDocumentFilter} literals.
*
* @since 3.17.0
*/
export declare namespace TextDocumentFilter {
function is(value: any): value is TextDocumentFilter;
}
/**
* A notebook document filter denotes a notebook document by
* different properties. The properties will be match
* against the notebook's URI (same as with documents)
*
* @since 3.17.0
*/
export type NotebookDocumentFilter = {
/** The type of the enclosing notebook. */
notebookType: string;
/** A Uri {@link Uri.scheme scheme}, like `file` or `untitled`. */
scheme?: string;
/** A glob pattern. */
pattern?: string;
} | {
/** The type of the enclosing notebook. */
notebookType?: string;
/** A Uri {@link Uri.scheme scheme}, like `file` or `untitled`.*/
scheme: string;
/** A glob pattern. */
pattern?: string;
} | {
/** The type of the enclosing notebook. */
notebookType?: string;
/** A Uri {@link Uri.scheme scheme}, like `file` or `untitled`. */
scheme?: string;
/** A glob pattern. */
pattern: string;
};
/**
* The NotebookDocumentFilter namespace provides helper functions to work with
* {@link NotebookDocumentFilter} literals.
*
* @since 3.17.0
*/
export declare namespace NotebookDocumentFilter {
function is(value: any): value is NotebookDocumentFilter;
}
/**
* A notebook cell text document filter denotes a cell text
* document by different properties.
*
* @since 3.17.0
*/
export type NotebookCellTextDocumentFilter = {
/**
* A filter that matches against the notebook
* containing the notebook cell. If a string
* value is provided it matches against the
* notebook type. '*' matches every notebook.
*/
notebook: string | NotebookDocumentFilter;
/**
* A language id like `python`.
*
* Will be matched against the language id of the
* notebook cell document. '*' matches every language.
*/
language?: string;
};
/**
* The NotebookCellTextDocumentFilter namespace provides helper functions to work with
* {@link NotebookCellTextDocumentFilter} literals.
*
* @since 3.17.0
*/
export declare namespace NotebookCellTextDocumentFilter {
function is(value: any): value is NotebookCellTextDocumentFilter;
}
/**
* A document filter describes a top level text document or
* a notebook cell document.
*
* @since 3.17.0 - proposed support for NotebookCellTextDocumentFilter.
*/
export type DocumentFilter = TextDocumentFilter | NotebookCellTextDocumentFilter;
/**
* A document selector is the combination of one or many document filters.
*
* @sample `let sel:DocumentSelector = [{ language: 'typescript' }, { language: 'json', pattern: '**∕tsconfig.json' }]`;
*
* The use of a string as a document filter is deprecated @since 3.16.0.
*/
export type DocumentSelector = (string | DocumentFilter)[];
/**
* The DocumentSelector namespace provides helper functions to work with
* {@link DocumentSelector}s.
*/
export declare namespace DocumentSelector {
function is(value: any[] | undefined | null): value is DocumentSelector;
}
/**
* General parameters to register for a notification or to register a provider.
*/
export interface Registration {
/**
* The id used to register the request. The id can be used to deregister
* the request again.
*/
id: string;
/**
* The method / capability to register for.
*/
method: string;
/**
* Options necessary for the registration.
*/
registerOptions?: LSPAny;
}
export interface RegistrationParams {
registrations: Registration[];
}
/**
* The `client/registerCapability` request is sent from the server to the client to register a new capability
* handler on the client side.
*/
export declare namespace RegistrationRequest {
const method: 'client/registerCapability';
const messageDirection: MessageDirection;
const type: ProtocolRequestType<RegistrationParams, void, never, void, void>;
type HandlerSignature = RequestHandler<RegistrationParams, void, void>;
}
/**
* General parameters to unregister a request or notification.
*/
export interface Unregistration {
/**
* The id used to unregister the request or notification. Usually an id
* provided during the register request.
*/
id: string;
/**
* The method to unregister for.
*/
method: string;
}
export interface UnregistrationParams {
unregisterations: Unregistration[];
}
/**
* The `client/unregisterCapability` request is sent from the server to the client to unregister a previously registered capability
* handler on the client side.
*/
export declare namespace UnregistrationRequest {
const method: 'client/unregisterCapability';
const messageDirection: MessageDirection;
const type: ProtocolRequestType<UnregistrationParams, void, never, void, void>;
type HandlerSignature = RequestHandler<UnregistrationParams, void, void>;
}
export interface WorkDoneProgressParams {
/**
* An optional token that a server can use to report work done progress.
*/
workDoneToken?: ProgressToken;
}
export interface PartialResultParams {
/**
* An optional token that a server can use to report partial results (e.g. streaming) to
* the client.
*/
partialResultToken?: ProgressToken;
}
/**
* A parameter literal used in requests to pass a text document and a position inside that
* document.
*/
export interface TextDocumentPositionParams {
/**
* The text document.
*/
textDocument: TextDocumentIdentifier;
/**
* The position inside the text document.
*/
position: Position;
}
/**
* The kind of resource operations supported by the client.
*/
export type ResourceOperationKind = 'create' | 'rename' | 'delete';
export declare namespace ResourceOperationKind {
/**
* Supports creating new files and folders.
*/
const Create: ResourceOperationKind;
/**
* Supports renaming existing files and folders.
*/
const Rename: ResourceOperationKind;
/**
* Supports deleting existing files and folders.
*/
const Delete: ResourceOperationKind;
}
export type FailureHandlingKind = 'abort' | 'transactional' | 'undo' | 'textOnlyTransactional';
export declare namespace FailureHandlingKind {
/**
* Applying the workspace change is simply aborted if one of the changes provided
* fails. All operations executed before the failing operation stay executed.
*/
const Abort: FailureHandlingKind;
/**
* All operations are executed transactional. That means they either all
* succeed or no changes at all are applied to the workspace.
*/
const Transactional: FailureHandlingKind;
/**
* If the workspace edit contains only textual file changes they are executed transactional.
* If resource changes (create, rename or delete file) are part of the change the failure
* handling strategy is abort.
*/
const TextOnlyTransactional: FailureHandlingKind;
/**
* The client tries to undo the operations already executed. But there is no
* guarantee that this is succeeding.
*/
const Undo: FailureHandlingKind;
}
/**
* Workspace specific client capabilities.
*/
export interface WorkspaceClientCapabilities {
/**
* The client supports applying batch edits
* to the workspace by supporting the request
* 'workspace/applyEdit'
*/
applyEdit?: boolean;
/**
* Capabilities specific to `WorkspaceEdit`s.
*/
workspaceEdit?: WorkspaceEditClientCapabilities;
/**
* Capabilities specific to the `workspace/didChangeConfiguration` notification.
*/
didChangeConfiguration?: DidChangeConfigurationClientCapabilities;
/**
* Capabilities specific to the `workspace/didChangeWatchedFiles` notification.
*/
didChangeWatchedFiles?: DidChangeWatchedFilesClientCapabilities;
/**
* Capabilities specific to the `workspace/symbol` request.
*/
symbol?: WorkspaceSymbolClientCapabilities;
/**
* Capabilities specific to the `workspace/executeCommand` request.
*/
executeCommand?: ExecuteCommandClientCapabilities;
/**
* The client has support for workspace folders.
*
* @since 3.6.0
*/
workspaceFolders?: boolean;
/**
* The client supports `workspace/configuration` requests.
*
* @since 3.6.0
*/
configuration?: boolean;
/**
* Capabilities specific to the semantic token requests scoped to the
* workspace.
*
* @since 3.16.0.
*/
semanticTokens?: SemanticTokensWorkspaceClientCapabilities;
/**
* Capabilities specific to the code lens requests scoped to the
* workspace.
*
* @since 3.16.0.
*/
codeLens?: CodeLensWorkspaceClientCapabilities;
/**
* The client has support for file notifications/requests for user operations on files.
*
* Since 3.16.0
*/
fileOperations?: FileOperationClientCapabilities;
/**
* Capabilities specific to the inline values requests scoped to the
* workspace.
*
* @since 3.17.0.
*/
inlineValue?: InlineValueWorkspaceClientCapabilities;
/**
* Capabilities specific to the inlay hint requests scoped to the
* workspace.
*
* @since 3.17.0.
*/
inlayHint?: InlayHintWorkspaceClientCapabilities;
/**
* Capabilities specific to the diagnostic requests scoped to the
* workspace.
*
* @since 3.17.0.
*/
diagnostics?: DiagnosticWorkspaceClientCapabilities;
/**
* Capabilities specific to the folding range requests scoped to the workspace.
*
* @since 3.18.0
* @proposed
*/
foldingRange?: FoldingRangeWorkspaceClientCapabilities;
}
/**
* Text document specific client capabilities.
*/
export interface TextDocumentClientCapabilities {
/**
* Defines which synchronization capabilities the client supports.
*/
synchronization?: TextDocumentSyncClientCapabilities;
/**
* Capabilities specific to the `textDocument/completion` request.
*/
completion?: CompletionClientCapabilities;
/**
* Capabilities specific to the `textDocument/hover` request.
*/
hover?: HoverClientCapabilities;
/**
* Capabilities specific to the `textDocument/signatureHelp` request.
*/
signatureHelp?: SignatureHelpClientCapabilities;
/**
* Capabilities specific to the `textDocument/declaration` request.
*
* @since 3.14.0
*/
declaration?: DeclarationClientCapabilities;
/**
* Capabilities specific to the `textDocument/definition` request.
*/
definition?: DefinitionClientCapabilities;
/**
* Capabilities specific to the `textDocument/typeDefinition` request.
*
* @since 3.6.0
*/
typeDefinition?: TypeDefinitionClientCapabilities;
/**
* Capabilities specific to the `textDocument/implementation` request.
*
* @since 3.6.0
*/
implementation?: ImplementationClientCapabilities;
/**
* Capabilities specific to the `textDocument/references` request.
*/
references?: ReferenceClientCapabilities;
/**
* Capabilities specific to the `textDocument/documentHighlight` request.
*/
documentHighlight?: DocumentHighlightClientCapabilities;
/**
* Capabilities specific to the `textDocument/documentSymbol` request.
*/
documentSymbol?: DocumentSymbolClientCapabilities;
/**
* Capabilities specific to the `textDocument/codeAction` request.
*/
codeAction?: CodeActionClientCapabilities;
/**
* Capabilities specific to the `textDocument/codeLens` request.
*/
codeLens?: CodeLensClientCapabilities;
/**
* Capabilities specific to the `textDocument/documentLink` request.
*/
documentLink?: DocumentLinkClientCapabilities;
/**
* Capabilities specific to the `textDocument/documentColor` and the
* `textDocument/colorPresentation` request.
*
* @since 3.6.0
*/
colorProvider?: DocumentColorClientCapabilities;
/**
* Capabilities specific to the `textDocument/formatting` request.
*/
formatting?: DocumentFormattingClientCapabilities;
/**
* Capabilities specific to the `textDocument/rangeFormatting` request.
*/
rangeFormatting?: DocumentRangeFormattingClientCapabilities;
/**
* Capabilities specific to the `textDocument/onTypeFormatting` request.
*/
onTypeFormatting?: DocumentOnTypeFormattingClientCapabilities;
/**
* Capabilities specific to the `textDocument/rename` request.
*/
rename?: RenameClientCapabilities;
/**
* Capabilities specific to the `textDocument/foldingRange` request.
*
* @since 3.10.0
*/
foldingRange?: FoldingRangeClientCapabilities;
/**
* Capabilities specific to the `textDocument/selectionRange` request.
*
* @since 3.15.0
*/
selectionRange?: SelectionRangeClientCapabilities;
/**
* Capabilities specific to the `textDocument/publishDiagnostics` notification.
*/
publishDiagnostics?: PublishDiagnosticsClientCapabilities;
/**
* Capabilities specific to the various call hierarchy requests.
*
* @since 3.16.0
*/
callHierarchy?: CallHierarchyClientCapabilities;
/**
* Capabilities specific to the various semantic token request.
*
* @since 3.16.0
*/
semanticTokens?: SemanticTokensClientCapabilities;
/**
* Capabilities specific to the `textDocument/linkedEditingRange` request.
*
* @since 3.16.0
*/
linkedEditingRange?: LinkedEditingRangeClientCapabilities;
/**
* Client capabilities specific to the `textDocument/moniker` request.
*
* @since 3.16.0
*/
moniker?: MonikerClientCapabilities;
/**
* Capabilities specific to the various type hierarchy requests.
*
* @since 3.17.0
*/
typeHierarchy?: TypeHierarchyClientCapabilities;
/**
* Capabilities specific to the `textDocument/inlineValue` request.
*
* @since 3.17.0
*/
inlineValue?: InlineValueClientCapabilities;
/**
* Capabilities specific to the `textDocument/inlayHint` request.
*
* @since 3.17.0
*/
inlayHint?: InlayHintClientCapabilities;
/**
* Capabilities specific to the diagnostic pull model.
*
* @since 3.17.0
*/
diagnostic?: DiagnosticClientCapabilities;
/**
* Client capabilities specific to inline completions.
*
* @since 3.18.0
* @proposed
*/
inlineCompletion?: InlineCompletionClientCapabilities;
}
export interface WindowClientCapabilities {
/**
* It indicates whether the client supports server initiated
* progress using the `window/workDoneProgress/create` request.
*
* The capability also controls Whether client supports handling
* of progress notifications. If set servers are allowed to report a
* `workDoneProgress` property in the request specific server
* capabilities.
*
* @since 3.15.0
*/
workDoneProgress?: boolean;
/**
* Capabilities specific to the showMessage request.
*
* @since 3.16.0
*/
showMessage?: ShowMessageRequestClientCapabilities;
/**
* Capabilities specific to the showDocument request.
*
* @since 3.16.0
*/
showDocument?: ShowDocumentClientCapabilities;
}
/**
* Client capabilities specific to regular expressions.
*
* @since 3.16.0
*/
export interface RegularExpressionsClientCapabilities {
/**
* The engine's name.
*/
engine: string;
/**
* The engine's version.
*/
version?: string;
}
/**
* Client capabilities specific to the used markdown parser.
*
* @since 3.16.0
*/
export interface MarkdownClientCapabilities {
/**
* The name of the parser.
*/
parser: string;
/**
* The version of the parser.
*/
version?: string;
/**
* A list of HTML tags that the client allows / supports in
* Markdown.
*
* @since 3.17.0
*/
allowedTags?: string[];
}
/**
* A set of predefined position encoding kinds.
*
* @since 3.17.0
*/
export declare namespace PositionEncodingKind {
/**
* Character offsets count UTF-8 code units (e.g. bytes).
*/
const UTF8: PositionEncodingKind;
/**
* Character offsets count UTF-16 code units.
*
* This is the default and must always be supported
* by servers
*/
const UTF16: PositionEncodingKind;
/**
* Character offsets count UTF-32 code units.
*
* Implementation note: these are the same as Unicode codepoints,
* so this `PositionEncodingKind` may also be used for an
* encoding-agnostic representation of character offsets.
*/
const UTF32: PositionEncodingKind;
}
/**
* A type indicating how positions are encoded,
* specifically what column offsets mean.
*
* @since 3.17.0
*/
export type PositionEncodingKind = string;
/**
* General client capabilities.
*
* @since 3.16.0
*/
export interface GeneralClientCapabilities {
/**
* Client capability that signals how the client
* handles stale requests (e.g. a request
* for which the client will not process the response
* anymore since the information is outdated).
*
* @since 3.17.0
*/
staleRequestSupport?: {
/**
* The client will actively cancel the request.
*/
cancel: boolean;
/**
* The list of requests for which the client
* will retry the request if it receives a
* response with error code `ContentModified`
*/
retryOnContentModified: string[];
};
/**
* Client capabilities specific to regular expressions.
*
* @since 3.16.0
*/
regularExpressions?: RegularExpressionsClientCapabilities;
/**
* Client capabilities specific to the client's markdown parser.
*
* @since 3.16.0
*/
markdown?: MarkdownClientCapabilities;
/**
* The position encodings supported by the client. Client and server
* have to agree on the same position encoding to ensure that offsets
* (e.g. character position in a line) are interpreted the same on both
* sides.
*
* To keep the protocol backwards compatible the following applies: if
* the value 'utf-16' is missing from the array of position encodings
* servers can assume that the client supports UTF-16. UTF-16 is
* therefore a mandatory encoding.
*
* If omitted it defaults to ['utf-16'].
*
* Implementation considerations: since the conversion from one encoding
* into another requires the content of the file / line the conversion
* is best done where the file is read which is usually on the server
* side.
*
* @since 3.17.0
*/
positionEncodings?: PositionEncodingKind[];
}
/**
* Capabilities specific to the notebook document support.
*
* @since 3.17.0
*/
export interface NotebookDocumentClientCapabilities {
/**
* Capabilities specific to notebook document synchronization
*
* @since 3.17.0
*/
synchronization: NotebookDocumentSyncClientCapabilities;
}
/**
* Defines the capabilities provided by the client.
*/
export interface ClientCapabilities {
/**
* Workspace specific client capabilities.
*/
workspace?: WorkspaceClientCapabilities;
/**
* Text document specific client capabilities.
*/
textDocument?: TextDocumentClientCapabilities;
/**
* Capabilities specific to the notebook document support.
*
* @since 3.17.0
*/
notebookDocument?: NotebookDocumentClientCapabilities;
/**
* Window specific client capabilities.
*/
window?: WindowClientCapabilities;
/**
* General client capabilities.
*
* @since 3.16.0
*/
general?: GeneralClientCapabilities;
/**
* Experimental client capabilities.
*/
experimental?: LSPAny;
}
/**
* Static registration options to be returned in the initialize
* request.
*/
export interface StaticRegistrationOptions {
/**
* The id used to register the request. The id can be used to deregister
* the request again. See also Registration#id.
*/
id?: string;
}
/**
* The StaticRegistrationOptions namespace provides helper functions to work with
* {@link StaticRegistrationOptions} literals.
*/
export declare namespace StaticRegistrationOptions {
function hasId(value: object): value is {
id: string;
};
}
/**
* General text document registration options.
*/
export interface TextDocumentRegistrationOptions {
/**
* A document selector to identify the scope of the registration. If set to null
* the document selector provided on the client side will be used.
*/
documentSelector: DocumentSelector | null;
}
/**
* The TextDocumentRegistrationOptions namespace provides helper functions to work with
* {@link TextDocumentRegistrationOptions} literals.
*/
export declare namespace TextDocumentRegistrationOptions {
function is(value: any): value is TextDocumentRegistrationOptions;
}
/**
* Save options.
*/
export interface SaveOptions {
/**
* The client is supposed to include the content on save.
*/
includeText?: boolean;
}
export interface WorkDoneProgressOptions {
workDoneProgress?: boolean;
}
/**
* The WorkDoneProgressOptions namespace provides helper functions to work with
* {@link WorkDoneProgressOptions} literals.
*/
export declare namespace WorkDoneProgressOptions {
function is(value: any): value is WorkDoneProgressOptions;
function hasWorkDoneProgress(value: any): value is {
workDoneProgress: boolean;
};
}
/**
* Defines the capabilities provided by a language
* server.
*/
export interface ServerCapabilities<T = LSPAny> {
/**
* The position encoding the server picked from the encodings offered
* by the client via the client capability `general.positionEncodings`.
*
* If the client didn't provide any position encodings the only valid
* value that a server can return is 'utf-16'.
*
* If omitted it defaults to 'utf-16'.
*
* @since 3.17.0
*/
positionEncoding?: PositionEncodingKind;
/**
* Defines how text documents are synced. Is either a detailed structure
* defining each notification or for backwards compatibility the
* TextDocumentSyncKind number.
*/
textDocumentSync?: TextDocumentSyncOptions | TextDocumentSyncKind;
/**
* Defines how notebook documents are synced.
*
* @since 3.17.0
*/
notebookDocumentSync?: NotebookDocumentSyncOptions | NotebookDocumentSyncRegistrationOptions;
/**
* The server provides completion support.
*/
completionProvider?: CompletionOptions;
/**
* The server provides hover support.
*/
hoverProvider?: boolean | HoverOptions;
/**
* The server provides signature help support.
*/
signatureHelpProvider?: SignatureHelpOptions;
/**
* The server provides Goto Declaration support.
*/
declarationProvider?: boolean | DeclarationOptions | DeclarationRegistrationOptions;
/**
* The server provides goto definition support.
*/
definitionProvider?: boolean | DefinitionOptions;
/**
* The server provides Goto Type Definition support.
*/
typeDefinitionProvider?: boolean | TypeDefinitionOptions | TypeDefinitionRegistrationOptions;
/**
* The server provides Goto Implementation support.
*/
implementationProvider?: boolean | ImplementationOptions | ImplementationRegistrationOptions;
/**
* The server provides find references support.
*/
referencesProvider?: boolean | ReferenceOptions;
/**
* The server provides document highlight support.
*/
documentHighlightProvider?: boolean | DocumentHighlightOptions;
/**
* The server provides document symbol support.
*/
documentSymbolProvider?: boolean | DocumentSymbolOptions;
/**
* The server provides code actions. CodeActionOptions may only be
* specified if the client states that it supports
* `codeActionLiteralSupport` in its initial `initialize` request.
*/
codeActionProvider?: boolean | CodeActionOptions;
/**
* The server provides code lens.
*/
codeLensProvider?: CodeLensOptions;
/**
* The server provides document link support.
*/
documentLinkProvider?: DocumentLinkOptions;
/**
* The server provides color provider support.
*/
colorProvider?: boolean | DocumentColorOptions | DocumentColorRegistrationOptions;
/**
* The server provides workspace symbol support.
*/
workspaceSymbolProvider?: boolean | WorkspaceSymbolOptions;
/**
* The server provides document formatting.
*/
documentFormattingProvider?: boolean | DocumentFormattingOptions;
/**
* The server provides document range formatting.
*/
documentRangeFormattingProvider?: boolean | DocumentRangeFormattingOptions;
/**
* The server provides document formatting on typing.
*/
documentOnTypeFormattingProvider?: DocumentOnTypeFormattingOptions;
/**
* The server provides rename support. RenameOptions may only be
* specified if the client states that it supports
* `prepareSupport` in its initial `initialize` request.
*/
renameProvider?: boolean | RenameOptions;
/**
* The server provides folding provider support.
*/
foldingRangeProvider?: boolean | FoldingRangeOptions | FoldingRangeRegistrationOptions;
/**
* The server provides selection range support.
*/
selectionRangeProvider?: boolean | SelectionRangeOptions | SelectionRangeRegistrationOptions;
/**
* The server provides execute command support.
*/
executeCommandProvider?: ExecuteCommandOptions;
/**
* The server provides call hierarchy support.
*
* @since 3.16.0
*/
callHierarchyProvider?: boolean | CallHierarchyOptions | CallHierarchyRegistrationOptions;
/**
* The server provides linked editing range support.
*
* @since 3.16.0
*/
linkedEditingRangeProvider?: boolean | LinkedEditingRangeOptions | LinkedEditingRangeRegistrationOptions;
/**
* The server provides semantic tokens support.
*
* @since 3.16.0
*/
semanticTokensProvider?: SemanticTokensOptions | SemanticTokensRegistrationOptions;
/**
* The server provides moniker support.
*
* @since 3.16.0
*/
monikerProvider?: boolean | MonikerOptions | MonikerRegistrationOptions;
/**
* The server provides type hierarchy support.
*
* @since 3.17.0
*/
typeHierarchyProvider?: boolean | TypeHierarchyOptions | TypeHierarchyRegistrationOptions;
/**
* The server provides inline values.
*
* @since 3.17.0
*/
inlineValueProvider?: boolean | InlineValueOptions | InlineValueRegistrationOptions;
/**
* The server provides inlay hints.
*
* @since 3.17.0
*/
inlayHintProvider?: boolean | InlayHintOptions | InlayHintRegistrationOptions;
/**
* The server has support for pull model diagnostics.
*
* @since 3.17.0
*/
diagnosticProvider?: DiagnosticOptions | DiagnosticRegistrationOptions;
/**
* Inline completion options used during static registration.
*
* @since 3.18.0
* @proposed
*/
inlineCompletionProvider?: boolean | InlineCompletionOptions;
/**
* Workspace specific server capabilities.
*/
workspace?: {
/**
* The server supports workspace folder.
*
* @since 3.6.0
*/
workspaceFolders?: WorkspaceFoldersServerCapabilities;
/**
* The server is interested in notifications/requests for operations on files.
*
* @since 3.16.0
*/
fileOperations?: FileOperationOptions;
};
/**
* Experimental server capabilities.
*/
experimental?: T;
}
/**
* The initialize request is sent from the client to the server.
* It is sent once as the request after starting up the server.
* The requests parameter is of type {@link InitializeParams}
* the response if of type {@link InitializeResult} of a Thenable that
* resolves to such.
*/
export declare namespace InitializeRequest {
const method: 'initialize';
const messageDirection: MessageDirection;
const type: ProtocolRequestType<InitializeParams, InitializeResult<any>, never, InitializeError, void>;
}
/**
* The initialize parameters
*/
export interface _InitializeParams extends WorkDoneProgressParams {
/**
* 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.
*/
processId: integer | null;
/**
* Information about the client
*
* @since 3.15.0
*/
clientInfo?: {
/**
* The name of the client as defined by the client.
*/
name: string;
/**
* The client's version as defined by the client.
*/
version?: string;
};
/**
* 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
*/
locale?: string;
/**
* The rootPath of the workspace. Is null
* if no folder is open.
*
* @deprecated in favour of rootUri.
*/
rootPath?: string | 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.
*/
rootUri: DocumentUri | null;
/**
* The capabilities provided by the client (editor or tool)
*/
capabilities: ClientCapabilities;
/**
* User provided initialization options.
*/
initializationOptions?: LSPAny;
/**
* The initial trace setting. If omitted trace is disabled ('off').
*/
trace?: TraceValues;
}
export type InitializeParams = _InitializeParams & WorkspaceFoldersInitializeParams;
/**
* The result returned from an initialize request.
*/
export interface InitializeResult<T = any> {
/**
* The capabilities the language server provides.
*/
capabilities: ServerCapabilities<T>;
/**
* Information about the server.
*
* @since 3.15.0
*/
serverInfo?: {
/**
* The name of the server as defined by the server.
*/
name: string;
/**
* The server's version as defined by the server.
*/
version?: string;
};
/**
* Custom initialization results.
*/
[custom: string]: LSPAny | ServerCapabilities<T> | undefined; /** undefined is needed since serverInfo is optional */
}
/**
* Known error codes for an `InitializeErrorCodes`;
*/
export declare namespace InitializeErrorCodes {
/**
* If the protocol version provided by the client can't be handled by the server.
*
* @deprecated This initialize error got replaced by client capabilities. There is
* no version handshake in version 3.0x
*/
const unknownProtocolVersion: 1;
}
export type InitializeErrorCodes = 1;
/**
* The data type of the ResponseError if the
* initialize request fails.
*/
export interface InitializeError {
/**
* Indicates whether the client execute the following retry logic:
* (1) show the message provided by the ResponseError to the user
* (2) user selects retry or cancel
* (3) if user selected retry the initialize method is sent again.
*/
retry: boolean;
}
export interface InitializedParams {
}
/**
* The initialized notification is sent from the client to the
* server after the client is fully initialized and the server
* is allowed to send requests from the server to the client.
*/
export declare namespace InitializedNotification {
const method: 'initialized';
const messageDirection: MessageDirection;
const type: ProtocolNotificationType<InitializedParams, void>;
}
/**
* A shutdown request is sent from the client to the server.
* It is sent once when the client decides to shutdown the
* server. The only notification that is sent after a shutdown request
* is the exit event.
*/
export declare namespace ShutdownRequest {
const method: 'shutdown';
const messageDirection: MessageDirection;
const type: ProtocolRequestType0<void, never, void, void>;
}
/**
* The exit event is sent from the client to the server to
* ask the server to exit its process.
*/
export declare namespace ExitNotification {
const method: 'exit';
const messageDirection: MessageDirection;
const type: ProtocolNotificationType0<void>;
}
export interface DidChangeConfigurationClientCapabilities {
/**
* Did change configuration notification supports dynamic registration.
*/
dynamicRegistration?: boolean;
}
/**
* The configuration change notification is sent from the client to the server
* when the client's configuration has changed. The notification contains
* the changed configuration as defined by the language client.
*/
export declare namespace DidChangeConfigurationNotification {
const method: 'workspace/didChangeConfiguration';
const messageDirection: MessageDirection;
const type: ProtocolNotificationType<DidChangeConfigurationParams, DidChangeConfigurationRegistrationOptions>;
}
export interface DidChangeConfigurationRegistrationOptions {
section?: string | string[];
}
/**
* The parameters of a change configuration notification.
*/
export interface DidChangeConfigurationParams {
/**
* The actual changed settings
*/
settings: LSPAny;
}
/**
* The message type
*/
export declare namespace MessageType {
/**
* An error message.
*/
const Error = 1;
/**
* A warning message.
*/
const Warning = 2;
/**
* An information message.
*/
const Info = 3;
/**
* A log message.
*/
const Log = 4;
/**
* A debug message.
*
* @since 3.18.0
*/
const Debug = 5;
}
export type MessageType = 1 | 2 | 3 | 4 | 5;
/**
* The parameters of a notification message.
*/
export interface ShowMessageParams {
/**
* The message type. See {@link MessageType}
*/
type: MessageType;
/**
* The actual message.
*/
message: string;
}
/**
* The show message notification is sent from a server to a client to ask
* the client to display a particular message in the user interface.
*/
export declare namespace ShowMessageNotification {
const method: 'window/showMessage';
const messageDirection: MessageDirection;
const type: ProtocolNotificationType<ShowMessageParams, void>;
}
/**
* Show message request client capabilities
*/
export interface ShowMessageRequestClientCapabilities {
/**
* Capabilities specific to the `MessageActionItem` type.
*/
messageActionItem?: {
/**
* Whether the client supports additional attributes which
* are preserved and send back to the server in the
* request's response.
*/
additionalPropertiesSupport?: boolean;
};
}
export interface MessageActionItem {
/**
* A short title like 'Retry', 'Open Log' etc.
*/
title: string;
/**
* Additional attributes that the client preserves and
* sends back to the server. This depends on the client
* capability window.messageActionItem.additionalPropertiesSupport
*/
[key: string]: string | boolean | integer | object;
}
export interface ShowMessageRequestParams {
/**
* The message type. See {@link MessageType}
*/
type: MessageType;
/**
* The actual message.
*/
message: string;
/**
* The message action items to present.
*/
actions?: MessageActionItem[];
}
/**
* The show message request is sent from the server to the client to show a message
* and a set of options actions to the user.
*/
export declare namespace ShowMessageRequest {
const method: 'window/showMessageRequest';
const messageDirection: MessageDirection;
const type: ProtocolRequestType<ShowMessageRequestParams, MessageActionItem | null, never, void, void>;
}
/**
* The log message notification is sent from the server to the client to ask
* the client to log a particular message.
*/
export declare namespace LogMessageNotification {
const method: 'window/logMessage';
const messageDirection: MessageDirection;
const type: ProtocolNotificationType<LogMessageParams, void>;
}
/**
* The log message parameters.
*/
export interface LogMessageParams {
/**
* The message type. See {@link MessageType}
*/
type: MessageType;
/**
* The actual message.
*/
message: string;
}
/**
* The telemetry event notification is sent from the server to the client to ask
* the client to log telemetry data.
*/
export declare namespace TelemetryEventNotification {
const method: 'telemetry/event';
const messageDirection: MessageDirection;
const type: ProtocolNotificationType<any, void>;
}
export interface TextDocumentSyncClientCapabilities {
/**
* Whether text document synchronization supports dynamic registration.
*/
dynamicRegistration?: boolean;
/**
* The client supports sending will save notifications.
*/
willSave?: boolean;
/**
* The client supports sending a will save request and
* waits for a response providing text edits which will
* be applied to the document before it is saved.
*/
willSaveWaitUntil?: boolean;
/**
* The client supports did save notifications.
*/
didSave?: boolean;
}
/**
* Defines how the host (editor) should sync
* document changes to the language server.
*/
export declare namespace TextDocumentSyncKind {
/**
* Documents should not be synced at all.
*/
const None = 0;
/**
* Documents are synced by always sending the full content
* of the document.
*/
const Full = 1;
/**
* Documents are synced by sending the full content on open.
* After that only incremental updates to the document are
* send.
*/
const Incremental = 2;
}
export type TextDocumentSyncKind = 0 | 1 | 2;
export interface TextDocumentSyncOptions {
/**
* Open and close notifications are sent to the server. If omitted open close notification should not
* be sent.
*/
openClose?: boolean;
/**
* Change notifications are sent to the server. See TextDocumentSyncKind.None, TextDocumentSyncKind.Full
* and TextDocumentSyncKind.Incremental. If omitted it defaults to TextDocumentSyncKind.None.
*/
change?: TextDocumentSyncKind;
/**
* If present will save notifications are sent to the server. If omitted the notification should not be
* sent.
*/
willSave?: boolean;
/**
* If present will save wait until requests are sent to the server. If omitted the request should not be
* sent.
*/
willSaveWaitUntil?: boolean;
/**
* If present save notifications are sent to the server. If omitted the notification should not be
* sent.
*/
save?: boolean | SaveOptions;
}
/**
* The parameters sent in an open text document notification
*/
export interface DidOpenTextDocumentParams {
/**
* The document that was opened.
*/
textDocument: TextDocumentItem;
}
/**
* The document open notification is sent from the client to the server to signal
* newly opened text documents. The document's truth is now managed by the client
* and the server must not try to read the document's truth using the document's
* uri. Open in this sense means it is managed by the client. It doesn't necessarily
* mean that its content is presented in an editor. An open notification must not
* be sent more than once without a corresponding close notification send before.
* This means open and close notification must be balanced and the max open count
* is one.
*/
export declare namespace DidOpenTextDocumentNotification {
const method: 'textDocument/didOpen';
const messageDirection: MessageDirection;
const type: ProtocolNotificationType<DidOpenTextDocumentParams, TextDocumentRegistrationOptions>;
}
/**
* An event describing a change to a text document. If only a text is provided
* it is considered to be the full content of the