Skip to content

Commit

Permalink
Warn users if no lockfile is detected on the configured workspace (#945)
Browse files Browse the repository at this point in the history
  • Loading branch information
vinistock authored Dec 19, 2023
1 parent 09efc6f commit 2611f46
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions src/rubyLsp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,31 @@ export class RubyLsp {
// `workspaceContains` activation events in package.json
if (
!(await pathExists(path.join(workspaceDir, "Gemfile.lock"))) &&
!(await pathExists(path.join(workspaceDir, "gems.locked")))
!(await pathExists(path.join(workspaceDir, "gems.locked"))) &&
!this.context.globalState.get("rubyLsp.disableMultirootLockfileWarning")
) {
return;
const answer = await vscode.window.showWarningMessage(
`Tried to activate the Ruby LSP in ${workspaceDir}, but no lockfile was found. Are you using a monorepo setup?`,
"No - launch without bundle",
"Yes - see multi-root workspace docs",
"Don't show again",
);

if (answer === "Yes - see multi-root workspace docs") {
vscode.env.openExternal(
vscode.Uri.parse(
"https://github.com/Shopify/vscode-ruby-lsp?tab=readme-ov-file#multi-root-workspaces",
),
);
return;
}

if (answer === "Don't show again") {
this.context.globalState.update(
"rubyLsp.disableMultirootLockfileWarning",
true,
);
}
}

const workspace = new Workspace(
Expand Down

0 comments on commit 2611f46

Please sign in to comment.