-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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
Feature Request: Open new file buffer via API #12283
Comments
@bpasero is working on this |
@jrieken the one (little) challenging thing is that in |
Yeah, we could check if only the |
@jrieken I like the more explicit |
@bpasero your proposal in #17917 sounds great. The only question would be the name of the file when the language is specified. The untitled document command right now creates documents as "Untitled-1", Untitled-2" ... |
Not sure about that to be fair. |
@bpasero re #12283 (comment) there is one catch it forget to mention. We have a rule that |
A new overload was added to the
To create a text document with XML as language. If you leave out the language options, it will just create a text document with plain text language. |
@bpasero so the openTextDocument gets an uri now which has to be a valid path even if it's untitled. is it going to be the same or with the new option if I don't pass any uri it would be untitled? |
@llali with the new API you no longer pass in a URI and you end up exactly in the same spot as if a user would have hit CtrlCmd+N to open a new untitled file. The optional language ID can be used to define the language of that document upfront. |
To create a text document with XML as language. If you leave out the language options, it will just create a text document with plain text language. |
Is it possible to open a new file buffer via the API? Essentially, when you use your mouse (or keyboard shortcuts) and goto File menu > New File, it creates a new Untitled file buffer in the workspace. When you Save the file, it opens a Save File dialog where you choose where to save it along with the filename. Is it possible to create a new file buffer in this same manner via the API? If not, can this feature be added?
I have messed around with the API quite a bit in this area and if it is currently possible, it's not clear in the documentation.
I know you can do this:
But this requires that you specify the file path for this new "untitled" file. When you hit save, it forces the file to be saved at "c:\project\myfile.txt". The user is not given the chance to specify where to save the file or what filename to give it.
To make a long story short, I essentially want the same functionality as going to File menu > New File. Does that make sense?
The text was updated successfully, but these errors were encountered: