-
Notifications
You must be signed in to change notification settings - Fork 3.9k
fix: lsTool path management and improve workspace file resolution #8985
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
base: main
Are you sure you want to change the base?
Changes from all commits
19f0815
de930a7
931d455
9a7d15b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,11 +18,11 @@ export interface ResolvedPath { | |
| */ | ||
| async function isUriWithinWorkspace(ide: IDE, uri: string): Promise<boolean> { | ||
| const workspaceDirs = await ide.getWorkspaceDirs(); | ||
| const { foundInDir } = findUriInDirs(uri, workspaceDirs); | ||
| const { foundInDir, uri: foundUri } = findUriInDirs(uri, workspaceDirs); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be unnecessary, foundUri and original uri should be the same
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, my bad, I didn't go deeper looking at the implementation of |
||
|
|
||
| // Check both: within workspace path AND file exists | ||
| // Check both: within workspace path AND resolved file exists | ||
| if (foundInDir !== null) { | ||
| return await ide.fileExists(uri); | ||
| return await ide.fileExists(foundUri); | ||
| } | ||
|
|
||
| return false; | ||
|
|
||
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.
Why remove these tests? Should we only remove the ones checking for empty path?
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.
The input path is now only processed through
resolveInputPath(core/tools/implementations/lsTool.ts:18 in this PR); therefore I had to remove the tests because the function itself is no longer existing. This does not mean at all those tests were unnecessary and shouldn't be brought back; in fact I discovered this bug trying to use SpecKit (which hosts scripts inside a .speckit folder) and Continue was madly looping unable to read files that were in fact there. Basically I'd love to bring back the old tests + tests for files and folders starting with a . (e,g, .env, .git).Is it better to test for those cases while testing
resolveInputPathalone or do we want to have a separate function evaluating ls input path to be able to bring back these tests?In the original path parsing function (
resolveLsToolDirPath- core/tools/implementations/lsTool.ts:8 in this PR):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.
Ah, thanks for explaining. The simple reason is that "." doesn't work with our file reading and listing IDE utils, they require URIs, so we assume "." means relative. So you're right that it's a bug. I think the fix is that "." and "./" paths should resolve relative to the workspace URI root (first workspace if there are multiple)