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

intellisense for code actions on save #215475

Merged
merged 5 commits into from
Jun 24, 2024
Merged

Conversation

justschen
Copy link
Contributor

@justschen justschen commented Jun 13, 2024

fixes #161284
related #212381

issue: no intellisense because of how we get contributed or default code actions on save
https://github.com/justschen/vscode/blob/a6bda062d6a861071758ded8abc781af37a083e2/src/vs/workbench/contrib/codeActions/common/codeActionsExtensionPoint.ts#L69

atm, we only search contributions if they statically contribute code actions (ie, https://github.com/justschen/vscode/blob/a6bda062d6a861071758ded8abc781af37a083e2/extensions/typescript-language-features/package.json#L1608-L1609)

this allows us to gather ALL code actions that are contributed, sorts by source actions, dynamically adds

demo with ruff and eslint installed:
Screenshot 2024-06-13 at 2 35 09 PM
Screenshot 2024-06-13 at 2 34 54 PM

cc. @Yoyokrazy

@justschen justschen changed the title language registry and code actions on save new filter intellisense for code actions on save Jun 13, 2024
@justschen
Copy link
Contributor Author

Also as part of documentation, we could maybe note that if there are two of source actions of the same type, but one is a subset of another, only the larger subset would be honored (wording and terms can be better)

ie:

"editor.codeActionsOnSave": {
       "source.fixAll": "explicit",
       "source.fixAll.eslint": "never"

in this case, source.fixAll will override source.fixAll.eslint.

@justschen justschen requested a review from mjbvz June 13, 2024 23:10
Copy link
Collaborator

@mjbvz mjbvz left a comment

Choose a reason for hiding this comment

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

looks good! I think you should also remove the static contribution tho. This was a proposal that I never actually finalized

One other thing to be aware of is that this intellisense will only pick up code actions for active languages. This at least ensures that only valid source actions are shown, but could also confuse users if they try configuring the setting without activating the language extension first (that's what the static contribution was trying to solve)

You could potentially solve this by caching the source actions for each extension across restarts. May be worth tracking in a new issue

@justschen justschen marked this pull request as ready for review June 17, 2024 19:25
@VSCodeTriageBot VSCodeTriageBot added this to the June 2024 milestone Jun 17, 2024
@justschen justschen enabled auto-merge (squash) June 24, 2024 22:06
@justschen justschen merged commit b7ff4c5 into microsoft:main Jun 24, 2024
6 checks passed
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.

Provide better completion for editor.codeActionsOnSave
3 participants