-
Notifications
You must be signed in to change notification settings - Fork 27.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TextDocument.save() closes untitled documents #29156
Comments
I see now way how to support this because our model with /cc @jrieken |
Is there a workaround? E.g. a way to get the new file path so I can re-open the document? At the moment it seems my options are:
|
I would like the ability to handle this use-case as well. Here is my use-case:
From here the file closes, there is no programatic way to know what the filename/path the user has chosen, so I cannot send the file to the remote resource. For now I will just require that the user save the file prior to calling the command, but it would be ideal to be able to support this case. |
This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation. Happy Coding! |
This feature request has not yet received the 20 community upvotes it takes to make to our backlog. 10 days to go. To learn more about how we handle feature requests, please see our documentation. Happy Coding |
🙁 In the last 60 days, this feature request has received less than 20 community upvotes and we closed it. Still a big Thank You to you for taking the time to create this issue! To learn more about how we handle feature requests, please see our documentation. Happy Coding! |
I am developing an extension which runs a shell command on the active document. For this to work I need to save the active document first. I can do this using
TextDocument.save()
. However, if the user has created a new, untitled document, thensave()
closes the document. In addition, the document's fileName is not updated to reflect the save path.This is related to #25729 but the workaround described there does not work for me because I do not control the creation of the untitled file, and there seems to be no way to get the file path after the save. So I cannot use that to reopen the document or pass its file path to my command line.
Steps to Reproduce:
(The problem still occurs without the asyncs and awaits, though it fails in a slightly different way if you inline the save call in the command handler instead of calling via
withActiveDocument
.)Run the extension in the Extension Development Host.
Hit Ctrl+N to create a new untitled file. Type some garbage into the file.
Run the contributed command (e.g.
Ctrl+Shift+P > Sauve Qui Peut
).At the save prompt, enter a file name and hit OK.
Expected behaviour: The document remains open in the editor, and its fileName is updated to reflect the save path.
Actual behaviour: The document disappears out of the editor. If the document object is inspected in the debugger, its fileName is still "Untitled-1".
The text was updated successfully, but these errors were encountered: