@@ -3,7 +3,7 @@ import os from "os";
33
44import * as vscode from "vscode" ;
55
6- import { asyncExec , expandPath , RubyInterface } from "./common" ;
6+ import { asyncExec , RubyInterface } from "./common" ;
77import { WorkspaceChannel } from "./workspaceChannel" ;
88import { Shadowenv , UntrustedWorkspaceError } from "./ruby/shadowenv" ;
99import { Chruby } from "./ruby/chruby" ;
@@ -84,12 +84,10 @@ export class Ruby implements RubyInterface {
8484 this . telemetry = telemetry ;
8585
8686 const rawBundleGemfile : string = vscode . workspace . getConfiguration ( "rubyLsp" ) . get ( "bundleGemfile" ) ! ;
87- const customBundleGemfile = expandPath ( rawBundleGemfile , this . workspaceFolder ) ;
87+ const customBundleGemfile = rawBundleGemfile . replace ( / \$ \{ w o r k s p a c e F o l d e r \} / g , this . workspaceFolder . uri . fsPath ) ;
8888
8989 if ( customBundleGemfile . length > 0 ) {
90- this . customBundleGemfile = path . isAbsolute ( customBundleGemfile )
91- ? customBundleGemfile
92- : path . resolve ( path . join ( this . workspaceFolder . uri . fsPath , customBundleGemfile ) ) ;
90+ this . customBundleGemfile = path . resolve ( this . workspaceFolder . uri . fsPath , customBundleGemfile ) ;
9391 }
9492 }
9593
@@ -140,6 +138,7 @@ export class Ruby implements RubyInterface {
140138 this . context ,
141139 this . manuallySelectRuby . bind ( this ) ,
142140 workspaceRubyPath ,
141+ this . customBundleGemfile ,
143142 ) ,
144143 ) ;
145144 } else {
@@ -174,6 +173,7 @@ export class Ruby implements RubyInterface {
174173 this . context ,
175174 this . manuallySelectRuby . bind ( this ) ,
176175 globalRubyPath ,
176+ this . customBundleGemfile ,
177177 ) ,
178178 ) ;
179179 } else {
@@ -297,56 +297,54 @@ export class Ruby implements RubyInterface {
297297 }
298298
299299 private async runManagerActivation ( ) {
300+ const manuallySelectRuby = this . manuallySelectRuby . bind ( this ) ;
301+ const args = [
302+ this . workspaceFolder ,
303+ this . outputChannel ,
304+ this . context ,
305+ manuallySelectRuby ,
306+ this . customBundleGemfile ,
307+ ] as const ;
308+
300309 switch ( this . versionManager . identifier ) {
301310 case ManagerIdentifier . Asdf :
302- await this . runActivation (
303- new Asdf ( this . workspaceFolder , this . outputChannel , this . context , this . manuallySelectRuby . bind ( this ) ) ,
304- ) ;
311+ await this . runActivation ( new Asdf ( ...args ) ) ;
305312 break ;
306313 case ManagerIdentifier . Chruby :
307- await this . runActivation (
308- new Chruby ( this . workspaceFolder , this . outputChannel , this . context , this . manuallySelectRuby . bind ( this ) ) ,
309- ) ;
314+ await this . runActivation ( new Chruby ( ...args ) ) ;
310315 break ;
311316 case ManagerIdentifier . Rbenv :
312- await this . runActivation (
313- new Rbenv ( this . workspaceFolder , this . outputChannel , this . context , this . manuallySelectRuby . bind ( this ) ) ,
314- ) ;
317+ await this . runActivation ( new Rbenv ( ...args ) ) ;
315318 break ;
316319 case ManagerIdentifier . Rvm :
317- await this . runActivation (
318- new Rvm ( this . workspaceFolder , this . outputChannel , this . context , this . manuallySelectRuby . bind ( this ) ) ,
319- ) ;
320+ await this . runActivation ( new Rvm ( ...args ) ) ;
320321 break ;
321322 case ManagerIdentifier . Mise :
322- await this . runActivation (
323- new Mise ( this . workspaceFolder , this . outputChannel , this . context , this . manuallySelectRuby . bind ( this ) ) ,
324- ) ;
323+ await this . runActivation ( new Mise ( ...args ) ) ;
325324 break ;
326325 case ManagerIdentifier . Rv :
327- await this . runActivation (
328- new Rv ( this . workspaceFolder , this . outputChannel , this . context , this . manuallySelectRuby . bind ( this ) ) ,
329- ) ;
326+ await this . runActivation ( new Rv ( ...args ) ) ;
330327 break ;
331328 case ManagerIdentifier . RubyInstaller :
332- await this . runActivation (
333- new RubyInstaller ( this . workspaceFolder , this . outputChannel , this . context , this . manuallySelectRuby . bind ( this ) ) ,
334- ) ;
329+ await this . runActivation ( new RubyInstaller ( ...args ) ) ;
335330 break ;
336331 case ManagerIdentifier . Custom :
337- await this . runActivation (
338- new Custom ( this . workspaceFolder , this . outputChannel , this . context , this . manuallySelectRuby . bind ( this ) ) ,
339- ) ;
332+ await this . runActivation ( new Custom ( ...args ) ) ;
340333 break ;
341334 case ManagerIdentifier . None :
342335 await this . runActivation (
343- new None ( this . workspaceFolder , this . outputChannel , this . context , this . manuallySelectRuby . bind ( this ) ) ,
336+ new None (
337+ this . workspaceFolder ,
338+ this . outputChannel ,
339+ this . context ,
340+ manuallySelectRuby ,
341+ undefined ,
342+ this . customBundleGemfile ,
343+ ) ,
344344 ) ;
345345 break ;
346346 default :
347- await this . runActivation (
348- new Shadowenv ( this . workspaceFolder , this . outputChannel , this . context , this . manuallySelectRuby . bind ( this ) ) ,
349- ) ;
347+ await this . runActivation ( new Shadowenv ( ...args ) ) ;
350348 break ;
351349 }
352350 }
0 commit comments