Skip to content

Commit

Permalink
Prevent double activation when multiple documents are opened (#3070)
Browse files Browse the repository at this point in the history
### Motivation

When we started preventing double activation on lazy activations #2693, I forgot to do the same for when the user starts the editor with multiple documents opened.

### Implementation

We need to remember that we're already activating the workspace, so that we don't accidentally launch multiple duplicates for the same folder.
  • Loading branch information
vinistock authored Jan 16, 2025
1 parent 60390ec commit f0d7f6c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion vscode/src/rubyLsp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,17 @@ export class RubyLsp {
const workspaceFolder = vscode.workspace.getWorkspaceFolder(
activeDocument.uri,
);
if (workspaceFolder) {

if (
workspaceFolder &&
!this.workspacesBeingLaunched.has(workspaceFolder.index)
) {
const existingWorkspace = this.workspaces.get(
workspaceFolder.uri.toString(),
);

if (workspaceFolder && !existingWorkspace) {
this.workspacesBeingLaunched.add(workspaceFolder.index);
await this.activateWorkspace(workspaceFolder, false);
}
}
Expand Down

0 comments on commit f0d7f6c

Please sign in to comment.