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

Cody: Fix inline-assist files behavior on fixup #52014

Merged
merged 3 commits into from
May 17, 2023
Merged

Conversation

abeatrix
Copy link
Contributor

@abeatrix abeatrix commented May 16, 2023

Close: #51993

Issue

When starting a fixup task from Cody Inline Assist with multiple files open in the editor, each open file will get a new code lens and the fixup replacement will be performed in the file that the user last focused on.

Causes

  • During the fixup step, we are calling the active editor with vscode.window.activeTextEditor which could include editors that have other files opened without the original comment thread where we call the fixup job
  • Code lenses are generated on all open files and it gets called everytime we make changes to a text document (any text document)
PR_.Cody.Inline.Assist.files.behavior.on.fixup.-.issue.mp4

Solution

Here are the changes introduced in this PR as potential solutions:

  • Activate code lenses on files that match the filePath from the comment thread: e.document.uri.fsPath !== this.thread?.uri.fsPath
  • Get editor info using the file path of the file that we called fixup from
PR_.Cody.Inline.Assist.files.behavior.on.fixup.-.fix.mp4

Test plan

Run debug and start extension locally:

  • open two different files side by side in your editor and start a fixup job in one of them

Expected Behavior:

  • Only the file where you call the fixup job from will be updated accordingly

Detailed see loom here or the attached video above

@cla-bot cla-bot bot added the cla-signed label May 16, 2023
@abeatrix abeatrix requested a review from a team May 16, 2023 21:53
@abeatrix abeatrix marked this pull request as ready for review May 16, 2023 21:53
@sourcegraph-bot
Copy link
Contributor

📖 Storybook live preview

Copy link
Contributor

@philipp-spiess philipp-spiess left a comment

Choose a reason for hiding this comment

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

Looks reasonable to me!

@abeatrix abeatrix merged commit 304e8c2 into main May 17, 2023
31 of 32 checks passed
@abeatrix abeatrix deleted the bee/cody-inline-fix branch May 17, 2023 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cody Bug: Inline Assist runs fixup in a different file
3 participants