From a6e04cfa7fbc2baaf5fabb8a07093034d4d761e4 Mon Sep 17 00:00:00 2001 From: gentoo90 Date: Sat, 5 Jan 2019 17:28:41 +0200 Subject: [PATCH] Allow user to set path to ra_lsp_server in vscode settings --- editors/code/package.json | 7 +++++++ editors/code/src/config.ts | 5 +++++ editors/code/src/server.ts | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/editors/code/package.json b/editors/code/package.json index 9b8f6351b4..c6340e6dfe 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -132,6 +132,13 @@ "default": true, "description": "Highlight Rust code (overrides built-in syntax highlighting)" }, + "ra-lsp.raLspServerPath": { + "type": [ + "string" + ], + "default": "ra_lsp_server", + "description": "Path to ra_lsp_server executable" + }, "ra-lsp.trace.server": { "type": "string", "scope": "window", diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts index 7d05ea078c..cd0c6e6e29 100644 --- a/editors/code/src/config.ts +++ b/editors/code/src/config.ts @@ -4,6 +4,7 @@ import { Server } from './server'; export class Config { public highlightingOn = true; + public raLspServerPath = 'ra_lsp_server'; constructor() { vscode.workspace.onDidChangeConfiguration(_ => @@ -21,5 +22,9 @@ export class Config { if (!this.highlightingOn && Server) { Server.highlighter.removeHighlights(); } + + if (config.has('raLspServerPath')) { + this.raLspServerPath = config.get('raLspServerPath') as string; + } } } diff --git a/editors/code/src/server.ts b/editors/code/src/server.ts index 75bdf32070..35fb7e3f50 100644 --- a/editors/code/src/server.ts +++ b/editors/code/src/server.ts @@ -12,7 +12,7 @@ export class Server { notificationHandlers: Iterable<[string, lc.GenericNotificationHandler]> ) { const run: lc.Executable = { - command: 'ra_lsp_server', + command: this.config.raLspServerPath, options: { cwd: '.' } }; const serverOptions: lc.ServerOptions = {