diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-04-14 18:26:07 +0100 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-04-14 18:26:07 +0100 |
commit | 88be6f32172813f53dae60d73c9f5deb0c3fb29f (patch) | |
tree | 0b5f8f793929f651dfe332e0f5545b938ff5189f /editors | |
parent | 5d35f284f5ac70cde5d758e7c63a38eae0fb0b55 (diff) | |
parent | c2dfc8a229c0a18dff08d5ce7e6836c91648eee5 (diff) |
Merge #1137
1137: Adds support for multiple editor workspaces on initialization r=matklad a=jrvidal
OK, so this "simple hack" turned out to be way more contrived than I expected :joy:
### What works
This patch only handles multi-folder editor workspaces _on initialization_.
* I've found that modifying the layout of a workspace in VSCode just reloads the extension, so this hack should be enough for now.
* Not sure about how emacs-lsp behaves, but we fallback gracefully to the mono-folder workspace, so it should be fine.
### What doesn't work
* [x] `cargo watch` can only watch a single root folder with a `Cargo.toml`. I've left this part untouched but we could either warn that it's not supported or launch _multiple_ `cargo-watch` processes.
* [x] The `rust-analyzer/runnables` command is not functional, since we don't send the correct `cwd`.
* [x] Should we add some happy path test to `heavy_tests`?
* [ ] Going from a single `root` to multiple `roots` leaves us with a couple of `n * m` loops that smell a bit. The number of folders in the editor workspace is probably low though.
Co-authored-by: Roberto Vidal <[email protected]>
Diffstat (limited to 'editors')
-rw-r--r-- | editors/code/src/commands/runnables.ts | 3 | ||||
-rw-r--r-- | editors/code/src/server.ts | 7 |
2 files changed, 2 insertions, 8 deletions
diff --git a/editors/code/src/commands/runnables.ts b/editors/code/src/commands/runnables.ts index 3589edcee..c4df24c79 100644 --- a/editors/code/src/commands/runnables.ts +++ b/editors/code/src/commands/runnables.ts | |||
@@ -17,6 +17,7 @@ interface Runnable { | |||
17 | bin: string; | 17 | bin: string; |
18 | args: string[]; | 18 | args: string[]; |
19 | env: { [index: string]: string }; | 19 | env: { [index: string]: string }; |
20 | cwd?: string; | ||
20 | } | 21 | } |
21 | 22 | ||
22 | class RunnableQuickPick implements vscode.QuickPickItem { | 23 | class RunnableQuickPick implements vscode.QuickPickItem { |
@@ -49,7 +50,7 @@ function createTask(spec: Runnable): vscode.Task { | |||
49 | }; | 50 | }; |
50 | 51 | ||
51 | const execOption: vscode.ShellExecutionOptions = { | 52 | const execOption: vscode.ShellExecutionOptions = { |
52 | cwd: '.', | 53 | cwd: spec.cwd || '.', |
53 | env: definition.env | 54 | env: definition.env |
54 | }; | 55 | }; |
55 | const exec = new vscode.ShellExecution( | 56 | const exec = new vscode.ShellExecution( |
diff --git a/editors/code/src/server.ts b/editors/code/src/server.ts index f319f148a..5e9a19340 100644 --- a/editors/code/src/server.ts +++ b/editors/code/src/server.ts | |||
@@ -17,13 +17,6 @@ export class Server { | |||
17 | let folder: string = '.'; | 17 | let folder: string = '.'; |
18 | if (workspace.workspaceFolders !== undefined) { | 18 | if (workspace.workspaceFolders !== undefined) { |
19 | folder = workspace.workspaceFolders[0].uri.fsPath.toString(); | 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 | } | 20 | } |
28 | 21 | ||
29 | const run: lc.Executable = { | 22 | const run: lc.Executable = { |