Security News
Namecheap Takes Down Polyfill.io Service Following Supply Chain Attack
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
vscode-languageserver-protocol
Advanced tools
Package description
The vscode-languageserver-protocol npm package provides the necessary protocols to implement a language server that communicates with development environments like Visual Studio Code. It defines the protocol used between an editor or IDE and a language server that provides language features like auto-complete, go to definition, or find all references.
Defining Language Server Capabilities
This code sample demonstrates how to define the capabilities of a language server, such as synchronization, completion, and definition lookup.
{"capabilities": {"textDocumentSync": 1, "completionProvider": {"resolveProvider": true, "triggerCharacters": [".", "{"]}, "definitionProvider": true}}
Handling Language Server Initialization
This code sample shows how to handle the initialization request from a client to a language server, specifying the process ID, root path, client capabilities, and trace settings.
{"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {"processId": null, "rootPath": null, "capabilities": {}, "trace": "off"}}
Sending Diagnostics to the Client
This code sample illustrates how a language server can send diagnostics (such as errors or warnings) to the client for a specific document.
{"jsonrpc": "2.0", "method": "textDocument/publishDiagnostics", "params": {"uri": "file:///path/to/file", "diagnostics": [{"range": {"start": {"line": 0, "character": 0}, "end": {"line": 0, "character": 1}}, "severity": 1, "message": "Error message"}]}}
lsp4j is a Java implementation of the language server protocol intended for use with Java-based tools. It serves a similar purpose to vscode-languageserver-protocol but is designed for the Java ecosystem.
language-server-protocol is another implementation of the protocol that allows developers to create language servers. It is not as widely adopted as vscode-languageserver-protocol and may not be as up-to-date with the latest protocol specifications.
monaco-languageclient is a package that allows the Monaco editor, which is the code editor that powers Visual Studio Code, to communicate with language servers using the language server protocol. It is similar to vscode-languageserver-protocol but is specifically tailored for the Monaco editor.
Readme
This npm module is a tool independent implementation of the language server protocol and can be used in any type of node application. Please note that the protocol is versioned using the LSP specification version number. Since the protocol depends on the vscode-jsonrpc
version a a breaking change on that dependencies might not be reflected in a major version change of this module. Changing the major version number in these cases was more confusing this it would result in a version mismatch between the protocol and the LSP specification.
See here for a detailed documentation on the language server protocol.
For the history please see the main repository
FAQs
VSCode Language Server Protocol implementation
The npm package vscode-languageserver-protocol receives a total of 1,455,565 weekly downloads. As such, vscode-languageserver-protocol popularity was classified as popular.
We found that vscode-languageserver-protocol demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.
Security News
A JavaScript library maintainer is under fire after merging a controversial PR to support legacy versions of Node.js.