diff options
Diffstat (limited to 'editors/code')
-rw-r--r-- | editors/code/src/server.ts | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/editors/code/src/server.ts b/editors/code/src/server.ts index 50461b0c6..f319f148a 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,23 @@ 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 | // '.' Is the fallback if no folder is open | ||
16 | // 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. | ||
17 | let folder: string = '.'; | ||
18 | if (workspace.workspaceFolders !== undefined) { | ||
19 | folder = workspace.workspaceFolders[0].uri.fsPath.toString(); | ||
20 | |||
21 | if (workspace.workspaceFolders.length > 1) { | ||
22 | // Tell the user that we do not support multi-root workspaces yet | ||
23 | window.showWarningMessage( | ||
24 | 'Multi-root workspaces are not currently supported' | ||
25 | ); | ||
26 | } | ||
27 | } | ||
28 | |||
15 | const run: lc.Executable = { | 29 | const run: lc.Executable = { |
16 | command: this.config.raLspServerPath, | 30 | command: this.config.raLspServerPath, |
17 | options: { cwd: '.' } | 31 | options: { cwd: folder } |
18 | }; | 32 | }; |
19 | const serverOptions: lc.ServerOptions = { | 33 | const serverOptions: lc.ServerOptions = { |
20 | run, | 34 | run, |