Skip to content

Commit 2a36402

Browse files
authored
Prevent the same workspace from being lazily launched more than once (#2693)
1 parent f21413e commit 2a36402

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

vscode/src/rubyLsp.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export class RubyLsp {
3333

3434
// A URI => content map of virtual documents for delegate requests
3535
private readonly virtualDocuments = new Map<string, string>();
36+
private readonly workspacesBeingLaunched: Set<number> = new Set();
3637

3738
constructor(
3839
context: vscode.ExtensionContext,
@@ -83,14 +84,18 @@ export class RubyLsp {
8384
document.uri,
8485
);
8586

86-
if (!workspaceFolder) {
87+
if (
88+
!workspaceFolder ||
89+
this.workspacesBeingLaunched.has(workspaceFolder.index)
90+
) {
8791
return;
8892
}
8993

9094
const workspace = this.getWorkspace(workspaceFolder.uri);
9195

9296
// If the workspace entry doesn't exist, then we haven't activated the workspace yet
9397
if (!workspace) {
98+
this.workspacesBeingLaunched.add(workspaceFolder.index);
9499
await this.activateWorkspace(workspaceFolder, false);
95100
}
96101
}),
@@ -230,6 +235,7 @@ export class RubyLsp {
230235
true,
231236
);
232237
await this.showFormatOnSaveModeWarning(workspace);
238+
this.workspacesBeingLaunched.delete(workspaceFolder.index);
233239
}
234240

235241
// Registers all extension commands. Commands can only be registered once, so this happens in the constructor. For

0 commit comments

Comments
 (0)