f962a32be3 | ||
---|---|---|
.github | ||
.vscode | ||
build | ||
client | ||
client-tests | ||
jsonrpc | ||
protocol | ||
server | ||
testbed | ||
textDocument | ||
types | ||
.eslintrc.base.json | ||
.gitattributes | ||
.gitignore | ||
.travis.yml | ||
License.txt | ||
README.md | ||
package-lock.json | ||
package.json | ||
tsconfig.base.json |
README.md
VSCode Language Server - Node
This repository contains the code for the following npm modules:
- vscode-languageclient: npm module to talk to a VSCode language server from a VSCode extension:
- vscode-languageserver: npm module to implement a VSCode language server using Node.js as a runtime:
- vscode-languageserver-protocol: the actual language server protocol definition in TypeScript:
- vscode-languageserver-types: data types used by the language server client and server:
- vscode-jsonrpc: the underlying message protocol to communicate between a client and a server:
All four npm modules are built using one travis build. Its status is:
Click here for a detailed document on how to use these npm modules to implement language servers for VSCode.
Contributing
After cloning the repository, run npm install
to install dependencies and npm run symlink
to point packages in this repository to each other.
History
3.15.3 Protocol, 6.1.x client and 6.1.x server
- Small changes to the proposed support for semantic tokens.
3.15.2 Protocol, 6.1.x client and 6.1.x server
- Proposed support for semantic tokens.
3.15.0 Protocol, 6.0.0 Client & 6.0.0 Server
- Progress support for work done and partial result progress.
- Proposed implementation for call hierarchies.
SelectionRangeRequest
protocol added:- New APIs in Types:
SelectionRange
- New APIs in Protocol:
SelectionRangeRequest
,SelectionRangeParams
,SelectionRangeClientCapabilities
,SelectionRangeServerCapabilities
,SelectionRangeProviderOptions
,
- New APIs in Types:
- Support for custom text document implementations:
- new npm package
vscode-languageserver-textdocument
which ships a standard text document implementation with basic incremental update. Server now need to prereq this npm package. - deprecated text document implementation in types.
- this resulted in a small breakage on the server side. Instead of doing
new TextDocuments
you now have to pass in a text document configuration to provide callbacks to create and uppdate a text document. Here are examples in TypeScript and JavaScript
- new npm package
import { 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);
5.1.1 Client
5.1.0 Client & 5.1.0 Server
- Adopt protocol version 3.13.0
3.13.0 Protocol
FoldingRangeRequestParam
renamed to 'FoldingRangeParams' (FoldingRangeRequestParam
still provided for backward compatibility)- Added support for create, rename and delete file operations in workspace edits.
5.0.0 Client & 5.0.0 Server
- Make the client work with Electron 2.x. which is used since VS Code 1.26.x
- Check that the expected client version specified in
engines.vscode
in thepackage.json
file matches the VS Code version the client is running on.
4.4.0 Client & 4.4.0 Server & 3.10.0 Protocol
- Implement hierarchical document outline
Color
,ColorInformation
,ColorPresentation
moved to TypesFoldingRangeRequest
protocol added:- New APIs in Types:
FoldingRange
,FoldingRangeKind
- New APIs in Protocol:
FoldingRangeRequest
,FoldingRangeRequestParam
,FoldingRangeClientCapabilities
,FoldingRangeServerCapabilities
,FoldingRangeProviderOptions
,
- New APIs in Types:
4.3.0 Client & 4.3.0 Server & 3.9.0 Protocol
- Add support for
preselect
property onCompletionItem
4.2.0 Client & 4.2.0 Server & 3.8.0 Protocol
- Add CodeAction class
- Add support for code action literal as a return value of the textDocument/codeAction request
4.1.4 Client & 4.1.3 Server
4.1.1 Client
4.1.0 Client & Server
-
Add support for related information in diagnostics.
4.0.1 Client
- removed unnecessary console log statement.
4.0.0 Server and Client
- implemented the latest protocol additions. Noteworthy are completion context, extensible completion item and symbol kind as well as markdown support for completion item and signature help. Moved to 4.0.0 version since the introduction of the completion context required a breaking change in the client middleware. The old signature:
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>;
- Noteworthy fixes:
6.0.0 Server and Client
- Move to Protocol 3.15.0
- move JS target to ES2017
3.15.0 Types and Protocol
- Implement LSP 3.15.0
3.6.1 Types
- ESM added as output format (for Webpack and other ESM consumers)
3.5.0 Server and Client
- allow the client to start the server in detached mode. If the server is running detached the client will not monitor the server process and kill it on shutdown.
- bug fixing.
3.4.0 Server and Client
- a new npm module
vscode-languageserver-protocol
has been added which contains the protocol definitions in TypeScript. This module is now shared between the client and the server. - support for proposed protocol has been added to the
protocol
,client
andserver
npm modules. Proposed protocol is subject to change even if it ships in a stable version of the npm modules. - proposed protocol has been added for the following features:
- configuration: support to fetch configuration settings by sending a request from the server to the client
- workspaceFolders: support to handle more than one root folder per workspace
- colorProvider: support to compute color ranges for a document
3.3.0 Server and Client
- splitted the client into a base client and a main client to support reusing the client implementation in other environments.
- made the request processing more async. So instead of processing a request immediatelly when the code gets notified by a Node.js callback the request is now put into a queue and processed from the queue. This allows for better dropping or folding of events if necessary.
- bugs fixes see April and May
3.2.1 Server and Client
3.2.0 Server and Client
- made
WorkspaceEdit
conform to the 3.x version of the spec and backwards compatible with 2.x version of the library. - added
RequestCancelled
error code. - Fixed nodePath not working (vscode-tslint)
- Fixed update from 3.0.4/3.0.5 to 3.1.0 breaks my extension
3.1.0 Server and Client
- add support for named pipes and socket file transport
- fixed dead lock problem with node-ipc.
3.0.5 Server and 3.0.4 Client
- deprecated
Files.uriToFilePath
in favour of the vscode-uri npm module which provides a more complete implementation of URI for VS Code. - made
rootPath
optional since it is deprecated in 3.x.
3.0.3: Client, Server and JSON-RPC
New Features
- Moved all libraries to TypeScript 2.x.x
- Client and Server are compiled to ES6. JSON-RPC is still compiled to ES5.
- JSON-RPC supports n parameter request and notification invocation.
- Support for the 3.0 version of the Language Server protocol. Some highlights are:
- Support for feature flags.
- Support for dynamic registration. In the 2.x version of the library a server announced its capabilities statically. In 3.x the server
can now dynamically register and unregister capability handlers using the new requests
client/registerCapability
andclient/unregisterCapability
. - Support to delegate command execution via a new request
workspace/executeCommand
to the server.
- Support for snippets in completion items:
- New type
InsertTextFormat
- CompletionItem.insertTextFormat controls whether the inserted test is interpreted as a plain text or a snippet.
- New type
Breaking changes:
- to ensure ordered delivery of notifications and requests the language client now throws if sendRequest, onRequest, sendNotification or onNotification is called before the client is ready. Use the onReady() Promise to wait until the client is ready.
let client = new LanguageClient(...);
client.onReady().then(() => {
client.onNotification(...);
client.sendRequest(...);
);
- removed the deprecated module functions on code2Protocol and protocol2Code converters. Use the corresponding properties on the LanguageClient instance instead to get access to the same converters used by the LanguageClient.
// Old
import { Protocol2Code, ... } from 'vscode-languageclient';
Protocol2Code.asTextEdits(edits);
// New
let client = new LanguageClient(...);
client.protocol2CodeConverter.asTextEdits(edits);
- due to the use of TypeScript 2.x.x and differences in d.ts generation users of the new version need to move to TypeScript 2.x.x as well. Usually the
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
andactiveParameter
where incorrectly declared as optional inSignatureHelp
. They are now mandatory.- the
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. - Request and Notification types are now classes instead of interfaces. In addition they now take an additional type argument to type the registration options for dynamic registration. Adopting to that change is quite easy. Simply new the
RequestType
orNotificationType
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');
}
2.6.0: Client and server
- Support for Document Link Providers
- Support for additional text edits and commands in completion items.
2.5.0: Client and Server
- Better error handling on client side.
- Events for starting and stopping the server.
- Initialization options can be provided as a function.
- Support for stdio / stderr encoding.
- Support to convert URIs betweeen the client and the server.
- Server connection.console logging now appears in the corresponding output channel instead of in the developer console.
- If a non stdio communication channel is used between client and server the server's stdio is redirected to the output channel.
- A client can now have an id and a name.
2.4.0 Client and Server
- Data types such as Range, Position, TextDocument, Hover, CompletionItem... extracted to new node module vscode-languageserver-types. The new node module is shared between the server and client and can also be used by language service libraries that want to use the same data types.
2.3.0: Client only
- the client now restarts the server if the server crashes without a prior exit notification sent. The strategy used to restart the server is pluggable (see
LanguageClientOptions.errorHandler
). The default strategy restart the server unless it crashed 5 times or more in the last 3 minutes.
2.0: A detailed desciption of the 2.0 version can be found here. A summary of the changes:
- support for request cancellation. Cancellation is automatically hooked to VSCode's cancellation tokens
- document save notification.
- Synced text documents carry VSCode's text document version number
1.1.x: Provides all language service feature available in the extension host via the language client / server protocol. Features added:
- Code Actions: provide actions to fix diagnostic problems.
- Code Lens: provide commands that are shown along with source text.
- Formatting: whole document, document ranges and formatting on type.
- Rename refactoring: provides renaming symbols.
1.0.x: Version which provides support for the following features:
- Transports: stdio and node IPC can be used as a transport.
- Document synchronization: incremental and full text document synchronization.
- Configuration synchronization: synchronization of configuration settings to the server.
- File events: synchronization of file events to the server.
- Code Complete: provides code complete lists.
- Document Highlights: highlights all 'equal' symbols in a text document.
- Hover: provides hover information for a symbol selected in a text document.
- Signature Help: provides signature help for a symbol selected in a text document.
- Goto Definition: provides goto definition support for a symbol selected in a text document.
- Find References: finds all project-wide references for a symbol selected in a text document.
- List Document Symbols: lists all symbols defined in a text document.
- List Workspace Symbols: lists all project-wide symbols.