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 duplicated Fix with Assistant code actions #22911

Merged
merged 1 commit into from
Jan 9, 2025

Conversation

maxdeviant
Copy link
Member

This PR fixes the duplicated Fix with Assistant code actions that were being shown in the code actions menu.

This fix isn't 100% ideal, as there is an edge case in buffers that are already open when the workspace loads, as we may not observe the feature flags in time to register the code action providers by the time we receive the event that an item was added to the workspace.

Closes #22400.

Release Notes:

  • Fixed duplicate "Fix with Assistant" entries showing in the code action list.

@maxdeviant maxdeviant self-assigned this Jan 9, 2025
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Jan 9, 2025
@maxdeviant maxdeviant enabled auto-merge January 9, 2025 19:12
@maxdeviant maxdeviant added this pull request to the merge queue Jan 9, 2025
Merged via the queue into main with commit 2143608 Jan 9, 2025
13 checks passed
@maxdeviant maxdeviant deleted the marshall/fix-duplicated-fix-with-assistant branch January 9, 2025 19:43
github-merge-queue bot pushed a commit that referenced this pull request Jan 13, 2025
This PR is a follow-up to
#22911 to further improve the
registration of code action providers for the Assistant in order to
prevent duplicates.

The `CodeActionProvider` trait now has an `id` method that is used to
return a unique ID for a code action provider. We use this to prevent
registering duplicates of the same provider.

The registration of the code action providers for Assistant1 and
Assistant2 have also been reworked. Previously we were not call the
registration function—and thus setting up the subscriptions—until we
resolved the feature flags. However, this could lead to the registration
happening too late for existing workspace items.

We now perform the registration right away and then remove the undesired
code action providers once the feature flags have been resolved.

Release Notes:

- N/A
@SomeoneToIgnore
Copy link
Contributor

/cherry-pick v0.169.x

gcp-cherry-pick-bot bot pushed a commit that referenced this pull request Jan 14, 2025
This PR fixes the duplicated `Fix with Assistant` code actions that were
being shown in the code actions menu.

This fix isn't 100% ideal, as there is an edge case in buffers that are
already open when the workspace loads, as we may not observe the feature
flags in time to register the code action providers by the time we
receive the event that an item was added to the workspace.

Closes #22400.

Release Notes:

- Fixed duplicate "Fix with Assistant" entries showing in the code
action list.
SomeoneToIgnore pushed a commit that referenced this pull request Jan 14, 2025
…#23118)

Cherry-picked Fix duplicated `Fix with Assistant` code actions (#22911)

This PR fixes the duplicated `Fix with Assistant` code actions that were
being shown in the code actions menu.

This fix isn't 100% ideal, as there is an edge case in buffers that are
already open when the workspace loads, as we may not observe the feature
flags in time to register the code action providers by the time we
receive the event that an item was added to the workspace.

Closes #22400.

Release Notes:

- Fixed duplicate "Fix with Assistant" entries showing in the code
action list.

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
gcp-cherry-pick-bot bot pushed a commit that referenced this pull request Jan 14, 2025
This PR is a follow-up to
#22911 to further improve the
registration of code action providers for the Assistant in order to
prevent duplicates.

The `CodeActionProvider` trait now has an `id` method that is used to
return a unique ID for a code action provider. We use this to prevent
registering duplicates of the same provider.

The registration of the code action providers for Assistant1 and
Assistant2 have also been reworked. Previously we were not call the
registration function—and thus setting up the subscriptions—until we
resolved the feature flags. However, this could lead to the registration
happening too late for existing workspace items.

We now perform the registration right away and then remove the undesired
code action providers once the feature flags have been resolved.

Release Notes:

- N/A
SomeoneToIgnore pushed a commit that referenced this pull request Jan 14, 2025
…23099) (#23136)

Cherry-picked Improve registration for Assistant code action providers
(#23099)

This PR is a follow-up to
#22911 to further improve the
registration of code action providers for the Assistant in order to
prevent duplicates.

The `CodeActionProvider` trait now has an `id` method that is used to
return a unique ID for a code action provider. We use this to prevent
registering duplicates of the same provider.

The registration of the code action providers for Assistant1 and
Assistant2 have also been reworked. Previously we were not call the
registration function—and thus setting up the subscriptions—until we
resolved the feature flags. However, this could lead to the registration
happening too late for existing workspace items.

We now perform the registration right away and then remove the undesired
code action providers once the feature flags have been resolved.

Release Notes:

- N/A

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Duplicate "fix with assistant" code action
2 participants