How to use the vscode-languageclient/lib/main.LanguageClient function in vscode-languageclient

To help you get started, we’ve selected a few vscode-languageclient 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 slackhq / vscode-hack / src / LSPHackTypeChecker.ts View on Github external
public async run(): Promise {
    const context = this.context;
    const languageClient = new LanguageClient(
      'Hack Language Server',
      { command: config.hhClientCommand, args: [...config.hhClientArgs, 'lsp', '--from', 'vscode-hack'] },
      {
        documentSelector: [{ language: 'hack', scheme: 'file' }],
        initializationOptions: { useTextEditAutocomplete: true },
        uriConverters: { code2Protocol: utils.mapFromWorkspaceUri, protocol2Code: utils.mapToWorkspaceUri },
        middleware: {
          handleDiagnostics: this.handleDiagnostics,
        },
        // Hack returns errors if commands fail due to syntax errors. Don't
        // automatically switch to the Output pane in this case.
        revealOutputChannelOn: RevealOutputChannelOn.Never,
      },
    );
    context.subscriptions.push(languageClient.start());
  }
github dotnet / aspnetcore-tooling / src / Razor / src / Microsoft.AspNetCore.Razor.VSCode / src / RazorLanguageServerClient.ts View on Github external
args.push(options.trace.toString());

        if (options.debug) {
            this.telemetryReporter.reportDebugLanguageServer();

            this.logger.logMessage('Debug flag set for Razor Language Server.');
            args.push('--debug');
        }

        this.serverOptions = {
            run: { command, args },
            debug: { command, args },
        };

        this.client = new LanguageClient('razorLanguageServer', 'Razor Language Server', this.serverOptions, this.clientOptions);
    }
}
github lingua-pupuli / puppet-vscode / src / PuppetLanguageClient.ts View on Github external
clientOptions: LanguageClientOptions,
    statusBarItem: PuppetStatusBar,
    logger:ILogger
  ) {
    this.host = host;
    this.port = port;
    this.connectionManager = connectionManager;
    this.serverOptions = serverOptions;
    this.clientOptions = clientOptions;
    this.connectionStatus = ConnectionStatus.NotStarted;
    this.statusBarItem = statusBarItem;
    this.logger = logger;

    const title:string = 'Puppet Editor Service';

    this.languageServerClient = new LanguageClient(title, this.serverOptions, this.clientOptions);
    this.languageServerClient.onReady().then(
      () => {
        logger.debug('Language server client started, setting puppet version');
        this.setConnectionStatus('Loading Puppet', ConnectionStatus.Starting, '');
        this.queryLanguageServerStatus();
      },
      reason => {
        this.setConnectionStatus('Starting Error', ConnectionStatus.Failed, '');
      }
    );

  }