-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Provide "New File" default implementation (#13303) #13344
Provide "New File" default implementation (#13303) #13344
Conversation
219e08e
to
102c88c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Dennis, thank you very much for those changes, I think it definitely fills a gap in a very common functionality.
I added some comments but I also have a core question: Is there any particular reason we enforce this to be the same as the 'New File' command we have in the workspace? I feel like a separation may reflect the difference in functionality a little bit better:
- The Workspace 'New File' command is the one that you can trigger from the File Navigator toolbar and the one where we can actually create files in a known root folder.
- The Common 'New File' command is one that can be triggered from the command palette even if there is no open workspace and that will ask you where to save the file. Currently calling the New File command from the menu when no workspace is open will simply not show the option to create a file which is a shame cause basically all the pieces are already in place.
We can combine the code, of course, but I think aligning with VS Code might be better at the moment, i.e., always asking where to save the file and if we are in a workspace context and we do know about a selected URI we can propose this as the parent but we should always show the dialog. This ensures that the code always works properly.
I hope it is clear what I mean, if not, let me know and I'll try my best to explain better.
Thank you for your comments!
Yes, I was thinking about this as well. In my PR Draft I tried to explain it in the PR description and offered some option how to implement it. So I'm really glad to have somebody to discuss it now! In fact the 'New File...' command in vs-code is the one from the welcome page and just opens a system 'Save' dialog. This behavior is really confusing when you already have a workspace open IMHO. I also think that a lot of people will tend to use the menu entry to create a new workspace file, especially in case where the Explorer view is closed or hidden. See also the user expectation here. I think the best would be:
This leads me to some other questions:
FDYT? |
So in VS Code it seems they not only trigger it from the Welcome Page but they also have a 'New File...' menu item in the 'File' menu, exactly the same as we do. And that item is available no matter whether you have a workspace open or not (i.e., just having a new empty window) by always opening a save dialog after the user provided some input. So I believe we should at least take that as a baseline of things that need to work. You can open a save dialog through the I believe most of the "confusion" comes from the fact that we are mixing two different actions under the same name:
I believe we should not mix them and even if we were to have the information in case 1, since other contributions may not utilize that, I believe we should simply align with VS Code for now. However, that is just my opinion and others may disagree so if you want to consider the context (in case we have a workspace context), we can definitely involve other people in this discussion. |
102c88c
to
1641649
Compare
f5afa73
to
a35b9fc
Compare
The test |
ab68746
to
53ae257
Compare
Not that I'm aware of. I'm monitoring the playwright tests and didn't see this one in particular failing before. There is however a certain amount of flakiness in our Playwright tests in general (< 1 % though). So I'll add this one to my list of "suspects" and observe whether I see this failing again. |
I'll have another look at this today, thank you for your patience. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dhuebner I really, really like the new set of changes! Now everything is very clear cut and the usability is also fantastic, so thank you very much!
I do have some minor comments on the code which you may want to address but the functionality is definitely there.
packages/filesystem/src/browser/filesystem-frontend-contribution.ts
Outdated
Show resolved
Hide resolved
packages/filesystem/src/browser/filesystem-frontend-contribution.ts
Outdated
Show resolved
Hide resolved
packages/filesystem/src/browser/filesystem-frontend-contribution.ts
Outdated
Show resolved
Hide resolved
packages/filesystem/src/browser/filesystem-frontend-contribution.ts
Outdated
Show resolved
Hide resolved
packages/getting-started/src/browser/getting-started-widget.tsx
Outdated
Show resolved
Hide resolved
@dhuebner Do you plan to adress the comments? Would be great to have this in the upcoming release. |
@JonasHelming |
5ce56f1
to
add38f4
Compare
@martin-fleck-at |
@dhuebner Thank you for the update, I'll have a look at this tomorrow! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dhuebner Fantastic, thank you very much for the great contribution! Everything looks good to me now!
What it does
Fixes #13303
Adds a new dynamic
Create New File
item to the create file picker. The new item will appear as soon as the user types something in the input field. Accepting the item will execute afile.newFile
command handler and bypass the file name to it.How to test
New File...
item from theFile
menu.Create New File
should become visibleFollow-ups
Review checklist
Reminder for reviewers