Giter VIP home page Giter VIP logo

vscode-languageserver-node's Introduction

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:
    NPM Version NPM Downloads
  • vscode-languageserver: npm module to implement a VSCode language server using Node.js as a runtime:
    NPM Version NPM Downloads
  • vscode-languageserver-textdocument: npm module to implement text documents usable in a LSP server using Node.js as a runtime:
    NPM Version NPM Downloads
  • vscode-languageserver-protocol: the actual language server protocol definition in TypeScript:
    NPM Version NPM Downloads
  • vscode-languageserver-types: data types used by the language server client and server:
    NPM Version NPM Downloads
  • vscode-jsonrpc: the underlying message protocol to communicate between a client and a server:
    NPM Version NPM Downloads

All npm modules are built using one Azure Pipeline. Its status is:

Build Status

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

Next (10.0.0-next.* Client and 10.0.0-next.* Server)

  • added proposed CodeActionKind.RefactorMove
  • snippet support in Workspace edits
  • support to control the parallelism of the dispatch requests and notification. This is a breaking change since it allows notification handlers to return a promise to control this.

3.17.5 Protocol, 9.0.1 Client and 9.0.1 Server

  • fix ESM bundling

3.17.4 Protocol, 8.2.0 JSON-RPC 9.0.0 Client and 9.0.0 Server

  • added proposed inline completion request.
  • added proposed formatting ranges request.
  • added proposed refresh request for folding ranges. This changed the shape of the folding range feature since we need to expose the event emitter. The change is breaking. To get to the provider you now need to do
    client.getFeature(lsclient.FoldingRangeRequest.method).getProvider(document)?.provider;
  • various bug fixes

3.17.4-next.0 Protocol, 8.2.0-next.0 JSON-RPC, 8.2.0-next.0 Client and 8.2.0-next.0 Server.

  • middleware support for general notifications and requests as well as for register and unregister capabilities.
  • various bug fixes.

3.17.3 Protocol, 8.1.0 JSON-RPC, 8.1.0 Client and 8.1.0 Server.

  • support for custom message handlers
  • various bug fixes. Noteworthy are fixes around request ordering problems with full document sync.

3.17.2 Protocol, 8.0.2 JSON-RPC, 8.0.2 Client and 8.0.2 Server.

  • make client more robust against unwanted restarts
  • added a LanguageClient#dispose method to fully dispose a client
  • various bug fixes.

3.17.0 Protocol, 8.0.0 JSON-RPC, 8.0.0 Client and 8.0.0 Server.

Library specific changes are:

  • cleanup of client 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 this
const client: LanguageClient = ...;
client.start();
await client.onReady();

should become:

const client: LanguageClient = ...;
await client.start();
  • notification and request handler registration can now happen before the client is started. This ensures that no messages from the server are missed.
  • if an extension sends a notification or request before the client got started the client will auto start.
  • all 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.
  • all handler registrations now return a Disposable to allow unregistration of the handler.
  • the behavior of 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:
    • if it receives ServerCancelled and the client didn't cancel the request as well throw CancellationError to ask the client to rerun the request.
    • if it receives 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.
  • the next handler of a client middleware now drops server results if the request got already canceled on the client side by returning VS Code's default value for the corresponding provider (mostly 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.
  • all converter functions which take an array are now async, yield and take a cancellation token. This is a breaking change and got introduced to avoid monopolizing the extension host during type conversions.
  • the return type of ErrorHandler#error and ErrorHandler#closed changed in a breaking manner. It now supports return an optional message which will be displayed to the user.
  • Added support for inline values.
  • Added support for inlay hints.
  • Added support for type hierarchies.
  • Added support for notebook documents.

3.16.0 Protocol, 6.0.0 JSON-RPC, 7.0.0 Client and 7.0.0 Server.

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:

  • cleanup of Request and Notification types. Removed the unnecessary generic parameter RO. This is a breaking change. To adapt simply remove the type argument.
  • added the new concept of a RegistrationType which decouple the registration method from the actual request or notification method. This is a breaking change for implementors of custom features. To adapt rename the messages property to registrationType and return a corresponding RegistrationType. Additional remove the first parameter from the register method.
  • cleanup of 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.
  • split code into common, node and browser to allow using the LSP client and server npm modules in a Web browser via webpack. This is a breaking change and might lead to compile / runtime errors if not adopted. Every module has now three different exports which represent the split into common, node and browser. Lets look at 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.
  • added support to control the parameter structure when sending requests and notifications in 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:
    • use byPosition for messages with zero or greater than one parameter
    • for one parameter it used byName for parameters which are object literals. Uses byPosition for all other parameters.

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,
  • 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 pre-requisite 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 update a text document. Here are examples in TypeScript and JavaScript
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 the package.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 Types
  • FoldingRangeRequest protocol added:
    • New APIs in Types: FoldingRange, FoldingRangeKind
    • New APIs in Protocol: FoldingRangeRequest, FoldingRangeRequestParam, FoldingRangeClientCapabilities, FoldingRangeServerCapabilities, FoldingRangeProviderOptions,

4.3.0 Client & 4.3.0 Server & 3.9.0 Protocol

  • Add support for preselect property on CompletionItem

4.2.0 Client & 4.2.0 Server & 3.8.0 Protocol

4.1.4 Client & 4.1.3 Server

4.1.1 Client

