Gathering detailed insights and metrics for vscode-jsonrpc
Gathering detailed insights and metrics for vscode-jsonrpc
Gathering detailed insights and metrics for vscode-jsonrpc
Gathering detailed insights and metrics for vscode-jsonrpc
Language server protocol implementation for VSCode. This allows implementing language services in JS/TS running on node.js
npm install vscode-jsonrpc
release/client/10.0.0-next.13
Published on 19 Aug 2024
release/server/10.0.0-next.11
Published on 19 Aug 2024
release/protocol/3.17.6-next.11
Published on 19 Aug 2024
release/jsonrpc/9.0.0-next.6
Published on 19 Aug 2024
release/client/10.0.0-next.12
Published on 12 Aug 2024
release/server/10.0.0-next.10
Published on 12 Aug 2024
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
1,482 Stars
2,303 Commits
325 Forks
87 Watching
117 Branches
186 Contributors
Updated on 27 Nov 2024
Minified
Minified + Gzipped
TypeScript (97.15%)
JavaScript (2.01%)
Batchfile (0.32%)
HTML (0.27%)
Jupyter Notebook (0.16%)
Shell (0.09%)
Cumulative downloads
Total Downloads
Last day
-0.9%
607,762
Compared to previous day
Last week
2.7%
3,293,520
Compared to previous week
Last month
12%
13,770,798
Compared to previous month
Last year
54.6%
120,914,123
Compared to previous year
2
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.
5.5.x
.20.9.0
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.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.1client.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 this1const client: LanguageClient = ...; 2client.start(); 3await client.onReady();
should become:
1const client: LanguageClient = ...; 2await 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:
SelectionRange
SelectionRangeRequest
, 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 JavaScript1import { TextDocuments } from 'vscode-languageserver'; 2import { TextDocument } from 'vscode-languageserver-textdocument'; 3const documents = new TextDocuments(TextDocument);
1const server = require("vscode-languageserver"); 2const textDocument = require("vscode-languageserver-textdocument"); 3const 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
, FoldingRangeKind
FoldingRangeRequest
, FoldingRangeRequestParam
, FoldingRangeClientCapabilities
, FoldingRangeServerCapabilities
, FoldingRangeProviderOptions
,preselect
property on CompletionItem
Add support for related information in diagnostics.
1provideCompletionItem?: (this: void, document: TextDocument, position: VPosition, token: CancellationToken, next: ProvideCompletionItemsSignature) => ProviderResult<VCompletionItem[] | VCompletionList>;
contains now an additional argument context
:
1provideCompletionItem?: (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.InsertTextFormat
1let client = new LanguageClient(...); 2client.onReady().then(() => { 3 client.onNotification(...); 4 client.sendRequest(...); 5);
1// Old
2import { Protocol2Code, ... } from 'vscode-languageclient';
3Protocol2Code.asTextEdits(edits);
4// New
5let client = new LanguageClient(...);
6client.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:1// Old 2export namespace MyRequest { 3 export const type: RequestType<MyParams, MyResult, void> = { get method() { return 'myRequest'; } }; 4} 5export namespace MyNotification { 6 export const type: NotificationType<MyParams> = { get method() { return 'myNotification'; } }; 7} 8// New 9export namespace MyRequest { 10 export const type = new RequestType<MyParams, MyResult, void, void>('myRequest'); 11} 12export namespace MyNotification { 13 export const type = new NotificationType<MyParams, void>('myNotification'); 14}
LanguageClientOptions.errorHandler
). The default strategy restart the server unless it crashed 5 times or more in the last 3 minutes.No vulnerabilities found.
Reason
security policy file detected
Details
Reason
14 commit(s) and 19 issue activity found in the last 90 days -- score normalized to 10
Reason
all changesets reviewed
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
3 existing vulnerabilities detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More