SolvedDart Code Implement refactor: Move file
✔️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:
There's a beta build here if you'd like to try it out:
https://github.com/Dart-Code/Dart-Code/releases/tag/v3.11.0-beta.3
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.
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 https://github.com/microsoft/vscode/blob/926fc23f139e4d1250dba494c6e825e4816e62f6/src/vs/workbench/api/common/extHostFileSystemEventService.ts#L148 concurrently. This results in multipleMOVE_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).