@@ -5,7 +5,7 @@ import { CodeLens, State } from "vscode-languageclient/node";
55
66import { Ruby } from "./ruby" ;
77import Client from "./client" ;
8- import { asyncExec , LOG_CHANNEL , WorkspaceInterface , STATUS_EMITTER , debounce } from "./common" ;
8+ import { asyncExec , LOG_CHANNEL , WorkspaceInterface , STATUS_EMITTER , debounce , featureEnabled } from "./common" ;
99import { WorkspaceChannel } from "./workspaceChannel" ;
1010
1111const WATCHED_FILES = [ "Gemfile.lock" , "gems.locked" ] ;
@@ -263,11 +263,13 @@ export class Workspace implements WorkspaceInterface {
263263 env : this . ruby . env ,
264264 } ) ;
265265
266+ const preFlag = featureEnabled ( "betaServer" ) ? " --pre" : "" ;
267+
266268 // If any of the Ruby LSP's dependencies are missing, we need to install them. For example, if the user runs `gem
267269 // uninstall prism`, then we must ensure it's installed or else rubygems will fail when trying to launch the
268270 // executable
269271 if ( ! dependencies . every ( ( dep ) => new RegExp ( `${ dep } \\s` ) . exec ( stdout ) ) ) {
270- await asyncExec ( " gem install ruby-lsp" , {
272+ await asyncExec ( ` gem install ruby-lsp${ preFlag } ` , {
271273 cwd : this . workspaceFolder . uri . fsPath ,
272274 env : this . ruby . env ,
273275 } ) ;
@@ -293,7 +295,7 @@ export class Workspace implements WorkspaceInterface {
293295 // If we haven't updated the gem in the last 24 hours or if the user manually asked for an update, update it
294296 if ( manualInvocation || lastUpdatedAt === undefined || Date . now ( ) - lastUpdatedAt > oneDayInMs ) {
295297 try {
296- await asyncExec ( " gem update ruby-lsp" , {
298+ await asyncExec ( ` gem update ruby-lsp${ preFlag } ` , {
297299 cwd : this . workspaceFolder . uri . fsPath ,
298300 env : this . ruby . env ,
299301 } ) ;
0 commit comments