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: Display file range correctly #3172

Merged
merged 10 commits into from
Feb 14, 2024
Merged

Chat: Display file range correctly #3172

merged 10 commits into from
Feb 14, 2024

Conversation

abeatrix
Copy link
Contributor

@abeatrix abeatrix commented Feb 14, 2024

CLOSE: #3110

Updated code to display document range correctly in chat view.

This commit updates the code to correctly handle the selection range.

  • In chat-helpers.ts, the code now opens the text document before setting the selection range.
  • In FileLink.tsx, the code now adjusts the line numbers in the selection range to account for the difference between the range starting at 0 and the editor line numbers starting at 1.
  • Updated e2e tests to display the correct line numbers

Test plan

All changes are covered by the updated e2e tests.

After

1-15 is used and shows up as 1-15

image

clicking on 1-15 highlights 1-15 in the document

image

Before

1-15 is used but showing up as 1-13
image

clicking one 1-13 link highlights 1-14 in the document
image

await expect(
chatPanel.getByRole('button', { name: withPlatformSlashes('@lib/batches/env/var.go:1-0') })
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this shows the line numbers were not handled correctly.

@abeatrix abeatrix requested a review from a team February 14, 2024 20:08
@abeatrix abeatrix merged commit 3972bf8 into main Feb 14, 2024
17 checks passed
@abeatrix abeatrix deleted the bee/fix-line-number branch February 14, 2024 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants