Adopt code actions ranges for refactorings in TS
justschen opened this issue ยท 4 comments
see API proposal here: microsoft/vscode#199608
vs code tracking: microsoft/vscode#204040
The API was made since often times in refactorings such as with extract
or move too...
it's not always clear what part of code or what part of the file the actions will apply to. By allowing contributed Code Actions to provide one or more ranges (Range[]
), the range will be highlighted to show the user what will be changed.
All we need to provide is a Range[]
of affected code. For refactorings, this range would be the code in the current file that will be effected by the refactoring.
Hey @justschen can I pick this one?? Would be a great start for me to learn and start my first contribution to the project.
@RyanCavanaugh @navya9singh heads up I've done some work on the vs code / extension side for quick fixes already microsoft/vscode#204191. If you have questions about API usage lmk ๐
@justschen thanks for the update! For refactorings, do you want the ApplicableRefactorInfo
api to have another parameter for range?: Range[]
in the protocol?
I looked through what Range
looks like on the vscode side, and it seems that it has more information other than start
and end
. Is that something that is needed on the TS side as well?
@mjbvz
@navya9singh for the purposes of the highlights, we use startLine
, startCharacter
, endLine
, and endCharacter
since we convert it to the vscode IRange
type to be used in the editor. everything else won't be checked/used so likely won't have to implement those ๐