aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code/src')
-rw-r--r--editors/code/src/ctx.ts5
-rw-r--r--editors/code/src/main.ts2
-rw-r--r--editors/code/src/server.ts5
3 files changed, 5 insertions, 7 deletions
diff --git a/editors/code/src/ctx.ts b/editors/code/src/ctx.ts
index 0e62a3a85..d86fe5a87 100644
--- a/editors/code/src/ctx.ts
+++ b/editors/code/src/ctx.ts
@@ -4,6 +4,7 @@ import { Server } from './server';
4import { Config } from './config'; 4import { Config } from './config';
5 5
6export class Ctx { 6export class Ctx {
7 readonly config = new Config();
7 private extCtx: vscode.ExtensionContext; 8 private extCtx: vscode.ExtensionContext;
8 9
9 constructor(extCtx: vscode.ExtensionContext) { 10 constructor(extCtx: vscode.ExtensionContext) {
@@ -14,10 +15,6 @@ export class Ctx {
14 return Server.client; 15 return Server.client;
15 } 16 }
16 17
17 get config(): Config {
18 return Server.config;
19 }
20
21 get activeRustEditor(): vscode.TextEditor | undefined { 18 get activeRustEditor(): vscode.TextEditor | undefined {
22 const editor = vscode.window.activeTextEditor; 19 const editor = vscode.window.activeTextEditor;
23 return editor && editor.document.languageId === 'rust' 20 return editor && editor.document.languageId === 'rust'
diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts
index 511f17ca4..3d9107927 100644
--- a/editors/code/src/main.ts
+++ b/editors/code/src/main.ts
@@ -31,7 +31,7 @@ export async function activate(context: vscode.ExtensionContext) {
31 ctx.overrideCommand('type', commands.onEnter); 31 ctx.overrideCommand('type', commands.onEnter);
32 } 32 }
33 33
34 const startServer = () => Server.start(); 34 const startServer = () => Server.start(ctx.config);
35 const reloadCommand = () => reloadServer(startServer); 35 const reloadCommand = () => reloadServer(startServer);
36 36
37 vscode.commands.registerCommand('rust-analyzer.reload', reloadCommand); 37 vscode.commands.registerCommand('rust-analyzer.reload', reloadCommand);
diff --git a/editors/code/src/server.ts b/editors/code/src/server.ts
index 5dc8a36bd..ab9f3bfa6 100644
--- a/editors/code/src/server.ts
+++ b/editors/code/src/server.ts
@@ -12,10 +12,10 @@ function expandPathResolving(path: string) {
12} 12}
13 13
14export class Server { 14export class Server {
15 public static config = new Config(); 15 static config: Config;
16 public static client: lc.LanguageClient; 16 public static client: lc.LanguageClient;
17 17
18 public static async start() { 18 public static async start(config: Config) {
19 // '.' Is the fallback if no folder is open 19 // '.' Is the fallback if no folder is open
20 // TODO?: Workspace folders support Uri's (eg: file://test.txt). It might be a good idea to test if the uri points to a file. 20 // TODO?: Workspace folders support Uri's (eg: file://test.txt). It might be a good idea to test if the uri points to a file.
21 let folder: string = '.'; 21 let folder: string = '.';
@@ -23,6 +23,7 @@ export class Server {
23 folder = workspace.workspaceFolders[0].uri.fsPath.toString(); 23 folder = workspace.workspaceFolders[0].uri.fsPath.toString();
24 } 24 }
25 25
26 this.config = config;
26 const command = expandPathResolving(this.config.raLspServerPath); 27 const command = expandPathResolving(this.config.raLspServerPath);
27 const run: lc.Executable = { 28 const run: lc.Executable = {
28 command, 29 command,