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
Implement "Extract type alias" assist #8210
Conversation
This allows one snippet per TextEdit, multiple in the same TextEdit are still broken
builder.replace_snippet(cap, target, "${0:Type}"); | ||
builder.insert_snippet( | ||
cap, | ||
insert, | ||
format!("type ${{0:Type}} = {};\n\n", node), | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔
Three separate thoughts:
- the snippet's
${0}
feels like a wrong tool here: it can't express the fact that the second position should be focused (primary). - Our "extract variable" works differently as well, it just foceses the new name (so that it's possible to rename it later)
- I've noticed that type-script applies rename automatically. I think they just set the
command
to rename?
So, let's implement the same logic as extract variable now, and then add something like
/**
* A command this code action executes. If a code action
* provides an edit and a command, first the edit is
* executed and then the command.
*/
command?: Command;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see, that does seem better!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll implement this part later
bors r+ |
changelog feature |
No description provided.