![]() | Name | Last modified | Size | Description |
---|---|---|---|---|
![]() | Parent Directory | - | ||
![]() | lib/ | a year ago | - | |
![]() | typings/ | a year ago | - | |
![]() | License.txt | a year ago | 1.1K | |
![]() | README.md | a year ago | 2.1K | 595aea1 more query options + view options [كارل مبارك] |
![]() | browser.d.ts | a year ago | 385 | |
![]() | browser.js | a year ago | 411 | |
![]() | node.cmd | a year ago | 213 | |
![]() | node.d.ts | a year ago | 382 | |
![]() | node.js | a year ago | 408 | |
![]() | package.json | a year ago | 1.6K | afd0ccc remove unused [كارل مبارك] |
![]() | thirdpartynotices.txt | a year ago | 1.8K |
This npm module implements the base messaging protocol spoken between a VSCode language server and a VSCode language client.
The npm module can also be used standalone to establish a JSON-RPC channel between a client and a server. Below an example how to setup a JSON-RPC connection. First the client side.
import * as cp from 'child_process';
import * as rpc from 'vscode-jsonrpc';
let childProcess = cp.spawn(...);
// Use stdin and stdout for communication:
let connection = rpc.createMessageConnection(
new rpc.StreamMessageReader(childProcess.stdout),
new rpc.StreamMessageWriter(childProcess.stdin));
let notification = new rpc.NotificationType<string, void>('testNotification');
connection.listen();
connection.sendNotification(notification, 'Hello World');
The server side looks very symmetrical:
import * as rpc from 'vscode-jsonrpc';
let connection = rpc.createMessageConnection(
new rpc.StreamMessageReader(process.stdin),
new rpc.StreamMessageWriter(process.stdout));
let notification = new rpc.NotificationType<string, void>('testNotification');
connection.onNotification(notification, (param: string) => {
console.log(param); // This prints Hello World
});
connection.listen();