Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
vscode-languageclient
Advanced tools
The vscode-languageclient npm package is a library that helps in creating language clients for Visual Studio Code extensions. It facilitates communication between the client (VS Code) and the language server, enabling features like auto-completion, go-to-definition, and diagnostics.
Initialize Language Client
This code initializes a language client that communicates with a language server. The client is configured to listen to plaintext files and synchronize file events.
const { LanguageClient, TransportKind } = require('vscode-languageclient/node');
const client = new LanguageClient(
'languageServerExample',
'Language Server Example',
{
command: 'path/to/language-server',
args: [],
transport: TransportKind.stdio
},
{
documentSelector: [{ scheme: 'file', language: 'plaintext' }],
synchronize: {
fileEvents: workspace.createFileSystemWatcher('**/.clientrc')
}
}
);
client.start();
Handle Server Notifications
This code sets up a handler for custom notifications sent from the language server to the client. It logs the received notification parameters to the console.
client.onReady().then(() => {
client.onNotification('custom/notification', (params) => {
console.log('Received custom notification:', params);
});
});
Send Custom Requests
This code sends a custom request from the client to the language server and logs the server's response.
client.onReady().then(() => {
client.sendRequest('custom/request', { text: 'Hello, server!' }).then((response) => {
console.log('Received response:', response);
});
});
The vscode-languageserver package provides tools to implement a language server. It is often used in conjunction with vscode-languageclient to create a full language server-client setup. While vscode-languageclient is focused on the client-side, vscode-languageserver provides the server-side implementation.
The monaco-languageclient package is similar to vscode-languageclient but is designed for use with the Monaco Editor, which is the editor that powers VS Code. It allows for language server communication in web-based editors, providing similar functionalities to vscode-languageclient but in a different environment.
The lsp-client package is a lightweight alternative to vscode-languageclient. It provides basic functionalities to communicate with language servers using the Language Server Protocol (LSP). It is less feature-rich but can be a good choice for simpler use cases.
This npm module allows VSCode extensions to easily integrate language servers adhering to the language server protocol
See here for a detailed documentation on how to implement language servers for VSCode.
For the history please see the main repository
FAQs
VSCode Language client implementation
We found that vscode-languageclient demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.