Skip to content
This repository has been archived by the owner on May 30, 2024. It is now read-only.

Commit

Permalink
Warn users if no lockfile is detected on the configured workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
vinistock committed Dec 14, 2023
1 parent 1f90604 commit 7ddfa6b
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions src/rubyLsp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,28 @@ 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.disableLockfileWarning")
) {
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?`,
"Launch without bundle",
"See multi-root workspace docs",
"Don't show again",
);

if (answer === "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.disableLockfileWarning", true);
}
}

const workspace = new Workspace(
Expand Down

0 comments on commit 7ddfa6b

Please sign in to comment.