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

Only search relative paths when @-mentioning files in chat #2241

Merged
merged 3 commits into from
Dec 11, 2023

Conversation

DanTup
Copy link
Contributor

@DanTup DanTup commented Dec 10, 2023

[This depends on a function added in https://github.com//pull/2215 so this will fail bots until that lands and I rebase/merge]

Fixes #2208

Test plan

  • Run pnpm test:e2e at-file to run the updated test, or
  • Open chat, and mention a file using @ but type part of the file path outside of the folder opened in VS Code (eg. if you have C:\Source\cody\ open, type source`)
  • Ensure that the results don't list every file because source exists in their full fspaths

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.

Looks good!


// We should only match the relative visible path, not parts of the full path outside of the workspace.
// Eg. searching for "source" should not find all files if the project is inside `C:\Source`.
await chatInput.fill('@fixtures') // fixture is in the test project folder name, but in the relative paths.
Copy link
Contributor

Choose a reason for hiding this comment

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

Once #2235 lands, you can make this more robust by adding workspaceDirectory alongside page, sidebar and get the path to the workspace directory. That will let you assert that fixtures really is in that path and remains that way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh yeah, good point. I've added a TODO about that. If you're planning to land that soon I can wait and fix it up here, or if you think I should land this as-is and fix later, let me know.

I've rebased this on main after merging #2208 so I think this should all be green now.

@DanTup DanTup force-pushed the dantup/fix-at-file-search-relative branch from eb27c16 to c44f623 Compare December 10, 2023 21:41
@DanTup
Copy link
Contributor Author

DanTup commented Dec 10, 2023

Hmm, there's something odd going on now. With this change, .vscode\settings.json shows up in the search results for @vgo (it has no g!), which results in the test selecting the wrong item - but that also results in and @vg being duplicated on the end:

fail.mp4

This is reliably reproducible for me, and feels like two bugs (non-matched items in the results, and the duplicated text). I might not get chance to look into this before Friday now, so if this is important and anyone else has time, feel free to take a look!

@DanTup
Copy link
Contributor Author

DanTup commented Dec 10, 2023

it has no g!

lol, it very much as a g 😄 I'll update the test and file another bug about the duplication (which seems to occur only when you select a file that's already listed).

@DanTup
Copy link
Contributor Author

DanTup commented Dec 10, 2023

I've filed #2243 about the bug.

@dominiccooney heading off, but if you're happy with this as-is and the last bots go green feel free to merge :)

@dominiccooney dominiccooney merged commit 9e0651e into main Dec 11, 2023
14 checks passed
@dominiccooney dominiccooney deleted the dantup/fix-at-file-search-relative branch December 11, 2023 13:39
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: file context search searches full paths
2 participants