Prefer extending import code actions#4851
Merged
Merged
Conversation
Contributor
Author
|
Btw: the definition |
fendor
approved these changes
Feb 24, 2026
fendor
left a comment
Collaborator
There was a problem hiding this comment.
LGTM, thank you for your contribution!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4750.
Before this PR:
After this PR:
The PR achieves this by setting isPreferred for the corresponding code actions. I do not find this a completely satisfactory solutions, since ideally we should order the code actions according to a prioritization ("Add … to the import list …" should imo appear before more generic import list changes which should appear before "Replace with …" which should appear before "Define …").
On the other hand the LSP Spec afaik does not specify that clients should show the code actions according to the order given by the lsp server (And at least my emacs config does not seem to care about the servers order, in fact it does not even care about the "isPreferred" setting).