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

Commit d25658f

Browse files
committed
Fix document selectors in remote scenarios
1 parent 8555126 commit d25658f

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,
@@ -193,14 +192,10 @@ class ClientWorkspace {
193192
return this.makeRlsProcess();
194193
};
195194

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

205200
const clientOptions: LanguageClientOptions = {
206201
// Register the server for Rust files

0 commit comments

Comments
 (0)