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

Fix duplication of query when selecting a context file that already exists earlier in the input #2474

Merged
merged 4 commits into from
Jan 5, 2024

Conversation

DanTup
Copy link
Contributor

@DanTup DanTup commented Dec 22, 2023

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:

@foo.txt @fo

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

  • Run pnpm test:e2e at-file to run the updated test
  • Open chat and try to mention a file a second time without typing the fill name (as shown in the first video above)
  • Open chat, complete a filename, then backspace over the added trailing space and replace it with a ? and ensure it's still used as a context file (second video above)

…xists

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:

```
@foo.txt @fo
```

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.
Copy link
Contributor

@abeatrix abeatrix left a comment

Choose a reason for hiding this comment

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

I can't remember what was the reason I added the suffix but i just tried it on your branch and confirmed what described in the old issue is not an issue anymore even after your change 👍

Thanks for adding the test as well!

@DanTup DanTup merged commit 856ce3c into main Jan 5, 2024
16 checks passed
@DanTup DanTup deleted the dantup/fix-duplicated-query branch January 5, 2024 13:00
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: Selecting a file already included in chat @-mention leaves search query appended
2 participants