Skip to content
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

Handle context file searching using forward slashes on Windows #2215

Merged
merged 9 commits into from
Dec 10, 2023

Conversation

DanTup
Copy link
Contributor

@DanTup DanTup commented Dec 8, 2023

Fixes #2198

Test plan

  • Run pnpm test:e2e at-file to run updated test, or:
  • On Windows, open chat and try to attach a file in chat using backslashes and forward slashes for searching filenames

@kalanchan kalanchan requested review from a team and dominiccooney December 9, 2023 03:44
@kalanchan
Copy link
Contributor

@dominiccooney another windows PR for ya :)

@DanTup
Copy link
Contributor Author

DanTup commented Dec 10, 2023

I've opened #2241 too - not Windows specific, but depends on a function added in this PR to work. I'll rebase/merge that one after this lands (GitHub doesn't have a great way to do dependent PRs :-))

Copy link
Contributor

@dominiccooney dominiccooney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful.

Given your great comments I suggest we can simplify these conditionals to always replace / with the platform separator for a slight readability win.

If there were other Windows adaptations we were putting in those conditional blocks I would feel better about keeping the conditional blocks around.

vscode/src/editor/utils/editor-context.ts Outdated Show resolved Hide resolved
Comment on lines 195 to 198
if (path.sep === path.win32.sep) {
relativePath = relativePath.replaceAll(path.posix.sep, path.win32.sep)
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (path.sep === path.win32.sep) {
relativePath = relativePath.replaceAll(path.posix.sep, path.win32.sep)
}
relativePath = relativePath.replaceAll(path.posix.sep, path.sep)

vscode/test/e2e/at-file-context-selecting.test.ts Outdated Show resolved Hide resolved
DanTup and others added 4 commits December 10, 2023 21:13
Co-authored-by: Dominic Cooney <dominic.cooney@sourcegraph.com>
Co-authored-by: Dominic Cooney <dominic.cooney@sourcegraph.com>
@DanTup DanTup merged commit 59c4382 into main Dec 10, 2023
14 checks passed
@DanTup DanTup deleted the dantup/better-slashes-for-context-files branch December 10, 2023 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: VSCode Windows @-mention selector shows /, makes me type \
3 participants