Save as command correctly creates a new file before saving#9022
Save as command correctly creates a new file before saving#9022vince-fugnitto merged 1 commit intoeclipse-theia:masterfrom
Conversation
vince-fugnitto
left a comment
There was a problem hiding this comment.
@Darkgaja thank you for taking care of the issue, the changes look very good already.
We should possibly change the enabled of the command to be available only when an editor is opened. With these changes, if a file node is selected in the explorer, the command is available, prompts the user to choose a name but does not perform an actual save (given that sourceWidget is undefined).
Else, we may not want to show the dialog at all when no editor is opened (similarly to vscode).
|
@vince-fugnitto sure, I'll look into this as well |
|
The change seems to work, but I don't know what to think about a new tab being opened and the old one closing? Is there a way to not do that? |
@marechal-p I believe that is the intended behavior (similarly to vscode), when |
This is what I meant. It is weird how it works right now, but if that's all we can do I'm fine. |
packages/workspace/src/browser/workspace-frontend-contribution.ts
Outdated
Show resolved
Hide resolved
b2cc265 to
9143093
Compare
|
@dukengn I noticed that the dialog comes up because of the |
vince-fugnitto
left a comment
There was a problem hiding this comment.
@Darkgaja do you mind squashing your changes to a single commit with a nice commit message? I'll perform a review in the meantime.
@dukengn the dialog is presented when we attempt to overwrite a file (it should ask for confirmation first). |
|
@vince-fugnitto Actually, this is a different dialog. The confirmation dialog correctly pops up while selecting a file. The dialog @dukengn mentioned pops up because the Nevertheless, I will squash my commits. |
6ed70d9 to
b217bbc
Compare
vince-fugnitto
left a comment
There was a problem hiding this comment.
@Darkgaja do you mind rebasing and resolving conflicts?
b217bbc to
9333761
Compare
|
@vince-fugnitto done. |
packages/workspace/src/browser/workspace-frontend-contribution.ts
Outdated
Show resolved
Hide resolved
80f0002 to
8de47fa
Compare
8de47fa to
851abb9
Compare
vince-fugnitto
left a comment
There was a problem hiding this comment.
The changes look good 👍 I did encounter a minor bug that can likely be handled:
- open a file, and perform some dirty changes (ex: 'readme.md')
- execute the command Save As...
- save the file with the original name ('readme.md')
- a confirmation box will appear asking if you want to overwrite the original file
- the file is saved and immediately closed
save-as-bug.mp4
Signed-off-by: Mark Sujew <mark.sujew@typefox.io>
851abb9 to
62da848
Compare
|
@vince-fugnitto When encountering the same |
@Darkgaja I'll verify the new behavior, vscode behaves the following way:
|
|
Thanks. Right, I also took vscodes behavior as a sort of template. It should behave as you've laid out. |
vince-fugnitto
left a comment
There was a problem hiding this comment.
I confirmed that the changes work well 👍
DucNgn
left a comment
There was a problem hiding this comment.
The PR looks good to me 👍
I confirmed it aligns our save as behaviour with vscode.

What it does
Fixes #8373
Fixes #8504
Closes #8514
When using the "save as" command, a new file will be created with the new changes, and the old file will be unchanged. The text editor will then close the old file and open the new one.
How to test
Review checklist
Reminder for reviewers