-
Notifications
You must be signed in to change notification settings - Fork 324
Add a prompt for Extract local variable #4749
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
Comments
The way this was implemented (prompting for a name like Extract Method) has resulted in losing the server-generated name and I think that's made this much worse. I'm going to revert this for now, and try to find a better way to rename (such as triggering the rename automatically if it's possible). Issue tracking the revert is #4786, and I'll re-open this to track a new solution. |
Also, why when I do this: @override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(),
),
);
} I can't extract |
@lsaudon I'm not sure - could you file a new issue about that with exact instructions of what you're selecting and invoking? Thanks! |
I believe this is still outstanding and worthwhile, is there a reason you closed it @lsaudon ? |
I've closed it because I can no longer reproduce the problem I had. @override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(),
),
);
}
// to
@override
Widget build(BuildContext context) {
final appBar2 = AppBar();
return MaterialApp(
home: Scaffold(
appBar: appBar2,
),
);
} I can no longer reproduce it. |
@lsaudon what do you see now? |
@override
Widget build(BuildContext context) {
final appBar = AppBar();
return MaterialApp(
home: Scaffold(
appBar: appBar,
),
);
} |
Oh, was your complaint that it was generating a bad variable name, rather than not prompting for it in advance? I would like to automatically trigger rename after generating, but there's no great way to do this right now within standard LSP. |
Yes |
Gotcha, thanks. In that case I'll re-close this, and we can hope to fix it by triggering the rename functionality directly after the refactor if VS Code/LSP get that capability. |
Is your feature request related to a problem? Please describe.
I'd like to see a prompt for
Extract local variable
as well as forExtract method
.Describe the solution you'd like
Add a prompt after select
Extract local variable
.Describe alternatives you've considered
After extract, trigger
Rename symbol
vscode.The text was updated successfully, but these errors were encountered: