aboutsummaryrefslogtreecommitdiff
path: root/editors/code
diff options
context:
space:
mode:
authorLucas Spits <[email protected]>2019-03-11 19:38:46 +0000
committerLucas Spits <[email protected]>2019-03-11 19:38:46 +0000
commit7185c594fe1b6c282c432c1fbb57e8e6e23421ed (patch)
treeb69bb180e14135078fe0e1b2284dc12512574505 /editors/code
parent011bd4b2fce56f7c96b4b863c1958184c9d5f84d (diff)
Retrieve current directory from workspaces
Diffstat (limited to 'editors/code')
-rw-r--r--editors/code/src/server.ts20
1 files changed, 18 insertions, 2 deletions
diff --git a/editors/code/src/server.ts b/editors/code/src/server.ts
index 50461b0c6..30ab874ab 100644
--- a/editors/code/src/server.ts
+++ b/editors/code/src/server.ts
@@ -1,6 +1,6 @@
1import * as lc from 'vscode-languageclient'; 1import * as lc from 'vscode-languageclient';
2 2
3import { window } from 'vscode'; 3import { window, workspace } from 'vscode';
4import { Config } from './config'; 4import { Config } from './config';
5import { Highlighter } from './highlighting'; 5import { Highlighter } from './highlighting';
6 6
@@ -12,9 +12,25 @@ export class Server {
12 public static start( 12 public static start(
13 notificationHandlers: Iterable<[string, lc.GenericNotificationHandler]> 13 notificationHandlers: Iterable<[string, lc.GenericNotificationHandler]>
14 ) { 14 ) {
15
16 // '.' Is the fallback if no folder is open
17 // 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.
18 let folder: string = '.';
19 if (workspace.workspaceFolders !== undefined) {
20
21 folder = workspace
22 .workspaceFolders[0].uri.fsPath
23 .toString();
24
25 if (workspace.workspaceFolders.length > 1) {
26 // Tell the user that we do not support multi-root workspaces yet
27 window.showWarningMessage("Multi-root workspaces are not currently supported");
28 }
29 }
30
15 const run: lc.Executable = { 31 const run: lc.Executable = {
16 command: this.config.raLspServerPath, 32 command: this.config.raLspServerPath,
17 options: { cwd: '.' } 33 options: { cwd: folder }
18 }; 34 };
19 const serverOptions: lc.ServerOptions = { 35 const serverOptions: lc.ServerOptions = {
20 run, 36 run,