Skip to content
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

Commit should display warning if there are unsaved files in the project #33004

Closed
jrysig opened this issue Aug 23, 2017 · 12 comments
Closed

Commit should display warning if there are unsaved files in the project #33004

jrysig opened this issue Aug 23, 2017 · 12 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug git GIT issues good first issue Issues identified as good for first-time contributors help wanted Issues identified as good community contribution opportunities verified Verification succeeded
Milestone

Comments

@jrysig
Copy link

jrysig commented Aug 23, 2017

I often forget to save some files before SCM commit, it would be great to receive warning. Maybe it should be an optional feature.

@vscodebot vscodebot bot added the workbench label Aug 23, 2017
@Tyriar Tyriar added git GIT issues and removed workbench labels Aug 23, 2017
@joaomoreno
Copy link
Member

There isn't any current API which lets us do this. cc @jrieken

@joaomoreno joaomoreno added the feature-request Request for new features or functionality label Aug 24, 2017
@joaomoreno joaomoreno added this to the Backlog milestone Aug 24, 2017
@joaomoreno joaomoreno removed their assignment Aug 24, 2017
@jrieken
Copy link
Member

jrieken commented Aug 24, 2017

Well, you could call saveAll. Not exactly a warning but it will do the job

@rkeithhill
Copy link

rkeithhill commented Sep 15, 2017

OMG yes! I do this way too often. It would help if VSCode used the same "Save All" shortcut that every other app on Windows uses (ctrl+shift+s). Still, this seems like a "no brainer" kind of warning. Heck I'd be fine if it was opt-in just as long as I could configure VSCode to warn me.

@jrieken
Copy link
Member

jrieken commented Sep 15, 2017

There isn't any current API which lets us do this. cc @jrieken

Actually not so sure about that. You can loop over the array of text documents and check the isDirty-flag. Won't that do it @joaomoreno ?

@joaomoreno
Copy link
Member

joaomoreno commented Sep 15, 2017

Isn't that array just the visible ones? You can have unsaved documents that won't appear in that array, right?

@jrieken
Copy link
Member

jrieken commented Sep 15, 2017

Nope, that is all open documents, the visible once are for the editors, so no tabs

@joaomoreno joaomoreno modified the milestones: Backlog, September 2017 Sep 18, 2017
@joaomoreno joaomoreno self-assigned this Sep 18, 2017
@joaomoreno joaomoreno added bug Issue identified by VS Code Team member as probable bug and removed feature-request Request for new features or functionality labels Sep 26, 2017
@joaomoreno joaomoreno modified the milestones: September 2017, Backlog Sep 27, 2017
@joaomoreno joaomoreno added good first issue Issues identified as good for first-time contributors help wanted Issues identified as good community contribution opportunities labels Sep 27, 2017
@pradeepmurugesan
Copy link
Contributor

@joaomoreno & @jrieken Looks like the window.visibleTextEditors is nothing but the file that is the user is currently viewing.

If I split the screen into 2 then I get the value 2 else its always 1 irrespective of the number of tabs.
Kindly see the screen shot and let me know if I am looking at the wrong parameter under window.

screen shot 2017-10-13 at 17 58 40

@jrieken
Copy link
Member

jrieken commented Oct 16, 2017

Yeah, don't look at editor but at documents, e.g. vscode.workspace.textDocuments

@joaomoreno
Copy link
Member

Fixed by #36364

@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 26, 2018
@bpasero bpasero reopened this Feb 1, 2018
@bpasero
Copy link
Member

bpasero commented Feb 1, 2018

Does not work for me:

flicker_chrome58

@bpasero bpasero added the verification-found Issue verification failed label Feb 1, 2018
@joaomoreno
Copy link
Member

@bpasero Unfortunately this had to go behind a feature flag: git.promptToSaveFilesBeforeCommit. I had to disable it by default due to the smoketests. Please verify setting it to true.

@joaomoreno joaomoreno removed the verification-found Issue verification failed label Feb 1, 2018
@bpasero
Copy link
Member

bpasero commented Feb 1, 2018

@joaomoreno oh ok, I was searching for a setting but was looking for "warning" and was not finding it by that.

@bpasero bpasero added the verified Verification succeeded label Feb 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug git GIT issues good first issue Issues identified as good for first-time contributors help wanted Issues identified as good community contribution opportunities verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

7 participants