SolvedDart Code Implement refactor: Move file

Blocked on microsoft/vscode#43768 being finalised.

Update: The VS Code API works, however despite supporting multiple files, it is only ever fired once-per-file concurrently. This results in multiple MOVE_FILE calls to the analysis server, which currently only supports one refactor at a time (a new refactor cancels the previous).

The implement this reasonably (and without causing a potentially-large number of sequential requests to the server) we need to either have the server support multiple files, or do more work on the server (eg. via LSP).

33 Answers

✔️Accepted Answer

The work is mostly done here, but it requires a VS Code feature that is currently part of the provisional API. In order to ship this, we need it to be moved to the stable API.

The relevant issue is microsoft/vscode#43768. I'll ping again to see if there's any update.

Other Answers:

Ok, going to ship this behind a flag for vNext (dart.previewUpdateImportsOnRename):


It only works for single-files and no folders, but that's probably better than nothing. When the VS Code issue is fixed, I think we can support multiple files, though it may be slow for large numbers (due to lots of round trips to the server). Supporting multiple files quickly and/or folders will probably be best done in the server along with LSP once it gets the API.

I've opened some extra issues to track the other work:

  • #2482 - remove preview flag
  • #2483 - support multiple files

There's a beta build here if you'd like to try it out:

Download the .vsix file, then run Extensions: Install from VSIX from the VS Code command palette and select the file.

Then set "dart.previewUpdateImportsOnRename": true in your VS Code settings and restart.

If you have VS Code set to auto-update extensions, when this version is released stable, you'll automatically be updated, so you don't need to worry about uninstalling (unless something is broken - but please file issues if it is!).

Sorry, the work on this somewhat stalled due to other priorities and not many people asking for this. I think the work in the server supports renaming files, just not folders. It might be possible to wire just that bit up - I'll try and take a look soon.

Related Issues:

Dart Code Dart code stuck on "Analyzing", making every operation take too long
I battled with this for a few hours In case anyone else is battling with this After upgrading to Dar...
Dart Code Support --flavor argument in the debugger
Ok I think maybe the existing args already supports this I just set my launch.json like this: When I...
Dart Code Implement refactor: Move file
The work is mostly done here but it requires a VS Code feature that is currently part of the provisi...
Dart Code Closing Labels feedback
@brettpappas You can actually control the colour using workbench colour cusomisations! Add this to y...
flutter Multiple commands produce '/build/ios/Debug-iphonesimulator/
I was able to fix it by opening the Runner workspace project in Xcode 10 Then navigate to File ...
flutter App Store iOS submission fails: The bundle does not support the minimum OS Version specified in the Info.plist
After doing a flutter clean changing MinimumOSVersion (inside /ios/Flutter/AppframeworkInfo.plist) t...
flutter '' has different version for the compile (26.1.0) and runtime (27.0.1) classpath
is like this i receive an error when i run flutter run My file is: flutter doctor: ...
flutter Why does my text not wrap?
You have to wrap Column in a flexible Without flexible the column's width is not constrained to the ...
flutter Unexpected top padding in ListView put inside scaffold with no appBar
Yeah this is intentional If you put a widget before the ListView you should wrap the ListView with a...
flutterfire [firebase_core_web , firebase_auth_web, cloud_firestore_web ] Plugin project :firebase_auth_web not found. Please update settings.gradle.
Hi @gsusI Please add this in flutter app -> android -> settings.gradle if you disagree please write ...
flutter Missing xcode dependency: Python module "six"
try python2.x -m pip install six by @humblerookie's suggest or brew reinstall python@2 pip install s...
flutter flutter messaging: set the notification icon
Hey guys I fought with this for the better part of a day For some strange reason there are no tutori...
flutter Issue with cloud_firestore - Cannot fit requested classes in a single dex file.
As a workaround you can try enabling mutlidex for Android App by following Enable multidex for apps ...
flutter D8: Program type already present: io.flutter.BuildConfig
@smrucv I received the same error but after flutter clean and flutter packages get everything works ...
provider A Product was used after being disposed. flutter: Once you have called dispose() on a Product, it can no longer be used.
Oh I see what you're doing Don't: DO: i have a ChangeNotifireProvider that such that i do pushReplac...
flutter Introduction of characters package causes crash on flutter run for preexisting Flutter applications
In my case I resolved the issue with flutter clean After e0ed12c I get this error when building: @ju...
flutter Making Network http error SocketException: Failed host lookup
@hoc081098 Double-check / make sure you have <uses-permission android:name=android.permission.INTERN...
flutter Support inlining Android/iOS views
iOS view embedding support has landed on master This is still just a preview There are multiple open...
flutter ✗ Android license status unknown.
Hi everyone Steps to Reproduce Please tell us what you were doing and what went wrong If you are run...
flutter idevice_id cannot run on catalina
When you're developing on Catalina Steps to Reproduce Run flutter doctor on macOS Catalina I get the...
flutter type 'List<dynamic>' is not a subtype of type 'List<String>'
The problem is your fromMap constructor is reading from a Map<String dynamic> ...
flutter TextField is hidden by keyboard inside of a Modal Bottom Sheet
This may not work for all situations but I have a modalBottomSheet that contains only a TextField ...
flutter Dismissing keyboard programatically
This is a better way as it also clears the focus: FocusScope.of(context).requestFocus(new FocusNode(...
flutter How to solve: Android license status unknown and also Android sdkmanager tool not found? Tried everything(as i think)
The answer is here Uncheck Hide Obsolete Packages and you'll see Android SDK Tools (Obsolete) 26.1.1...
flutter MissingPluginException: No implementation found for method
@mravn-google Yeah turned out I had to quit the flutter run process and start it up again Just a ful...
flutter firebase_auth: ^0.8.0+1 crashes on Android
Here i put this in file: android/ and changed targetSdkVersion to 28 and it worked...
flutter Android sdkmanager tool not found (C:...\Local\Android\sdk\tools\bin\sdkmanager)
This worked for me: open Android Studio's SDK Manager go to the Android SDK tab under SDK Tools ...
flutter 1.22.2 - Flutter plugin not installed; this adds Flutter specific functionality.
Hey @bhanuka96 try this line of code How do I fix this android plugin error? This error is being com...
flutter [ios][release] GeneratedPluginRegistrant.m Module not found
I may have found the answer from this comment: #21989 (comment) Seems like by opening up the project...
flutter [App.framework] Linked and embedded framework 'App.framework' was built for iOS/iOS Simulator
Does rm -rf ios/Flutter/App.framework get you unstuck? SOLUTION @jmagman has written an article on h...
flutter Bad state: Future already completed
I had the same issue.. The problem was the same that @soaresgabriel said but I was not navigating di...
flutter Execution failed for task ':app:compileFlutterBuildDebug' Issue
Hi @Ramihtet your logs show a different flutter version; could you please run flutter channel stable...
flutter Unable to load Asset - wrong indentation in pubspec.yaml
Is your assets key underneath a flutter: key as well? ...
flutter Flutter 1.12.13+hotfix.5: Flutter Run: The shrinker may have failed to optimize the Java bytecode.
The plugin seems to work correctly after adding minifyEnabled true as shown above in app-level build...
flutter Create iOS IPA from command line
This is what I ended up using as a complete release script ready for uploading to the Play Store/App...
flutter FutureBuilder rebuilds unnecessarily when we long press on FAB button or appBar UI.
Hello I believe the problem here is that didUpdateWidget of the FutureBuilder state is being called ...
flutter LinearGradient stops/colors properties as named parameters fail
Ah nice I'm on master but also had to flutter clean and then restart VS Code and now it has gone awa...
flutter gradle initializing taking forever
MacOS Android Studio 3.0.1 Try to install gradle manually (
flutter invalid text selection: TextSelection with TextEditingController
Can also confirm clearing text in single textfield throws exactly same exception FocusScope.of(conte...
flutter Bad state: Unexpected diagnostics:
Was able to fixed After add this in pubspec.yaml the error gone Thanks #62996 and #62240 ...
flutter_svg Error: Type 'DiagnosticableMixin' not found
There are two ways to solve it if you are in an older version of flutter other than the last one (1....
flutter [cloud_firestore 0.12.6] CloudFirestorePlugin.m:6:9: fatal error: 'UserAgent.h' file not found
I tried this • flutter clean • Clean Build Folder from Xcode • delete Podfile.lock But this didn't w...
bloc Close instances of dart.core.Sink.
Hi @zeucxb 👋 Thanks for opening an issue! This is a false positive in the dart linter dart-lang/lin...
flutter How to run on iOS simulator?
Make sure you have run sudo xcode-select --switch /Applications/ sudo xc...
flutter flutter run failed due to 'Permission denied' when replacing signature of 'Flutter.framework'
After investigating i think the root cause was the will mark the files under Flutte...
flutter [firebase_crashlytics] Gradle build failed
@TheVinhLuong Had the same issue your workaround worked thanks! @livingstonex If you've followed ins...
flutter "Minimum supported Gradle version is 5.4.1. Current version is 4.10.2."
Ran across this problem myself If anyone comes across this from google Steps to Reproduce Not much i...