vscode: vscode.workspace.findFiles and WorkspaceFolder.uri inconsistency regarding Windows driver letter

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version:
Version: 1.82.2
Commit: abd2f3db4bdb28f9e95536dfa84d8479f1eb312d
Date: 2023-09-14T05:51:20.981Z
Electron: 25.8.1
ElectronBuildId: 23779380
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Linux x64 5.19.0-46-generic
  • OS Version:
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.3 LTS"
PRETTY_NAME="Ubuntu 22.04.3 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.3 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
UBUNTU_CODENAME=jammy

Steps to Reproduce:

Calling .path on WorkspaceFolder.uri returns the Windows drive letter “as is” (in my case, the drive letter is uppercase). For instance:

console.log(vscode.workspace.workspaceFolders[0].uri.path) 
// /D:/a/asciidoctor-vscode/asciidoctor-vscode/test-workspace

However, vscode.workspace.findFiles returns a list of URI with the Windows drive letter as lowercase. For instance:

console.log((await vscode.workspace.findFiles('**/antora.yml')).map((uri) => uri.path).join(', ')) 
// /d:/a/asciidoctor-vscode/asciidoctor-vscode/test-workspace/antora.yml
// /d:/a/asciidoctor-vscode/asciidoctor-vscode/test-workspace/cli/antora.yml

Windows is case-insensitive but I think it would be better to return normalized URIs (or at least return a consistent value across APIs)

About this issue

  • Original URL
  • State: closed
  • Created 9 months ago
  • Comments: 15 (5 by maintainers)

Commits related to this issue

Most upvoted comments

@andreamah I believe this is the bug

https://github.com/microsoft/vscode/blob/d77b83519912be96325dcc12f7d681427a804dc9/src/vs/workbench/services/search/node/ripgrepTextSearchEngine.ts#L43

The cwd variable is used as rootFolder when creating RipgrepParser. Because it is created via fsPath the drive letter is lower-cased. This shouldn’t be done. The simplest is to create the parser with the URI and to use URI#joinPath to create the resulting uri values here and here