You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

vscode-languageclient

Package Overview
Dependencies
Maintainers
7
Versions
305
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vscode-languageclient

VSCode Language client implementation

9.0.1
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
7
Weekly downloads
 
Created

What is vscode-languageclient?

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.

What are vscode-languageclient's main functionalities?

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

Other packages similar to vscode-languageclient

FAQs

Package last updated on 26 Sep 2023

Did you know?

Socket

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.

Install

Related posts