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

Chat: support line numbers in at-files #3174

Merged
merged 17 commits into from
Feb 21, 2024
Merged

Chat: support line numbers in at-files #3174

merged 17 commits into from
Feb 21, 2024

Conversation

abeatrix
Copy link
Contributor

@abeatrix abeatrix commented Feb 14, 2024

feat: enable users to add line number to @-file queries

image

atLines

demoo

Key changes:

  • Extract input parsing logic into new inputParser.ts file. The module parses line numbers after file names in the input string. It sets the parsed range on the context file objects.
  • Remove separate display text generation logic for selections. Instead always pass file range to create markdown links. This allows links to point directly to user-provided line number context when available.
  • Covered by unit tests.

These changes enable users to add line number context to their @-mentioned queries by appending ':line-range' after file names. The line range will be parsed and used to generate more precise code links.

Test plan

Screen.Recording.2024-02-14.at.2.59.31.PM.mov

After

image

Loom: https://www.loom.com/share/28cadce2a91f4e5892d3ee3a7b6f82dc

On Edit:

Screen.Recording.2024-02-20.at.12.05.51.PM.mov

Before

image

Next

Implement this with the default chat commands.

@abeatrix abeatrix requested review from toolmantim and a team February 15, 2024 00:19
Copy link
Contributor

@toolmantim toolmantim left a comment

Choose a reason for hiding this comment

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

Nice! This gets us the building block we need for making commands explicitly show the selected lines.

A few bugs:

  • It seems to break if you click on items in the popover, vs hitting enter with the keyboard
  • If you use the up arrow to load the last message input doesn't seem to attach @-mentioned files either.

To make the experience for manually typing it in better… it would be good to not have the popover disappear, as it makes it feel like it's not going to work. Can we keep it open, and show some 50% opacity helper text as they type?

CleanShot.2024-02-15.at.21.52.42@2x.mp4

@abeatrix
Copy link
Contributor Author

@toolmantim I can't reproduce the first issue you mentioned. Can you try the latest commit and see if it's still broken for you?

Screen.Recording.2024-02-15.at.8.35.21.AM.mov
  • [] It seems to break if you click on items in the popover, vs hitting enter with the keyboard
  • If you use the up arrow to load the last message input doesn't seem to attach @-mentioned files either.
  • Added the helper:

demoo

@abeatrix
Copy link
Contributor Author

@toolmantim I've updated the PR to support single line range:

Screen.Recording.2024-02-20.at.12.05.51.PM.mov

We can merge this after tomorrow release if we want to polish this more

Copy link
Contributor

@toolmantim toolmantim left a comment

Choose a reason for hiding this comment

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

👏🏼

@abeatrix abeatrix merged commit 26e34f6 into main Feb 21, 2024
16 checks passed
@abeatrix abeatrix deleted the bee/support-at-line branch February 21, 2024 22:47
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.

None yet

2 participants