I just started working with flutter and I am unable to refactor dart/flutter in VSCode.
I am running VSCode on MacOSX and installed VSCode as per the flutter documentation, installed the dart and flutter plugins. flutter doctor shows no issues.
The app I am creating runs fine on simulator and devices.
When trying to rename a property, using the refactor shortcut, no option to rename is available. When trying to rename a class, I get 'No refactorings available'
I can't believe this kind of refactoring would not be available.
What am I missing in my setup? Any suggestions on what I can check, change in VSCode?
Code Actions = Quick Fixes and refactoringsClicking on the Code Action lightbulb or using the Quick Fix command Ctrl+. will display Quick Fixes and refactorings. If you'd just like to see refactorings without Quick Fixes, you can use the Refactor command (Ctrl+Shift+R).
Ctrl + . in Code opens the “lightbulb” menu showing all code fixes/refactors.
To run a Dart console application: Install the Code Runner Extension. Open the Dart code file in Text Editor, then use shortcut Ctrl+Alt+N , or right click the Text Editor and then click Run Code in context menu, the Dart console application will run and the output will be shown in the Output Window.
Visual Studio provides several tools to help you write, edit, and refactor your code.
If you mean refactorings like Wrap with Container
, press Ctrl+.
Earlier button called "Refactor" in context menu was available, but it isn't now, and Ctrl+Shift+R
doesn't help. So you can use my advice.
Also reinstalling VSCode helped me to get back the "Refactor" button to the context menu
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With