Fix duplication of query when selecting a context file that already exists earlier in the input #2474
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.
The code here appeared to try to preserve suffixes after the filename, but we appear to only support selecting files at the end of the input anyway. By assuming the index of "fileDisplayText" in the input was the one that the user expected to replace, an input like:
Would assume the first
@foo.txt
is being replaced, and retain@fo
(actually duplicating it).Removing this suffix fixes the issue and as far as I can tell does not break any other functionality. The issue described in #1973 still appears to work as expected with this change.
Fixes #2243:
fix1.mp4
#1973 is still fixed:
still_fixed.mp4
@abeatrix Please take a look, because this partially reverts your changes from #1980. If you think there are cases that this is breaking, let me know and I will add tests and try to fix another way.
Test plan
pnpm test:e2e at-file
to run the updated test?
and ensure it's still used as a context file (second video above)