diff options
Diffstat (limited to 'editors/code')
-rw-r--r-- | editors/code/src/server.ts | 20 |
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 @@ | |||
1 | import * as lc from 'vscode-languageclient'; | 1 | import * as lc from 'vscode-languageclient'; |
2 | 2 | ||
3 | import { window } from 'vscode'; | 3 | import { window, workspace } from 'vscode'; |
4 | import { Config } from './config'; | 4 | import { Config } from './config'; |
5 | import { Highlighter } from './highlighting'; | 5 | import { 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, |