@@ -91,6 +91,7 @@ function collectClientOptions(
9191 configuration : vscode . WorkspaceConfiguration ,
9292 workspaceFolder : vscode . WorkspaceFolder ,
9393 outputChannel : WorkspaceChannel ,
94+ ruby : Ruby ,
9495) : LanguageClientOptions {
9596 const pullOn : "change" | "save" | "both" =
9697 configuration . get ( "pullDiagnosticsOn" ) ! ;
@@ -102,10 +103,27 @@ function collectClientOptions(
102103
103104 const features : EnabledFeatures = configuration . get ( "enabledFeatures" ) ! ;
104105 const enabledFeatures = Object . keys ( features ) . filter ( ( key ) => features [ key ] ) ;
105- const pattern = `${ path . join ( workspaceFolder . uri . fsPath , "**" , "*" ) } ` ;
106+
107+ const documentSelector = [
108+ {
109+ language : "ruby" ,
110+ pattern : path . join ( workspaceFolder . uri . fsPath , "**" , "*" ) ,
111+ } ,
112+ ] ;
113+
114+ if ( ruby . env . GEM_PATH ) {
115+ const parts = ruby . env . GEM_PATH . split ( path . delimiter ) ;
116+
117+ parts . forEach ( ( gemPath ) => {
118+ documentSelector . push ( {
119+ language : "ruby" ,
120+ pattern : path . join ( gemPath , "**" , "*" ) ,
121+ } ) ;
122+ } ) ;
123+ }
106124
107125 return {
108- documentSelector : [ { language : "ruby" , pattern } ] ,
126+ documentSelector,
109127 workspaceFolder,
110128 diagnosticCollectionName : LSP_NAME ,
111129 outputChannel,
@@ -149,6 +167,7 @@ export default class Client extends LanguageClient implements ClientInterface {
149167 vscode . workspace . getConfiguration ( "rubyLsp" ) ,
150168 workspaceFolder ,
151169 outputChannel ,
170+ ruby ,
152171 ) ,
153172 ) ;
154173
0 commit comments