How to use the vscode-jsonrpc.SocketMessageWriter function in vscode-jsonrpc

To help you get started, we’ve selected a few vscode-jsonrpc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github elastic / kibana / x-pack / plugins / code / server / lsp / proxy.ts View on Github external
this.socket.on('connect', () => {
          const reader = new SocketMessageReader(this.socket);
          const writer = new SocketMessageWriter(this.socket);
          this.clientConnection = createMessageConnection(reader, writer, this.logger);
          this.registerOnNotificationHandler(this.clientConnection);
          this.clientConnection.listen();
          resolve(this.clientConnection);
          this.eventEmitter.emit('connect');
        });
github graphql / graphiql / packages / graphql-language-service-server / src / startServer.ts View on Github external
.createServer(client => {
            client.setEncoding('utf8');
            reader = new SocketMessageReader(client);
            writer = new SocketMessageWriter(client);
            client.on('end', () => {
              socket.close();
              process.exit(0);
            });
            const connection = createMessageConnection(reader, writer, logger);
            addHandlers(connection, logger, options.configDir);
            connection.listen();
          })
          .listen(port);
github elastic / kibana / x-pack / plugins / code / server / lsp / proxy.ts View on Github external
const server = net.createServer(socket => {
          this.initialized = false;
          server.close();
          this.eventEmitter.emit('connect');
          socket.on('close', () => this.onSocketClosed());

          this.logger.info('langserver connection established on port ' + this.targetPort);

          const reader = new SocketMessageReader(socket);
          const writer = new SocketMessageWriter(socket);
          this.clientConnection = createMessageConnection(reader, writer, this.logger);
          this.registerOnNotificationHandler(this.clientConnection);
          this.clientConnection.listen();
          res(this.clientConnection);
        });
        server.on('error', rej);
github elastic / kibana / x-pack / legacy / plugins / code / server / lsp / proxy.ts View on Github external
this.socket.on('connect', () => {
      const reader = new SocketMessageReader(this.socket);
      const writer = new SocketMessageWriter(this.socket);
      this.clientConnection = createMessageConnection(reader, writer, this.logger);
      this.registerOnNotificationHandler(this.clientConnection);
      this.clientConnection.listen();
      this.eventEmitter.emit('connect');
    });
github elastic / kibana / x-pack / plugins / code / server / lsp / proxy.ts View on Github external
this.socket.on('connect', () => {
          const reader = new SocketMessageReader(this.socket);
          const writer = new SocketMessageWriter(this.socket);
          this.clientConnection = createMessageConnection(reader, writer, this.logger);
          this.registerOnNotificationHandler(this.clientConnection);
          this.clientConnection.listen();
          resolve(this.clientConnection);
          this.eventEmitter.emit('connect');
        });
github elastic / kibana / x-pack / legacy / plugins / code / server / lsp / proxy.ts View on Github external
const server = net.createServer(socket => {
      this.initialized = false;
      server.close();
      this.currentServer = null;
      socket.on('close', () => this.onSocketClosed());
      this.eventEmitter.off('changePort', server.close);
      this.logger.info('langserver connection established on port ' + this.targetPort);
      const reader = new SocketMessageReader(socket);
      const writer = new SocketMessageWriter(socket);
      this.clientConnection = createMessageConnection(reader, writer, this.logger);
      this.registerOnNotificationHandler(this.clientConnection);
      this.clientConnection.listen();
      this.eventEmitter.emit('connect');
    });
    server.on('error', this.setError);
github atom / atom-languageclient / lib / auto-languageclient.ts View on Github external
private createRpcConnection(process: LanguageServerProcess): rpc.MessageConnection {
    let reader: rpc.MessageReader;
    let writer: rpc.MessageWriter;
    const connectionType = this.getConnectionType();
    switch (connectionType) {
      case 'ipc':
        reader = new rpc.IPCMessageReader(process as cp.ChildProcess);
        writer = new rpc.IPCMessageWriter(process as cp.ChildProcess);
        break;
      case 'socket':
        reader = new rpc.SocketMessageReader(this.socket);
        writer = new rpc.SocketMessageWriter(this.socket);
        break;
      case 'stdio':
        reader = new rpc.StreamMessageReader(process.stdout);
        writer = new rpc.StreamMessageWriter(process.stdin);
        break;
      default:
        return Utils.assertUnreachable(connectionType);
    }

    return rpc.createMessageConnection(reader, writer, {
      log: (..._args: any[]) => { },
      warn: (..._args: any[]) => { },
      info: (..._args: any[]) => { },
      error: (...args: any[]) => {
        this.logger.error(args);
      },
github last-hit-aab / last-hit / plugins / lib / extension-rpc.ts View on Github external
export const createServerSocketTransport = (
	port: number,
	encoding: string = 'utf-8'
): RPCOperator => {
	const socket = net.createConnection(port, '127.0.0.1');
	return {
		reader: new rpc.SocketMessageReader(socket, encoding),
		writer: new rpc.SocketMessageWriter(socket, encoding)
	};
};