-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
[Question] How to programatically access New Unsaved File #17003
Comments
I believe I just answered your question over on StackOverflow Please let me know if that is what you are looking for or if anything is unclear. Thanks. |
@mjbvz - thanks! That is what I was looking for, I'll follow if I have any questions. |
@mjbvz is there any way to do this without providing a path to save the unsaved file to? I'd like force the prompt for a save location when a user tries to save the file, instead of forcing one to be provided. |
@mjbvz - just pinging again, incase this got lost over the weekend. |
I'm not sure if we have a good api story for that flow. @jrieken Do you have any thoughts on how he could accomplish this using the existing apis? |
Just to add a bit more. Is there anyway to leverage "workbench.action.files.newUntitledFile"? I've been trying to discern what parameters may exist, but no luck yet. |
@jongeller You can call return workspace.openTextDocument(Uri.parse('untitled:c:/test/files.js').then(doc => {
assert.equal(doc.uri.scheme, 'untitled');
assert.ok(doc.isDirty);
}); |
looks like these two items were added to open issues internally and externally, but haven't been addressed in a couple months: |
Yes #12283 is what you want |
Hi all, trying to get access through the vscode namespace to a new tab (unsaved) editor in the active window.
I would like to create a new document, but it needs to remain unsaved. I cannot find a way to programmatically set the content of this document while it is in a unsaved state.
I have used: commands.executeCommand("workbench.action.files.newUntitledFile") but there seems to be no way focus on that new editor window (until saved) to then add content to the document.
When I create a new temp file and open it with: workspace.openTextDocument(path) The file is already saved.
Thanks!
The text was updated successfully, but these errors were encountered: