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?
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
As per below document, I don't see those options available as yet in VSCode plugin. https://dartcode.org/docs/refactorings-and-code-fixes/
Highlight property or class name and use F2
to rename.
If refactoring in Flutter/Dart is not working, try disabling other extensions. Sometimes another extension can interfere with refactoring using Flutter/Dart extensions. At least it did in my case.
重新安装 VS 代码是我案例的最佳解决方案......
First select the code you want to rename and Refactor, then press F2 to rename after that just press Shift + Enter to refactor you can see your Refactor View here
then just press Apply
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.