Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
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
The npm package vscode-languageclient receives a total of 756,375 weekly downloads. As such, vscode-languageclient popularity was classified as popular.
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
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.