-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: ensure all paths use uppercase drive letter #587
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -45,7 +46,7 @@ export async function installPlaywright(vscode: vscodeTypes.VSCode) { | |||
|
|||
const terminal = vscode.window.createTerminal({ | |||
name: 'Install Playwright', | |||
cwd: workspaceFolder.uri.fsPath, | |||
cwd: uriToPath(workspaceFolder.uri), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noting an example of VSCode API that accepts string.
const watcher = this._vscode.workspace.createFileSystemWatcher(folder.replaceAll(path.sep, '/') + '/**'); | ||
// Make sure to use lowercase drive letter in the pattern. | ||
// eslint-disable-next-line no-restricted-properties | ||
const watcher = this._vscode.workspace.createFileSystemWatcher(this._vscode.Uri.file(folder).fsPath.replaceAll(path.sep, '/') + '/**'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another API that takes string!
VSCode expects lowercase drive letter, while Playwright expects uppercase drive letter. To properly test this, update vscode mock to match vscode proper, which reveals a few failing tests: - watch fails because it tries to watch lowercase paths in Playwright; - errors through diagnostics fail because they update with both lowercase and uppercase paths.
To achieve this and avoid future issues with path casing mismatch: - internally, use Playwright-style uppercase drive letter paths; - when interacting with VSCode through uri, either use `uriToPath(uri)` or `vscode.Uri.file(path)`; - ban `Uri.fsPath` so that we never use VSCode-style lowercase paths.
2782556
to
5493a7e
Compare
pavelfeldman
approved these changes
Jan 10, 2025
This was referenced Jan 10, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
VSCode expects lowercase drive letter, while Playwright expects uppercase drive letter. This introduces bugs where we accidentally use two different casings for paths.
To achieve this and avoid future issues with path casing mismatch:
uriToPath(uri)
orvscode.Uri.file(path)
;Uri.fsPath
so that we never use VSCode-style lowercase paths.This change superseedes #584.
Fixes microsoft/playwright#34146.
Fixes microsoft/playwright#33671.