Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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());
}
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);
}
}
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, '');
}
);
}