Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions vscode/src/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { CodeLens, State } from "vscode-languageclient/node";

import { Ruby } from "./ruby";
import Client from "./client";
import { asyncExec, LOG_CHANNEL, WorkspaceInterface, STATUS_EMITTER, debounce } from "./common";
import { asyncExec, LOG_CHANNEL, WorkspaceInterface, STATUS_EMITTER, debounce, featureEnabled } from "./common";
import { WorkspaceChannel } from "./workspaceChannel";

const WATCHED_FILES = ["Gemfile.lock", "gems.locked"];
Expand Down Expand Up @@ -263,11 +263,13 @@ export class Workspace implements WorkspaceInterface {
env: this.ruby.env,
});

const preFlag = featureEnabled("betaServer") ? " --pre" : "";

// If any of the Ruby LSP's dependencies are missing, we need to install them. For example, if the user runs `gem
// uninstall prism`, then we must ensure it's installed or else rubygems will fail when trying to launch the
// executable
if (!dependencies.every((dep) => new RegExp(`${dep}\\s`).exec(stdout))) {
await asyncExec("gem install ruby-lsp", {
await asyncExec(`gem install ruby-lsp${preFlag}`, {
cwd: this.workspaceFolder.uri.fsPath,
env: this.ruby.env,
});
Expand All @@ -293,7 +295,7 @@ export class Workspace implements WorkspaceInterface {
// If we haven't updated the gem in the last 24 hours or if the user manually asked for an update, update it
if (manualInvocation || lastUpdatedAt === undefined || Date.now() - lastUpdatedAt > oneDayInMs) {
try {
await asyncExec("gem update ruby-lsp", {
await asyncExec(`gem update ruby-lsp${preFlag}`, {
cwd: this.workspaceFolder.uri.fsPath,
env: this.ruby.env,
});
Expand Down
Loading