You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
"Move to File" refactor says it will overwrite existing files even though it adds to them #63161
Yeah, I believe that if you choose an existing file, you might see a prompt about "overwring the file" (which is built-in functionality from VS Code/Electron or the OS depending on the kind of file dialog being shown), but it will not be overwritten, the content will be inserted as expected.
The VS Code issue was unfortunately closed (I think because of limitations in Electron rather than disagreement with the issue).
I think the best we can do is prompt and ask if you want to move to a new file or existing file after you select this fix, and then use the corresponding API to avoid the prompt. However it does mean if you choose the option to move to a "new file" and then select an existing file, you'd still see the (incorrect) warning. The alternative to that is not using the OSes file-picked at all, and implementing our own in the quick-input boxes, but given how wonky I find VS Code's own implementation of that (which is used when you're connected to a remote), I don't think that would be the best experience.
changed the title [-]move to file should allow to move a class to an already existing file without overwriting it's content[/-][+]"Move to File" refactor says it will overwrite existing files even though it adds to them[/+]on Apr 12, 2026
I was going to keep this issue open to track this, however this bug is entirely VS Code-specific. Another LSP client could implement this in a different way - so I'll close this in favour of Dart-Code/Dart-Code#5066
Activity
FMorschel commentedon Apr 12, 2026
This is already possible but there is a VS Code bug on the UI.
CC @DanTup which issue was it?
DanTup commentedon Apr 12, 2026
Yeah, I believe that if you choose an existing file, you might see a prompt about "overwring the file" (which is built-in functionality from VS Code/Electron or the OS depending on the kind of file dialog being shown), but it will not be overwritten, the content will be inserted as expected.
Related issues are:
The VS Code issue was unfortunately closed (I think because of limitations in Electron rather than disagreement with the issue).
I think the best we can do is prompt and ask if you want to move to a new file or existing file after you select this fix, and then use the corresponding API to avoid the prompt. However it does mean if you choose the option to move to a "new file" and then select an existing file, you'd still see the (incorrect) warning. The alternative to that is not using the OSes file-picked at all, and implementing our own in the quick-input boxes, but given how wonky I find VS Code's own implementation of that (which is used when you're connected to a remote), I don't think that would be the best experience.
[-]move to file should allow to move a class to an already existing file without overwriting it's content[/-][+]"Move to File" refactor says it will overwrite existing files even though it adds to them[/+]DanTup commentedon Apr 12, 2026
I was going to keep this issue open to track this, however this bug is entirely VS Code-specific. Another LSP client could implement this in a different way - so I'll close this in favour of Dart-Code/Dart-Code#5066