4.1.0 Client & Server

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>;

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 and server 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 immediately 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

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 un-register capability handlers using the new requests client/registerCapability and client/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.

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 and activeParameter where incorrectly declared as optional in SignatureHelp. 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 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');
}

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 between 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 plugable (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 description 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.

0.10.x: Initial versions to build a good API for the client and server side

License

MIT

vscode-languageserver-node's People

Contributors

aeschli avatar akatquas avatar alexdima avatar asiandrummer avatar c-claeys avatar dantup avatar dbaeumer avatar dependabot[bot] avatar djmcnab avatar gama11 avatar hamirmahal avatar heejaechang avatar iisresetme avatar jma353 avatar kieferrm avatar lszomoru avatar mariasolos avatar mattacosta avatar michaelpj avatar nikeee avatar octref avatar ramya-rao-a avatar razzeee avatar rcjsuen avatar rebornix avatar remcohaszing avatar smarter avatar strager avatar turbo87 avatar xanewok avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-languageserver-node's Issues

LanguageClient does not handle IntelliSense correctly for PowerShell static class methods

We're seeing an issue in the PowerShell extension where our trigger for static .NET class methods is not resulting in the right IntelliSense in VS Code. To reproduce the issue, try typing this in a PowerShell script file after installing the PowerShell extension on a Windows machine:

[DateTime]::

After the second : we would expect an IntelliSense pane to appear. Our language server sends the : character back as a triggerCharacter in our completionProvider section of the serverCapabilities object in the Initialize response. Could there be an issue with the double-colon?

Another interesting problem here is that using Ctrl+Space after the double-colon results in an empty IntelliSense list even though our server gets the request correctly and returns a list of IntelliSense results. Can you think of a reason why the results wouldn't be applied in this case?

We're tracking the issue on our side here: PowerShell/PowerShellEditorServices#163

Let me know if it's more appropriate to file this on the Microsoft/vscode repo.

Thanks!

cc @rkeithhill @dfinke

Telemetry support in protocol

Most language services will most probably be interested in the following.

  • Requests routed to the extension and the number of each request routed to it based on user action
  • Number of responses from language service that were discarded due to various reasons (user cancellation, context changes etc)
  • Ability for the language service to log Additional telemetry information like average time tp process each request, number of files it dealt with etc.

Ask

  1. In the language server client, automatically log stats about requests sent to the language server as well as stats about responses that were discarded
  2. Add a way for server send back telemetry data to client that is automatically logged
  3. Extension request telemetry and pass in their key when initializing the client

All of these can be done by each extension but having a standard mechanism will all uniformity across extensions.

Error: channel closed

Error: channel closed 
at ChildProcess.target.send (internal/child_process.js:509:16) 
at IPCMessageWriter.write (/dbaeumer.vscode-eslint-0.10.13/node_modules/vscode-languageclient/node_modules/vscode-jsonrpc/lib/messageWriter.js:34:22) 
at Object.connection.sendNotification (/dbaeumer.vscode-eslint-0.10.13/node_modules/vscode-languageclient/node_modules/vscode-jsonrpc/lib/main.js:180:27) 
at Object.result.didChangeTextDocument (/dbaeumer.vscode-eslint-0.10.13/node_modules/vscode-languageclient/lib/main.js:55:70) 
at Delayer.<anonymous> (/dbaeumer.vscode-eslint-0.10.13/node_modules/vscode-languageclient/lib/main.js:373:28) 
at /dbaeumer.vscode-eslint-0.10.13/node_modules/vscode-languageclient/lib/utils/async.js:27:36 

Help on implementing the language server in another language

I would like to write a language server for PHP. There are great PHP libraries for parsing PHP into an AST and for parsing doc blocks. I started off by implementing it as a normal VS Code extension and calling a little PHP script that returned the AST in JSON, which I would then traverse in TypeScript. But that means I have to duplicate so many classes and interfaces, duplicate code for pretty-printing and traversal that is already bundled in the original library, etc... I figured the best option would be to make it a language server, implemented in PHP. Unfortunately, I did not find any documentation of the protocol that VS Code speaks to a language server. There is only this repository with the TypeScript implementation, but that of course cannot be ported 1:1 to PHP. Could you please provide me with some info about the protocol?

Exception when close all working files and some are dirty

From @isidorn on March 15, 2016 14:20

  • VSCode Version: 18ebb4a4f5491af7b16e91e42fc36410bbb2e4d7
  • OS Version: any

Steps to Reproduce:

  1. Have multiple files open in working files
  2. Have at lease one of those files dirty
  3. Close All Working files by clicking the close action in the working files header, notice the exception
  4. I can not repro this every time, but see it regularly

screen shot 2016-03-15 at 15 19 34

edited: first exception that I now removed was caused by an unrelated issue

Copied from original issue: microsoft/vscode#4253

Uncaught exception when calling connection.console.info()

I received the following error when trying to use the info() method of the RemoteConsole object while in my completion provider. The other console methods were not affected and operated normally.

Notification handler 'window/logMessage' failed with message: EPERM: operation not permitted, write

Essentially the relevant code I was using boiled down to:

connection.onCompletion((position: TextDocumentPosition): CompletionItem[] => {
  connection.console.info('...');
});

vscode-languageserver: 1.3.1
os: windows 10

Any example of consuming the server from an external Java application?

Is there any example on how to consume the services provided by the server from a detached java application ? Concretely we're talking about an eclipse plugin sending requests and receiving responses to this server and use the information to autocomplete/color editors etc.

If not, any hint on how to connect to the server from an external application (through stdio sockets etc.) ?

Support ELECTRON_RUN_AS_NODE

Our next update of Electron will remove the deprecated ATOM_SHELL_INTERNAL_RUN_AS_NODE. To support both old and new world, I suggest to set both flags wherever you set ATOM_SHELL_INTERNAL_RUN_AS_NODE currently.

Exception when returning null on onDefinition

vscode-languageclient 2.2.1

When onDefinition can not find a symbol at the given location, I return null.
This results in the following exception in the extension-host client:

shell.ts:408Cannot read property 'uri' of null: TypeError: Cannot read property 'uri' of null
at asLocation (/home/aeschli/workspaces/vscode/extensions/css/node_modules/vscode-languageclient/lib/protocolConverter.js:148:49)
at asDefinitionResult (/home/aeschli/workspaces/vscode/extensions/css/node_modules/vscode-languageclient/lib/protocolConverter.js:143:16)

Exception when return undefined as hover content

On the language server side I return undefined as hover content.

That results the following exception on the client side:
shell.ts:408 Illegal argument: Error: Illegal argument
at new e (/usr/share/code-insiders/resources/app/out/vs/workbench/node/extensionHostProcess.js:13:16893)
at asHover (/home/aeschli/workspaces/vscode/extensions/css/node_modules/vscode-languageclient/lib/protocolConverter.js:70:12)

Clearly a user error, but should be handled on the server side, or handled gracefully

Enable the language server to request the contents of a file that is not yet opened in the client

For remote language server scenarios, it may be necessary to allow the language server to send a notification (or request?) to the client to request the contents of a file at a given URI. In this case, the client shouldn't open the file in the client UI, only send the file's contents to the language server. This will allow interpreted languages like PowerShell to provide cross-file language features when the current file references a file at another location on the client machine.

I believe this scenario will also require that the client send file watcher events for the requested file just in case the file is changed or deleted on disk.

rename not working

I code like this

connection.onInitialize((params): InitializeResult => {
    workspaceRoot = params.rootPath;
    return {
        capabilities: {
            // Tell the client that the server works in FULL text document sync mode
            textDocumentSync: documents.syncKind,
            // Tell the client that the server support code complete
            completionProvider: {
                resolveProvider: true
            },
            renameProvider: true
        }
    }
});

connection.onRenameRequest((params): WorkspaceEdit => {
    const result: WorkspaceEdit = {
        changes: {}
    }
    return result;
});

and hitting F2 in my file doesn't do anything, despite completion working as expected.

I'd at least expect the rename UI to show.

Module 'vscode' has no exported member 'CompletionList'.

I was trying to update my linter today and while compile this error messsage came up

node_modules/vscode-languageclient/lib/protocolConverter.d.ts(10,129): error TS2305: Module 'vscode' has no exported member 'CompletionList'.

It appears that protocolConverter.ts is looking for code.CompletionList which does not exit in my vscode.raw.d.ts file.

These are my dependencies:

  "dependencies": {
    "vscode-languageclient": "^2.0.0",
    "vscode-set-text": "^1.0.0"
  },
  "devDependencies": {
    "typescript": "^1.8.10",
    "vscode": "^0.11.10"
  }

and node ./node_modules/vscode/bin/install is executed succesfully.

Could capabilities be announced implicitly?

From my understanding (which might be wrong) I return a capabilities literal when establishing the connection, but I also register handler for certain features, like onRenameRequestand {renameProvider: true}. I wonder why registering a handles announce that capability?

[TS]Getting duplicate error message in editor without adding linter extension for typescript.

From @v-pavanp on March 22, 2016 23:56

OS Version: Windows10
VSCode version: 0.10.12-alpha

Steps:

  1. launch app and open a folder which contain .TS file.
  2. Verify any error message is showing up.

Expected: If there is not extensions installed for TS lint then error should not be highlighted in editor.

Actual:
While verifying bug #4107 with "Express Node.js typescript" project. I observed that there are two error messages showing up in my .ts file and when I closely watched, I found there is no extension installed for TS lint. I also removed extension for ESlint as well and restarted app.

I observer that still it is showing two errors messages in the editor and when I hover over on it, it is displaying :

  1. [ts] cannot find module 'http'
  2. [ts] Cannot find name process.

But when I clicked on error icon from the status bar then could see in the pop-up (in command palette) it is showing up duplicate error message like below.
image

Questions:

  1. When there is no linter installed for TS or ES then why it is displaying red mark in the code.
  2. Is there any reference left for the TSLint in the system after removing extension which is causing this issue.
    image

I also verified in the extension directory and didn't find any reference of TS or ES lint extension.
image

Copied from original issue: microsoft/vscode#4591

installServerIntoExtension script issue

The launch.json is now requiring absolute paths and you get a warning when launching the server with

            "outDir": "../tslint/server"

Warning:

Relative paths in 'launch.json' will no longer be supported, use '${workspaceRoot}/../tslint/server' instead.

Changing the launch.json as requested to

            "outDir": "${workspaceRoot}/../tslint/server"

Results in an incorrect error from installServerExtension:

installServerIntoExtension ../tslint ./package.json ./src/tsconfig.json && tsc -p ./src

outDir in ./.vscode/launch.json must point to /Users/egamma/Projects/vscode-tslint/tslint/server but it points to /Users/egamma/Projects/vscode-tslint/tslint-server/tslint/server
Please change outDir in ./.vscode/launch.json to ../tslint/server

How to read the contents of other files?

I'm considering writing a language server for another language, but after going through the docs and example, I'm left with a question:

How should the language server read the contents of associated source files in the project that aren't opened in the editor? Should it just read them from disk itself, or should it be requesting the client for the file contents somehow; and if so, how?
#1 Seems to be related

Publish new npm modules to correct dev dependencies for vscode

The dev dependency for vscode should be ^0.11.x not ^0.2.0. For extensions this is not an issue because on npm install only dependencies are taken into consideration. This is only affecting people doing dev work on the language server/client bits

missing registerCommand

An extension should be able to register a command (like c#.extractMethod) that it can propose that (including arguments) when being asked for code actions.

NPE in protocolConverter.js

On the the language server have 'onHover' return a promise that resolves to null.
(return Promise.resolve(null))
-> on the client, exception as below

Note, works when returning 'undefined' instead
(Promise.resolve(void 0);)

Cannot read property 'contents' of undefined: TypeError: Cannot read property 'contents' of undefined
at asHover (/home/martinae/workspaces/vscode/extensions/json/node_modules/vscode-languageclient/lib/protocolConverter.js:64:32)
at process._tickCallback (node.js:369:9)

Treat undefined and null results correctly

Currently returning undefined from a response handler results in the request never completed. To conform to the JSON rpc spec we need to convert undefined into null when returned in a response.

Server implementation should provide document validation queuing

Currently linters are implemented by directly reacting in document changes (they validate when the change comes in). If n new requests come in while the document is active on 2 validation request should be executed. Currently most linters execute n + 1 validation request.

The implementation could make use of vs/base/common/async.ts#Throttler

Autoformat multiple exports

From @ayoubdev on July 5, 2016 10:10

  • VSCode Version: 1.3.0-insider (2016-07-04)
  • OS Version: Windows 10

Hello everyone,

I wonder if it's possible to change indentation behavior for javascript multiple exports (like multiple imports one). Indeed, autoformat feature currently outputs following:

import {
    InjectEventEmitter,
    ProvideEventEmitter
} from "./decorator.js";

export {
Helper,
CustomPropTypes
};

Desired output:

import {
    InjectEventEmitter,
    ProvideEventEmitter
} from "./decorator.js";

export {
    Helper,
    CustomPropTypes
};

Copied from original issue: microsoft/vscode#8755

wrong node version used during installServerIntoExtension

installServerIntoExtension invokes npm update with the currently active node version. If this version is not v5.x, any native packages (eg. oniguruma) will be compiled with the incorrect NODE_MODULE_VERSION, and can not be loaded in VSCode.

Add tracing support

Add support to trace the communication between client and server to a output channel.

languageServer does not permit to check document's _languageId

From client I can see the _languageId of a document, even if it's private.
The problem is that this property is essential in providing the correct completion for the current language.

In my case, for example, I have an extension activationEvent for ['c', 'c++'], so from my server I need to know if the current document is a C or C++ file to provide correct completion service.

node-server error messages not forwarded

It looks like that when the language server has an issue that causes nodejs to terminate, e.g due to a syntax error in the code, the error message reported from nodejs is not shown anywhere.
It would be great if it is logged to the extension host console.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.