diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-05-26 21:58:07 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-05-26 21:58:07 +0100 |
commit | b4015b6aaa0dd80f5c85c7ed03e83d0d16042264 (patch) | |
tree | 6e423f24d05092250af44cacf1cb1b881d471492 /editors/code/src/main.ts | |
parent | 666fc1cec10a41f88db56dfb339785eb1e7dd521 (diff) | |
parent | a05163db1429bfb8cf30dbea4b1aa86a24258d49 (diff) |
Merge #8995
8995: fix: Create tasks for all workspaces r=matklad a=SomeoneToIgnore
Follow-up of https://github.com/rust-analyzer/rust-analyzer/pull/8955#discussion_r637897170
Before:
<img width="593" alt="image" src="https://user-images.githubusercontent.com/2690773/119575267-712b5300-bdbf-11eb-833c-f688f7a7dd0f.png">
After:
<img width="643" alt="image" src="https://user-images.githubusercontent.com/2690773/119575273-74264380-bdbf-11eb-8283-a78bbcb7346e.png">
This is the first time I've used multiple workspaces feature in VSCode, but so far looks like
* opening detached files works
* run and debug lens work
* Rust Analyzer: Run action works
* run task works and now shows tasks for all workspaces
* there are no platform-specific changes involved
Co-authored-by: Kirill Bulatov <[email protected]>
Diffstat (limited to 'editors/code/src/main.ts')
-rw-r--r-- | editors/code/src/main.ts | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts index b735186fe..d26273246 100644 --- a/editors/code/src/main.ts +++ b/editors/code/src/main.ts | |||
@@ -45,8 +45,7 @@ async function tryActivate(context: vscode.ExtensionContext) { | |||
45 | throw new Error(message); | 45 | throw new Error(message); |
46 | }); | 46 | }); |
47 | 47 | ||
48 | const workspaceFolder = vscode.workspace.workspaceFolders?.[0]; | 48 | if (vscode.workspace.workspaceFolders?.length === 0) { |
49 | if (workspaceFolder === undefined) { | ||
50 | const rustDocuments = vscode.workspace.textDocuments.filter(document => isRustDocument(document)); | 49 | const rustDocuments = vscode.workspace.textDocuments.filter(document => isRustDocument(document)); |
51 | if (rustDocuments.length > 0) { | 50 | if (rustDocuments.length > 0) { |
52 | ctx = await Ctx.create(config, context, serverPath, { kind: 'Detached Files', files: rustDocuments }); | 51 | ctx = await Ctx.create(config, context, serverPath, { kind: 'Detached Files', files: rustDocuments }); |
@@ -58,8 +57,8 @@ async function tryActivate(context: vscode.ExtensionContext) { | |||
58 | // registers its `onDidChangeDocument` handler before us. | 57 | // registers its `onDidChangeDocument` handler before us. |
59 | // | 58 | // |
60 | // This a horribly, horribly wrong way to deal with this problem. | 59 | // This a horribly, horribly wrong way to deal with this problem. |
61 | ctx = await Ctx.create(config, context, serverPath, { kind: "Workspace Folder", folder: workspaceFolder.uri }); | 60 | ctx = await Ctx.create(config, context, serverPath, { kind: "Workspace Folder" }); |
62 | ctx.pushCleanup(activateTaskProvider(workspaceFolder, ctx.config)); | 61 | ctx.pushCleanup(activateTaskProvider(ctx.config)); |
63 | } | 62 | } |
64 | await initCommonContext(context, ctx); | 63 | await initCommonContext(context, ctx); |
65 | 64 | ||