3 [![NPM Version](https://img.shields.io/npm/v/vscode-jsonrpc.svg)](https://npmjs.org/package/vscode-jsonrpc)
4 [![NPM Downloads](https://img.shields.io/npm/dm/vscode-jsonrpc.svg)](https://npmjs.org/package/vscode-jsonrpc)
5 [![Build Status](https://travis-ci.org/Microsoft/vscode-languageserver-node.svg?branch=master)](https://travis-ci.org/Microsoft/vscode-languageserver-node)
7 This npm module implements the base messaging protocol spoken between a VSCode language server and a VSCode language client.
9 The npm module can also be used standalone to establish a [JSON-RPC](http://www.jsonrpc.org/) channel between
10 a client and a server. Below an example how to setup a JSON-RPC connection. First the client side.
13 import * as cp from 'child_process';
14 import * as rpc from 'vscode-jsonrpc';
16 let childProcess = cp.spawn(...);
18 // Use stdin and stdout for communication:
19 let connection = rpc.createMessageConnection(
20 new rpc.StreamMessageReader(childProcess.stdout),
21 new rpc.StreamMessageWriter(childProcess.stdin));
23 let notification = new rpc.NotificationType<string, void>('testNotification');
27 connection.sendNotification(notification, 'Hello World');
30 The server side looks very symmetrical:
33 import * as rpc from 'vscode-jsonrpc';
36 let connection = rpc.createMessageConnection(
37 new rpc.StreamMessageReader(process.stdin),
38 new rpc.StreamMessageWriter(process.stdout));
40 let notification = new rpc.NotificationType<string, void>('testNotification');
41 connection.onNotification(notification, (param: string) => {
42 console.log(param); // This prints Hello World
52 - add progress support
53 - move JS target to ES2017
57 - move JS target to ES6.
61 - converted the NPM module to use TypeScript 2.0.3.
62 - added strict null support.
63 - support for passing more than one parameter to a request or notification.
65 - due to the use of TypeScript 2.0.3 and differences in d.ts generation users of the new version need to move to
66 TypeScript 2.0.3 as well.
69 [MIT](https://github.com/Microsoft/vscode-languageserver-node/blob/master/License.txt)