How to use the vscode-languageserver-protocol.createProtocolConnection function in vscode-languageserver-protocol

To help you get started, we’ve selected a few vscode-languageserver-protocol 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 Armitxes / VSCode_SQF / node_modules / vscode-languageserver / lib / main.js View on Github external
}
    if (!output) {
        throw new Error("Connection output stream is not set. " + commandLineMessage);
    }
    // Backwards compatibility
    if (Is.func(input.read) && Is.func(input.on)) {
        let inputStream = input;
        inputStream.on('end', () => {
            process.exit(shutdownReceived ? 0 : 1);
        });
        inputStream.on('close', () => {
            process.exit(shutdownReceived ? 0 : 1);
        });
    }
    const logger = (factories && factories.console ? new (factories.console(ConnectionLogger))() : new ConnectionLogger());
    const connection = vscode_languageserver_protocol_1.createProtocolConnection(input, output, logger, strategy);
    logger.rawAttach(connection);
    const tracer = (factories && factories.tracer ? new (factories.tracer(TracerImpl))() : new TracerImpl());
    const telemetry = (factories && factories.telemetry ? new (factories.telemetry(TelemetryImpl))() : new TelemetryImpl());
    const client = (factories && factories.client ? new (factories.client(RemoteClientImpl))() : new RemoteClientImpl());
    const remoteWindow = (factories && factories.window ? new (factories.window(RemoteWindowImpl))() : new RemoteWindowImpl());
    const workspace = (factories && factories.workspace ? new (factories.workspace(RemoteWorkspaceImpl))() : new RemoteWorkspaceImpl());
    const allRemotes = [logger, tracer, telemetry, client, remoteWindow, workspace];
    function asThenable(value) {
        if (Is.thenable(value)) {
            return value;
        }
        else {
            return Promise.resolve(value);
        }
    }
    let shutdownHandler = undefined;
github stardog-union / stardog-language-servers / utils / testUtils.ts View on Github external
export const getStdioConnection = (pathToServer: string) => {
  const cp = spawn('ts-node', [
    '--compilerOptions',
    JSON.stringify({ module: 'commonjs' }),
    pathToServer,
    '--stdio',
  ]);
  const connection = createProtocolConnection(
    new StreamMessageReader(cp.stdout),
    new StreamMessageWriter(cp.stdin),
    {
      log: console.log,
      info: console.info,
      error: console.error,
      warn: console.warn,
    }
  );
  return { child_process: cp, connection };
};
github stardog-union / stardog-language-servers / utils / testUtils.ts View on Github external
it('performs LSP initialization via IPC', (done) => {
      cp = spawn(
        'ts-node',
        [
          '--compilerOptions',
          JSON.stringify({ module: 'commonjs' }),
          pathToServer,
          '--node-ipc',
        ],
        {
          stdio: [null, null, null, 'ipc'],
        }
      );
      const connection = createProtocolConnection(
        new IPCMessageReader(cp),
        new IPCMessageWriter(cp),
        null
      );
      testInitHandshake(connection, done);
    });
    it('performs LSP initialization via socket', async (done) => {
github stardog-union / stardog-language-servers / utils / testUtils.ts View on Github external
pipeTransport.onConnected().then(([messageReader, messageWriter]) => {
          const connection = createProtocolConnection(
            messageReader,
            messageWriter,
            null
          );
          testInitHandshake(connection, done);
        })
      );
github adobe / brackets / src / languageTools / LanguageClient / Connection.js View on Github external
function createConnection(reader, writer, restartLanguageClient, stopLanguageClient) {
        var logger = new Logger(),
            actionController = new ActionController(),
            connection = protocol.createProtocolConnection(reader, writer, logger),
            errorHandler = _getOnErrorHandler(actionController, stopLanguageClient),
            closeHandler = _getOnCloseHandler(connection, actionController, restartLanguageClient);

        connection.onError(errorHandler);
        connection.onClose(closeHandler);

        return connection;
    }