@opensumi/vscode-jsonrpc

8.0.0-next.6 • Public • Published

内部包修改点

8.0.3-next.5

  1. 优化 Uint8Array 的判断,避免不同的 jest 环境会导致 Uint8Array 的异常 JSDOM overrides Uint8Array implementation

8.0.3-next.4

  1. 增加 Node.js 客户端的 web 版本 electron-renderer, 支持在 web 端建立 Node.js 服务的连接

6.1.1-beta.4

  1. 跳过因为 header 内容不标准导致的异常

6.1.1-beta.3

  1. 废弃 browser/main 下导出的 WebSocketMessageWriter WebSocketMessageReader, 由 opensumi 自行维护
  2. 因依赖 TextEncoder 与 TextDecoder , src/index 内不再导出 browser 相关接口

6.1.0-beta.2

  1. 修复写入时 stream 可能已经被销毁的问题

6.1.0-beta.1

  1. fork 自 vscode-jsonrpc@6.1.0 版本
  2. 添加 src/index.ts 统一导出 API,官方版本在不同环境下使用不同入口,但在 opensumi 里引用时没有区分环境,导致直接使用官方版本会有部分 node 下加载了 browser 模块的情况

4.0.3

  1. 移动 @types/mochadevDependencies

4.0.2

  1. 兼容 ws 格式 reader

4.0.1

  1. 增加 WebSocketMessageWriterWebSocketMessageReader 支持 WebSocket 协议

4.0.0

  1. 增加 MessageConnection 暴露的方法 isListeningisClosedisDisposed 避免重复监听 listen 连接

VSCode JSON RPC

NPM Version NPM Downloads Build Status

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

History

4.0.0

  • move JS target to ES6.

3.0.0:

  • converted the NPM module to use TypeScript 2.0.3.
  • added strict null support.
  • support for passing more than one parameter to a request or notification.
  • Breaking changes:
    • due to the use of TypeScript 2.0.3 and differences in d.ts generation users of the new version need to move to TypeScript 2.0.3 as well.

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i @opensumi/vscode-jsonrpc

Weekly Downloads

2,412

Version

8.0.0-next.6

License

MIT

Unpacked Size

480 kB

Total Files

94

Last publish

Collaborators

  • yantze
  • ricbet
  • hacke2
  • jinboker
  • ensorrow
  • sakuraash
  • erha19
  • lengthmin