You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Let code actions highlight a range of code they apply to #199608
For refactoring such as extract method or move to file, it's not always clear which code the action will apply to. This is especially true for languages like TS that try to intelligently expand the user's current selection
Proposal
Let code actions provide one (or potentially many) ranges that they will apply to. This range can then be highlighted as the user arrows through the code action list
For refactorings, this range would be the code in the current file that will be effected by the refactoring
For quick fixes, this range could be the range of the diagnostics that will be fixed (or we could just highlight the diagnostics directly since code actions already provide this info in CodeAction.diagnostics)
I like this actually (so it'll be kind of similar to the nearby quick fixes menu which highlights when not on specific code).
some smol thoughts related to the ui:
In some cases, the user is already highlighting what will be extracted, or moved, etc. so it might be a second highlight on top of that (in a diff color to differentiate what is user selected, and what is contributed by the code action to be change)
often times the quick fix menu, refactor menu, or menu from the lightbulb widget will block the highlighted code - maybe find a good workaround and move where it renders so we can actually see what is highlighted
highlights needs to explore:
Pick a forever theme color for the quick fix highlight and allow styling both background and borders
declare module 'vscode'{exportinterfaceCodeAction{/** * * The range to which this Code Action applies to, which will be highlighted. * * Ex: A refactoring action will highlight the range of text that will be affected. */ranges?: Range[];}}
Activity
mjbvz commentedon Nov 29, 2023
/cc Maria Solano (@MariaSolOs)
justschen commentedon Nov 29, 2023
I like this actually (so it'll be kind of similar to the nearby quick fixes menu which highlights when not on specific code).
some smol thoughts related to the ui:
highlights needs to explore:
tjx666 commentedon Jan 6, 2024
Also, please consider provide a way to highlight the added code like:
https://github.com/p42ai/js-assistant
2024-01-06.10.58.18.mov
justschen commentedon Jan 18, 2024
shape of the API atm:
RedCMD commentedon Jan 18, 2024
could something similar be added to
[F2] Rename?