@@ -181,7 +181,6 @@ function collectClientOptions(
181
181
182
182
const features : EnabledFeatures = configuration . get ( "enabledFeatures" ) ! ;
183
183
const enabledFeatures = Object . keys ( features ) . filter ( ( key ) => features [ key ] ) ;
184
- const supportedSchemes = [ "file" , "git" ] ;
185
184
186
185
const fsPath = workspaceFolder . uri . fsPath . replace ( / \/ $ / , "" ) ;
187
186
@@ -191,9 +190,7 @@ function collectClientOptions(
191
190
// 3. Default gems
192
191
let documentSelector : DocumentSelector = SUPPORTED_LANGUAGE_IDS . flatMap (
193
192
( language ) => {
194
- return supportedSchemes . map ( ( scheme ) => {
195
- return { scheme, language, pattern : `${ fsPath } /**/*` } ;
196
- } ) ;
193
+ return { scheme : "file" , language, pattern : `${ fsPath } /**/*` } ;
197
194
} ,
198
195
) ;
199
196
@@ -209,34 +206,32 @@ function collectClientOptions(
209
206
}
210
207
211
208
ruby . gemPath . forEach ( ( gemPath ) => {
212
- supportedSchemes . forEach ( ( scheme ) => {
213
- // On Windows, gem paths may be using backslashes, but those are not valid as a glob pattern. We need to ensure
214
- // that we're using forward slashes for the document selectors
215
- const pathAsGlobPattern = gemPath . replace ( / \\ / g, "/" ) ;
209
+ // On Windows, gem paths may be using backslashes, but those are not valid as a glob pattern. We need to ensure
210
+ // that we're using forward slashes for the document selectors
211
+ const pathAsGlobPattern = gemPath . replace ( / \\ / g, "/" ) ;
212
+
213
+ documentSelector . push ( {
214
+ scheme : "file" ,
215
+ language : "ruby" ,
216
+ pattern : `${ pathAsGlobPattern } /**/*` ,
217
+ } ) ;
216
218
219
+ // Because of how default gems are installed, the gemPath location is actually not exactly where the files are
220
+ // located. With the regex, we are correcting the default gem path from this (where the files are not located)
221
+ // /opt/rubies/3.3.1/lib/ruby/gems/3.3.0
222
+ //
223
+ // to this (where the files are actually stored)
224
+ // /opt/rubies/3.3.1/lib/ruby/3.3.0
225
+ //
226
+ // Notice that we still need to add the regular path to the selector because some version managers will install
227
+ // gems under the non-corrected path
228
+ if ( / l i b \/ r u b y \/ g e m s \/ (? = \d ) / . test ( pathAsGlobPattern ) ) {
217
229
documentSelector . push ( {
218
- scheme,
230
+ scheme : "file" ,
219
231
language : "ruby" ,
220
- pattern : `${ pathAsGlobPattern } /**/*` ,
232
+ pattern : `${ pathAsGlobPattern . replace ( / l i b \/ r u b y \/ g e m s \/ (? = \d ) / , "lib/ruby/" ) } /**/*` ,
221
233
} ) ;
222
-
223
- // Because of how default gems are installed, the gemPath location is actually not exactly where the files are
224
- // located. With the regex, we are correcting the default gem path from this (where the files are not located)
225
- // /opt/rubies/3.3.1/lib/ruby/gems/3.3.0
226
- //
227
- // to this (where the files are actually stored)
228
- // /opt/rubies/3.3.1/lib/ruby/3.3.0
229
- //
230
- // Notice that we still need to add the regular path to the selector because some version managers will install
231
- // gems under the non-corrected path
232
- if ( / l i b \/ r u b y \/ g e m s \/ (? = \d ) / . test ( pathAsGlobPattern ) ) {
233
- documentSelector . push ( {
234
- scheme,
235
- language : "ruby" ,
236
- pattern : `${ pathAsGlobPattern . replace ( / l i b \/ r u b y \/ g e m s \/ (? = \d ) / , "lib/ruby/" ) } /**/*` ,
237
- } ) ;
238
- }
239
- } ) ;
234
+ }
240
235
} ) ;
241
236
242
237
// This is a temporary solution as an escape hatch for users who cannot upgrade the `ruby-lsp` gem to a version that
0 commit comments