Skip to content
This repository was archived by the owner on Nov 18, 2022. It is now read-only.

Commit cc57521

Browse files
authored
Merge pull request #774 from rust-lang/fix-patterns-yet-again
Fix document selectors in remote scenarios
2 parents 08a2719 + d25658f commit cc57521

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/extension.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
ExtensionContext,
99
IndentAction,
1010
languages,
11-
RelativePattern,
1211
TextEditor,
1312
Uri,
1413
window,
@@ -212,14 +211,10 @@ class ClientWorkspace {
212211
return this.makeRlsProcess();
213212
};
214213

215-
// FIXME: vscode-languageserver-node internally uses `pattern` here as
216-
// `vscode.GlobPattern` but only types it out as `string` type. We use
217-
// `RelativePattern` to reliably match files relative to a workspace folder
218-
// in a way that's supported in a cross-platform fashion.
219-
const pattern = (new RelativePattern(
220-
this.folder,
221-
'**',
222-
) as unknown) as string;
214+
// This accepts `vscode.GlobPattern` under the hood, which requires only
215+
// forward slashes. It's worth mentioning that RelativePattern does *NOT*
216+
// work in remote scenarios (?), so rely on normalized fs path from VSCode URIs.
217+
const pattern = `${this.folder.uri.fsPath.replace(path.sep, '/')}/**`;
223218

224219
const clientOptions: LanguageClientOptions = {
225220
// Register the server for Rust files

0 commit comments

Comments
 (0)