Language server protocol implementation for VSCode. This allows implementing language services in JS/TS running on node.js
1,787
stars
2,416
commits
TypeScript
primary language
Sep 3, 2026
updated
This repository contains the code for the following npm modules:
All npm modules are built using one Azure Pipeline. Its status is:
Click here for a detailed document on how to use these npm modules to implement language servers for VSCode.
After cloning the repository, run npm install to install dependencies and npm run symlink to point packages in this repository to each other.
textDocument/inlineCompletion: inline completion request, params, registration options, and client capabilities. New file protocol.inlineCompletion.ts.workspace/textDocumentContent + workspace/textDocumentContent/refresh: server-provided dynamic text document content for custom schemes (multi-scheme registration supported).textDocument/rangesFormatting: format multiple ranges in one request (DocumentRangesFormattingRequest, DocumentRangesFormattingParams).workspace/foldingRange/refresh: server‑initiated folding-range refresh (FoldingRangeRefreshRequest, FoldingRangeWorkspaceClientCapabilities).workspace/applyEdit, textDocument/rename, code actionsWorkspaceEdit may now carry SnippetTextEdit entries (snippet support in workspace edits). New client capability workspace.workspaceEdit.snippetEditSupport. See main.ts.WorkspaceEditMetadata added; ApplyWorkspaceEditParams.metadata carries it, with new client capability workspace.workspaceEdit.metadataSupport. Currently includes isRefactoring. See protocol.ts.Command.tooltip proposed on the existing Command type. main.ts.textDocument/completion / completionItem/resolveCompletionList.itemDefaults extended with data (per‑item default data payload).CompletionList.applyKind (CompletionItemApplyKinds) describes per-field merge strategy (Replace/Merge) for commitCharacters and data between list defaults and individual items. Gated by new client capability completionList.applyKindSupport. See main.ts.EditRangeWithInsertReplace made a named type and exposed via CompletionItemDefaults.editRange.CompletionItem.textEdit may carry an InsertReplaceEdit (already in 3.17; capabilities cleaned up).textDocument/codeAction / codeAction/resolveCodeAction.tags field; CodeActionTag.LLMGenerated lets servers mark LLM‑generated actions. Client capability textDocument.codeAction.tagSupport. - CodeActionOptions.documentation: CodeActionKindDocumentation[] — providers can ship docs that appear in the actions menu. Client capability textDocument.codeAction.documentationSupport.CodeActionKind.RefactorMove.CodeActionKind.Notebook (and notebook code‑action‑kind support in the client).textDocument/rename / textDocument/prepareRenamePrepareRenameResult reified as named types: PrepareRenamePlaceholder and PrepareRenameDefaultBehavior (server can return { defaultBehavior: true } to ask the client to fall back to its default rename behavior).textDocument/rangeFormattingDocumentRangeFormattingClientCapabilities.rangesSupport and matching DocumentRangeFormattingOptions.rangesSupport: a single capability flag that gates support for the new textDocument/rangesFormatting (multi‑range) request alongside the existing single‑range one.textDocument/publishDiagnostics + pull (textDocument/diagnostic, workspace/diagnostic)Diagnostic.message may now be a MarkupContent (proposed). Client capability textDocument.diagnostic.markupMessageSupport.textDocument/foldingRangeFoldingRangeClientCapabilities extended with named ClientFoldingRangeKindOptions and ClientFoldingRangeOptions (the latter exposes collapsedText).FoldingRangeWorkspaceClientCapabilities (refreshSupport) — pairs with the new workspace/foldingRange/refresh request.textDocument/semanticTokens/*SemanticTokenTypes.label added.SemanticTokenTypes / SemanticTokenModifiers redefined as an open set (servers may report values outside the predefined list; clients must tolerate them).textDocument/codeLens / codeLens/resolveCodeLensClientCapabilities.resolveSupport: ClientCodeLensResolveOptions — lets a client advertise which properties it can resolve lazily.MessageType.Debug (5) added — used by window/logMessage (and accepted everywhere MessageType appears).DocumentSelectorpattern is now a GlobPattern, so registrations can use RelativePattern. Gated by TextDocumentFilterClientCapabilities.relativePatternSupport.RegularExpressionEngineKind introduced as an open kind type for RegularExpressionsClientCapabilities.engine.MarkupContentMarkdownClientCapabilities.supportThemeIcons ($(name) icon syntax in markdown).Command lists for isTrusted (sanitizeIsTrusted helper / { enabledCommands } form) — applies wherever servers return markdown (hover, signature help, completion docs, etc.).initializeClientInfo and ServerInfo reified as named types (returned via InitializeResult.serverInfo / sent in InitializeParams.clientInfo).StaleRequestSupportOptions and WorkspaceOptions for the corresponding sections of ServerCapabilities.messageDirection constant exposed on every existing message.notebookDocument/didOpen / didChange / didSave / didCloseNotebookDocumentFilterWithNotebook, NotebookDocumentFilterWithCells, NotebookCellLanguage, NotebookDocumentCellChangeStructure, NotebookDocumentCellContentChanges, NotebookDocumentCellChanges. These do not change the wire format but give the cell-change event a typed shape.textDocument/diagnostic and workspace/diagnostic may be issued for notebook cells).textDocument/colorPresentationtextDocument.colorProvider), making client/server capability detection consistent with the other requests.SnippetTextEdit, WorkspaceEditMetadata, ChangeAnnotationsSupportOptions.PrepareRenameResult extended with PrepareRenamePlaceholder and PrepareRenameDefaultBehavior; RenameParams now references TextDocumentPositionParams.CodeActionTag (with proposed LLMGenerated) and CodeActionTagOptions.CodeActionKindDocumentation, CodeActionKind.RefactorMove (proposed), CodeActionDisabled.ClientCodeActionKindOptions, ClientCodeActionLiteralOptions, ClientCodeActionResolveOptions.CompletionItemDefaults (incl. data), CompletionItemApplyKinds, ApplyKind (Replace | Merge) — controls how list defaults merge with per‑item commitCharacters/data.EditRangeWithInsertReplace, CompletionItemTagOptions, CompletionListCapabilities, CompletionClientCapabilities, ClientCompletionItemResolveOptions, ClientCompletionItemInsertTextModeOptions, ClientCompletionItemOptions, ClientCompletionItemOptionsKind, ServerCompletionItemOptions.ClientSignatureParameterInformationOptions, ClientSignatureInformationOptions.ClientSymbolKindOptions, ClientSymbolTagOptions, ClientSymbolResolveOptions, ClientCodeLensResolveOptions, LocationUriOnly.SemanticTokenTypes.label; ClientSemanticTokensRequestFullDelta, ClientSemanticTokensRequestOptions, SemanticTokensFullDelta; open-set semantics for SemanticTokenTypes/SemanticTokenModifiers.MessageType.Debug; MarkdownString.supportThemeIcons; trusted markdown command lists; ClientShowMessageActionItemOptions.DiagnosticsCapabilities, ClientDiagnosticsTagOptions, refined PublishDiagnosticsClientCapabilities, DiagnosticClientCapabilities.TextDocumentFilterLanguage / …Scheme / …Pattern (and the matching NotebookDocumentFilter* variants).GlobPattern namespace + relative-pattern support; TextDocumentFilterClientCapabilities.NotebookDocumentFilterWithCells, NotebookDocumentFilterWithNotebook, NotebookCellLanguage, finer-grained notebook change types.InlineCompletionItem, InlineCompletionList, InlineCompletionTriggerKind, InlineCompletionContext, SelectedCompletionInfo, StringValue.ServerInfo, ClientInfo, MessageType literal, RegularExpressionEngineKind (namespaced kind type), StaleRequestSupportOptions, WorkspaceOptions, LanguageKind (open set; D, Pascal, Haskell added).TextDocumentContentChangePartial, TextDocumentContentChangeWholeDocument.6.0.x.22.13.14 and es2022. See also TypeScript's node target mapping.vscode-jsonrpc, vscode-languageserver-protocol, vscode-languageclient and vscode-languageserver now use the exports property instead of having a main and typings property. This might need adoption in tsconfig.json files around the module and moduleResolution. The LSP libraries currently use node16 for both values.
vscode-languageserver-types ships separate UMD/ESM publishes; module export condition added so bundlers pick up the ESM build.null from the textDocument/documentColor and textDocument/colorPresentation request to make it consistent with the specification. This is a breaking change.CancellationToken to the show document middleware to make it consistent with the other middleware. This is a breaking change since it added a required parameter.LogOutputChannel for the client's output and trace channel instead of the standard VSCode OutputChannel type. This is a breaking change for clients that pass in their own log or trace channel via the LanguageClientOptions. Instead of using a normal OutputChannel you now need to pass in a LogOutputChannel.jsonrpc is not implementing Map anymore.client.getFeature(lsclient.FoldingRangeRequest.method).getProvider(document)?.provider;
Library specific changes are:
start and stop methods. Both methods now return a promise since these methods are async. This is a breaking change since start returned a disposable before. Extensions should now implement a deactivate function in their extension main file and correctly return the stop promise from the deactivate call. As a consequence the onReady() got removed since extensions can await the start() call now. Old code like thisconst client: LanguageClient = ...;
client.start();
await client.onReady();
should become:
const client: LanguageClient = ...;
await client.start();
sendNotification methods now return a promise. Returning a promise was necessary since the actual writing of the message to the underlying transport is async and a client for example could not determine if a notification was handed off to the transport. This is a breaking change in the sense that it might result in floating promise and might be flagged by a linter.handleFailedRequest has change. Instead of returning a default value when a exception is received from the server the method now rethrows the error. This ensures that VS Code's default behavior on errors is used. The method also handles the RequestCancelled and ServerCancelled in the following way:
ServerCancelled and the client didn't cancel the request as well throw CancellationError to ask the client to rerun the request.RequestCancelled then normally the client should have cancelled the request and the code will return the default value (according to the best interpretation of the 3.16 spec). If the client has not canceled interpret the RequestCancelled as ServerCancelled.null). This is a breaking change since in former releases of the library the middleware would see the result also not used by VS Code. The change was made to save CPU and memory by not converting unused response results.For a detailed list of changes made in the 3.16.0 version of the protocol see the change log of the 3.16 specification.
Library specific changes are:
messages property to registrationType and return a corresponding RegistrationType. Additional remove the first parameter from the register method.ErrorCodes. LSP specific error codes got moved to a new namespace LSPErrorCodes. The namespace ErrorCodes in jsonrpc is not correctly reserved for JSON RPC specific error codes. This is a breaking change. To resolve it use LSPErrorCodes instead.vscode-jsonrpc for an example: (a) the import vscode-jsonrpc will only import the common code, (b) the import vscode-jsonrpc\node will import the common and the node code and (c) the import vscode-jsonrpc\browser will import the common and browser code.vscode-jsonrpc. The parameter structure can be controlled using the additional parameterStructures argument when creating a request or notification type or when sending an untyped request or notification using the sendRequest or sendNotification function. The default is ParameterStructures.auto which does the following:
byPosition for messages with zero or greater than one parameterbyName for parameters which are object literals. Uses byPosition for all other parameters.SelectionRangeRequest protocol added:
SelectionRangeSelectionRangeRequest, SelectionRangeParams, SelectionRangeClientCapabilities, SelectionRangeServerCapabilities, SelectionRangeProviderOptions,vscode-languageserver-textdocument which ships a standard text document implementation with basic incremental update. Server now need to pre-requisite this npm package.new TextDocuments you now have to pass in a text document configuration to provide callbacks to create and update a text document. Here are examples in TypeScript and JavaScriptimport { TextDocuments } from 'vscode-languageserver';
import { TextDocument } from 'vscode-languageserver-textdocument';
const documents = new TextDocuments(TextDocument);
const server = require("vscode-languageserver");
const textDocument = require("vscode-languageserver-textdocument");
const documents = new server.TextDocuments(textDocument.TextDocument);
FoldingRangeRequestParam renamed to 'FoldingRangeParams' (FoldingRangeRequestParam still provided for backward compatibility)engines.vscode in the package.json file matches the VS Code version the client is running on.Color, ColorInformation, ColorPresentation moved to TypesFoldingRangeRequest protocol added:
FoldingRange, FoldingRangeKindFoldingRangeRequest, FoldingRangeRequestParam, FoldingRangeClientCapabilities, FoldingRangeServerCapabilities, FoldingRangeProviderOptions,preselect property on CompletionItemAdd support for related information in diagnostics.
provideCompletionItem?: (this: void, document: TextDocument, position: VPosition, token: CancellationToken, next: ProvideCompletionItemsSignature) => ProviderResult<VCompletionItem[] | VCompletionList>;
contains now an additional argument context:
provideCompletionItem?: (this: void, document: TextDocument, position: VPosition, context: VCompletionContext, token: CancellationToken, next: ProvideCompletionItemsSignature) => ProviderResult<VCompletionItem[] | VCompletionList>;
vscode-languageserver-protocol has been added which contains the protocol definitions in TypeScript. This module is now shared between the client and the server.protocol, client and server npm modules. Proposed protocol is subject to change even if it ships in a stable version of the npm modules.WorkspaceEdit conform to the 3.x version of the spec and backwards compatible with 2.x version of the library.RequestCancelled error code.Files.uriToFilePath in favour of the vscode-uri npm module which provides a more complete implementation of URI for VS Code.rootPath optional since it is deprecated in 3.x.client/registerCapability and client/unregisterCapability.workspace/executeCommand to the server.InsertTextFormatlet client = new LanguageClient(...);
client.onReady().then(() => {
client.onNotification(...);
client.sendRequest(...);
);
// Old
import { Protocol2Code, ... } from 'vscode-languageclient';
Protocol2Code.asTextEdits(edits);
// New
let client = new LanguageClient(...);
client.protocol2CodeConverter.asTextEdits(edits);
LanguageClient is used in a VS Code extension. You can find detailed steps on how to upgrade a VS Code extension to TypeScript 2.x.x here.activeSignature and activeParameter where incorrectly declared as optional in SignatureHelp. They are now mandatory.protocol.ts file used enum types in 2.x. However the protocol itself is number based since no assumption can be made about the presence of an enum type in the implementing language. To make this more clear the enum got replace by number types with a or literal type definition. This might result in compile errors if a number was directly assigned to a previous enum type without a proper range check.RequestType or NotificationType and add void as the registration option type. Please remember to update this on both the client and server side:// Old
export namespace MyRequest {
export const type: RequestType<MyParams, MyResult, void> = { get method() { return 'myRequest'; } };
}
export namespace MyNotification {
export const type: NotificationType<MyParams> = { get method() { return 'myNotification'; } };
}
// New
export namespace MyRequest {
export const type = new RequestType<MyParams, MyResult, void, void>('myRequest');
}
export namespace MyNotification {
export const type = new NotificationType<MyParams, void>('myNotification');
}
LanguageClientOptions.errorHandler). The default strategy restart the server unless it crashed 5 times or more in the last 3 minutes.(top 30 of 121)
TypeScript
96.9%
JavaScript
2.3%
Language server protocol implementation for VSCode. This allows implementing language services in JS/TS running on node.js
1,787
stars
2,416
commits
TypeScript
primary language
Sep 3, 2026
updated
This repository contains the code for the following npm modules:
All npm modules are built using one Azure Pipeline. Its status is:
Click here for a detailed document on how to use these npm modules to implement language servers for VSCode.
After cloning the repository, run npm install to install dependencies and npm run symlink to point packages in this repository to each other.
textDocument/inlineCompletion: inline completion request, params, registration options, and client capabilities. New file protocol.inlineCompletion.ts.workspace/textDocumentContent + workspace/textDocumentContent/refresh: server-provided dynamic text document content for custom schemes (multi-scheme registration supported).textDocument/rangesFormatting: format multiple ranges in one request (DocumentRangesFormattingRequest, DocumentRangesFormattingParams).workspace/foldingRange/refresh: server‑initiated folding-range refresh (FoldingRangeRefreshRequest, FoldingRangeWorkspaceClientCapabilities).workspace/applyEdit, textDocument/rename, code actionsWorkspaceEdit may now carry SnippetTextEdit entries (snippet support in workspace edits). New client capability workspace.workspaceEdit.snippetEditSupport. See main.ts.WorkspaceEditMetadata added; ApplyWorkspaceEditParams.metadata carries it, with new client capability workspace.workspaceEdit.metadataSupport. Currently includes isRefactoring. See protocol.ts.Command.tooltip proposed on the existing Command type. main.ts.textDocument/completion / completionItem/resolveCompletionList.itemDefaults extended with data (per‑item default data payload).CompletionList.applyKind (CompletionItemApplyKinds) describes per-field merge strategy (Replace/Merge) for commitCharacters and data between list defaults and individual items. Gated by new client capability completionList.applyKindSupport. See main.ts.EditRangeWithInsertReplace made a named type and exposed via CompletionItemDefaults.editRange.CompletionItem.textEdit may carry an InsertReplaceEdit (already in 3.17; capabilities cleaned up).textDocument/codeAction / codeAction/resolveCodeAction.tags field; CodeActionTag.LLMGenerated lets servers mark LLM‑generated actions. Client capability textDocument.codeAction.tagSupport. - CodeActionOptions.documentation: CodeActionKindDocumentation[] — providers can ship docs that appear in the actions menu. Client capability textDocument.codeAction.documentationSupport.CodeActionKind.RefactorMove.CodeActionKind.Notebook (and notebook code‑action‑kind support in the client).textDocument/rename / textDocument/prepareRenamePrepareRenameResult reified as named types: PrepareRenamePlaceholder and PrepareRenameDefaultBehavior (server can return { defaultBehavior: true } to ask the client to fall back to its default rename behavior).textDocument/rangeFormattingDocumentRangeFormattingClientCapabilities.rangesSupport and matching DocumentRangeFormattingOptions.rangesSupport: a single capability flag that gates support for the new textDocument/rangesFormatting (multi‑range) request alongside the existing single‑range one.textDocument/publishDiagnostics + pull (textDocument/diagnostic, workspace/diagnostic)Diagnostic.message may now be a MarkupContent (proposed). Client capability textDocument.diagnostic.markupMessageSupport.textDocument/foldingRangeFoldingRangeClientCapabilities extended with named ClientFoldingRangeKindOptions and ClientFoldingRangeOptions (the latter exposes collapsedText).FoldingRangeWorkspaceClientCapabilities (refreshSupport) — pairs with the new workspace/foldingRange/refresh request.textDocument/semanticTokens/*SemanticTokenTypes.label added.SemanticTokenTypes / SemanticTokenModifiers redefined as an open set (servers may report values outside the predefined list; clients must tolerate them).textDocument/codeLens / codeLens/resolveCodeLensClientCapabilities.resolveSupport: ClientCodeLensResolveOptions — lets a client advertise which properties it can resolve lazily.MessageType.Debug (5) added — used by window/logMessage (and accepted everywhere MessageType appears).DocumentSelectorpattern is now a GlobPattern, so registrations can use RelativePattern. Gated by TextDocumentFilterClientCapabilities.relativePatternSupport.RegularExpressionEngineKind introduced as an open kind type for RegularExpressionsClientCapabilities.engine.MarkupContentMarkdownClientCapabilities.supportThemeIcons ($(name) icon syntax in markdown).Command lists for isTrusted (sanitizeIsTrusted helper / { enabledCommands } form) — applies wherever servers return markdown (hover, signature help, completion docs, etc.).initializeClientInfo and ServerInfo reified as named types (returned via InitializeResult.serverInfo / sent in InitializeParams.clientInfo).StaleRequestSupportOptions and WorkspaceOptions for the corresponding sections of ServerCapabilities.messageDirection constant exposed on every existing message.notebookDocument/didOpen / didChange / didSave / didCloseNotebookDocumentFilterWithNotebook, NotebookDocumentFilterWithCells, NotebookCellLanguage, NotebookDocumentCellChangeStructure, NotebookDocumentCellContentChanges, NotebookDocumentCellChanges. These do not change the wire format but give the cell-change event a typed shape.textDocument/diagnostic and workspace/diagnostic may be issued for notebook cells).textDocument/colorPresentationtextDocument.colorProvider), making client/server capability detection consistent with the other requests.SnippetTextEdit, WorkspaceEditMetadata, ChangeAnnotationsSupportOptions.PrepareRenameResult extended with PrepareRenamePlaceholder and PrepareRenameDefaultBehavior; RenameParams now references TextDocumentPositionParams.CodeActionTag (with proposed LLMGenerated) and CodeActionTagOptions.CodeActionKindDocumentation, CodeActionKind.RefactorMove (proposed), CodeActionDisabled.ClientCodeActionKindOptions, ClientCodeActionLiteralOptions, ClientCodeActionResolveOptions.CompletionItemDefaults (incl. data), CompletionItemApplyKinds, ApplyKind (Replace | Merge) — controls how list defaults merge with per‑item commitCharacters/data.EditRangeWithInsertReplace, CompletionItemTagOptions, CompletionListCapabilities, CompletionClientCapabilities, ClientCompletionItemResolveOptions, ClientCompletionItemInsertTextModeOptions, ClientCompletionItemOptions, ClientCompletionItemOptionsKind, ServerCompletionItemOptions.ClientSignatureParameterInformationOptions, ClientSignatureInformationOptions.ClientSymbolKindOptions, ClientSymbolTagOptions, ClientSymbolResolveOptions, ClientCodeLensResolveOptions, LocationUriOnly.SemanticTokenTypes.label; ClientSemanticTokensRequestFullDelta, ClientSemanticTokensRequestOptions, SemanticTokensFullDelta; open-set semantics for SemanticTokenTypes/SemanticTokenModifiers.MessageType.Debug; MarkdownString.supportThemeIcons; trusted markdown command lists; ClientShowMessageActionItemOptions.DiagnosticsCapabilities, ClientDiagnosticsTagOptions, refined PublishDiagnosticsClientCapabilities, DiagnosticClientCapabilities.TextDocumentFilterLanguage / …Scheme / …Pattern (and the matching NotebookDocumentFilter* variants).GlobPattern namespace + relative-pattern support; TextDocumentFilterClientCapabilities.NotebookDocumentFilterWithCells, NotebookDocumentFilterWithNotebook, NotebookCellLanguage, finer-grained notebook change types.InlineCompletionItem, InlineCompletionList, InlineCompletionTriggerKind, InlineCompletionContext, SelectedCompletionInfo, StringValue.ServerInfo, ClientInfo, MessageType literal, RegularExpressionEngineKind (namespaced kind type), StaleRequestSupportOptions, WorkspaceOptions, LanguageKind (open set; D, Pascal, Haskell added).TextDocumentContentChangePartial, TextDocumentContentChangeWholeDocument.6.0.x.22.13.14 and es2022. See also TypeScript's node target mapping.vscode-jsonrpc, vscode-languageserver-protocol, vscode-languageclient and vscode-languageserver now use the exports property instead of having a main and typings property. This might need adoption in tsconfig.json files around the module and moduleResolution. The LSP libraries currently use node16 for both values.
vscode-languageserver-types ships separate UMD/ESM publishes; module export condition added so bundlers pick up the ESM build.null from the textDocument/documentColor and textDocument/colorPresentation request to make it consistent with the specification. This is a breaking change.CancellationToken to the show document middleware to make it consistent with the other middleware. This is a breaking change since it added a required parameter.LogOutputChannel for the client's output and trace channel instead of the standard VSCode OutputChannel type. This is a breaking change for clients that pass in their own log or trace channel via the LanguageClientOptions. Instead of using a normal OutputChannel you now need to pass in a LogOutputChannel.jsonrpc is not implementing Map anymore.client.getFeature(lsclient.FoldingRangeRequest.method).getProvider(document)?.provider;
Library specific changes are:
start and stop methods. Both methods now return a promise since these methods are async. This is a breaking change since start returned a disposable before. Extensions should now implement a deactivate function in their extension main file and correctly return the stop promise from the deactivate call. As a consequence the onReady() got removed since extensions can await the start() call now. Old code like thisconst client: LanguageClient = ...;
client.start();
await client.onReady();
should become:
const client: LanguageClient = ...;
await client.start();
sendNotification methods now return a promise. Returning a promise was necessary since the actual writing of the message to the underlying transport is async and a client for example could not determine if a notification was handed off to the transport. This is a breaking change in the sense that it might result in floating promise and might be flagged by a linter.handleFailedRequest has change. Instead of returning a default value when a exception is received from the server the method now rethrows the error. This ensures that VS Code's default behavior on errors is used. The method also handles the RequestCancelled and ServerCancelled in the following way:
ServerCancelled and the client didn't cancel the request as well throw CancellationError to ask the client to rerun the request.RequestCancelled then normally the client should have cancelled the request and the code will return the default value (according to the best interpretation of the 3.16 spec). If the client has not canceled interpret the RequestCancelled as ServerCancelled.null). This is a breaking change since in former releases of the library the middleware would see the result also not used by VS Code. The change was made to save CPU and memory by not converting unused response results.For a detailed list of changes made in the 3.16.0 version of the protocol see the change log of the 3.16 specification.
Library specific changes are:
messages property to registrationType and return a corresponding RegistrationType. Additional remove the first parameter from the register method.ErrorCodes. LSP specific error codes got moved to a new namespace LSPErrorCodes. The namespace ErrorCodes in jsonrpc is not correctly reserved for JSON RPC specific error codes. This is a breaking change. To resolve it use LSPErrorCodes instead.vscode-jsonrpc for an example: (a) the import vscode-jsonrpc will only import the common code, (b) the import vscode-jsonrpc\node will import the common and the node code and (c) the import vscode-jsonrpc\browser will import the common and browser code.vscode-jsonrpc. The parameter structure can be controlled using the additional parameterStructures argument when creating a request or notification type or when sending an untyped request or notification using the sendRequest or sendNotification function. The default is ParameterStructures.auto which does the following:
byPosition for messages with zero or greater than one parameterbyName for parameters which are object literals. Uses byPosition for all other parameters.SelectionRangeRequest protocol added:
SelectionRangeSelectionRangeRequest, SelectionRangeParams, SelectionRangeClientCapabilities, SelectionRangeServerCapabilities, SelectionRangeProviderOptions,vscode-languageserver-textdocument which ships a standard text document implementation with basic incremental update. Server now need to pre-requisite this npm package.new TextDocuments you now have to pass in a text document configuration to provide callbacks to create and update a text document. Here are examples in TypeScript and JavaScriptimport { TextDocuments } from 'vscode-languageserver';
import { TextDocument } from 'vscode-languageserver-textdocument';
const documents = new TextDocuments(TextDocument);
const server = require("vscode-languageserver");
const textDocument = require("vscode-languageserver-textdocument");
const documents = new server.TextDocuments(textDocument.TextDocument);
FoldingRangeRequestParam renamed to 'FoldingRangeParams' (FoldingRangeRequestParam still provided for backward compatibility)engines.vscode in the package.json file matches the VS Code version the client is running on.Color, ColorInformation, ColorPresentation moved to TypesFoldingRangeRequest protocol added:
FoldingRange, FoldingRangeKindFoldingRangeRequest, FoldingRangeRequestParam, FoldingRangeClientCapabilities, FoldingRangeServerCapabilities, FoldingRangeProviderOptions,preselect property on CompletionItemAdd support for related information in diagnostics.
provideCompletionItem?: (this: void, document: TextDocument, position: VPosition, token: CancellationToken, next: ProvideCompletionItemsSignature) => ProviderResult<VCompletionItem[] | VCompletionList>;
contains now an additional argument context:
provideCompletionItem?: (this: void, document: TextDocument, position: VPosition, context: VCompletionContext, token: CancellationToken, next: ProvideCompletionItemsSignature) => ProviderResult<VCompletionItem[] | VCompletionList>;
vscode-languageserver-protocol has been added which contains the protocol definitions in TypeScript. This module is now shared between the client and the server.protocol, client and server npm modules. Proposed protocol is subject to change even if it ships in a stable version of the npm modules.WorkspaceEdit conform to the 3.x version of the spec and backwards compatible with 2.x version of the library.RequestCancelled error code.Files.uriToFilePath in favour of the vscode-uri npm module which provides a more complete implementation of URI for VS Code.rootPath optional since it is deprecated in 3.x.client/registerCapability and client/unregisterCapability.workspace/executeCommand to the server.InsertTextFormatlet client = new LanguageClient(...);
client.onReady().then(() => {
client.onNotification(...);
client.sendRequest(...);
);
// Old
import { Protocol2Code, ... } from 'vscode-languageclient';
Protocol2Code.asTextEdits(edits);
// New
let client = new LanguageClient(...);
client.protocol2CodeConverter.asTextEdits(edits);
LanguageClient is used in a VS Code extension. You can find detailed steps on how to upgrade a VS Code extension to TypeScript 2.x.x here.activeSignature and activeParameter where incorrectly declared as optional in SignatureHelp. They are now mandatory.protocol.ts file used enum types in 2.x. However the protocol itself is number based since no assumption can be made about the presence of an enum type in the implementing language. To make this more clear the enum got replace by number types with a or literal type definition. This might result in compile errors if a number was directly assigned to a previous enum type without a proper range check.RequestType or NotificationType and add void as the registration option type. Please remember to update this on both the client and server side:// Old
export namespace MyRequest {
export const type: RequestType<MyParams, MyResult, void> = { get method() { return 'myRequest'; } };
}
export namespace MyNotification {
export const type: NotificationType<MyParams> = { get method() { return 'myNotification'; } };
}
// New
export namespace MyRequest {
export const type = new RequestType<MyParams, MyResult, void, void>('myRequest');
}
export namespace MyNotification {
export const type = new NotificationType<MyParams, void>('myNotification');
}
LanguageClientOptions.errorHandler). The default strategy restart the server unless it crashed 5 times or more in the last 3 minutes.(top 30 of 121)
TypeScript
96.9%
JavaScript
2.3%