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

Cannot disable file auto save if configured in workspace #108932

Closed
thiemeljiri opened this issue Oct 19, 2020 · 18 comments · Fixed by #109278
Closed

Cannot disable file auto save if configured in workspace #108932

thiemeljiri opened this issue Oct 19, 2020 · 18 comments · Fixed by #109278
Assignees
Labels
author-verification-requested Issues potentially verifiable by issue author bug Issue identified by VS Code Team member as probable bug config VS Code configuration, set up issues help wanted Issues identified as good community contribution opportunities insiders-released Patch has been released in VS Code Insiders verified Verification succeeded
Milestone

Comments

@thiemeljiri
Copy link

I cannot disable file auto save.

I cannot uncheck "Auto Save" under "File" menu. I disabled it in User settings but this option is still checked in file menu.

Restarting VS Code has no effect. I tried running VS Code without extensions and it behaves exactly the same. So it's very likely not related to any extension.

@vscodebot
Copy link

vscodebot bot commented Oct 19, 2020

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

@bpasero
Copy link
Member

bpasero commented Oct 20, 2020

Can you try to reproduce with our nightly insider builds? You can give our preview releases a try from: https://code.visualstudio.com/insiders/

@bpasero bpasero added the info-needed Issue requires more information from poster label Oct 20, 2020
@thiemeljiri
Copy link
Author

Hi @bpasero, I've just tried and it behaves exactly the same. In VS Code Insiders I couldn't untick the "auto save" under file menu. This time it was fresh installation I did from the link you provided. I didn't have VS Code Insiders installed before. This is really annoying and should should be investigated from your side. Thanks.

@bpasero
Copy link
Member

bpasero commented Oct 20, 2020

@thiemeljiri what OS is this?

@thiemeljiri
Copy link
Author

@bpasero Windows 10 Enterprise 64bit

@bpasero
Copy link
Member

bpasero commented Oct 20, 2020

Does it reproduce when you configure "window.titleBarStyle": "native"

@thiemeljiri
Copy link
Author

@bpasero Yes. And now I can see that clicking on "Auto Save" under "File" menu actually does some changes in settings.json - "files.autoSave" chnages its value between "off" and "afterDelay". But the tick remains and even when it's set to "off" the files are still save automatically.

@bpasero
Copy link
Member

bpasero commented Oct 20, 2020

I wonder if this issue is being caused by an installed extension. Can you try to run VS Code without extensions? From the command line (NOT the integrated terminal in Code), execute: code --disable-extensions and try your steps again to see if it reproduces. If you see it is an issue with the extension, please file it against the extension repository itself.

@thiemeljiri
Copy link
Author

As I mentioned in the original comment, I have already tried that. And as for VSC Insiders - I have no extensions there.

As for "window.titleBarStyle": "native", I've tried that only in VSC Insiders with no effect.

@bpasero
Copy link
Member

bpasero commented Oct 20, 2020

I cannot explain this, unless maybe your settings file is not valid. Does it show errors when you open it as JSON file?

@thiemeljiri
Copy link
Author

No, it doesn't. It is valid. And it happens even if it's completely empty.

@bpasero
Copy link
Member

bpasero commented Oct 20, 2020

Please see if you can find any logged output that could help us find the source of the issue:

  • run code --verbose from the command line and attach the output
  • in Code select Help | Toggle Developer Tools and select the Console
  • attach any output you see in the Console you can find

Thanks!

@thiemeljiri
Copy link
Author

thiemeljiri commented Oct 21, 2020

Hi @bpasero.

Ok, I've found out what was the issue. And it was very puzzling to me. I tried both scenarios on the same project. And now I've found out that there is also a .vscode folder with settings.json in this project which I haven't seen there before.

I don't have any experience with this kind of settings, but I don't like the current behavior. Settings in this file is forced to the editor and you cannot change it unless you modify this file. But it seems to me a bit puzzling.

I'd expect probably some of these scenarios as a user:

  1. When project editor settings file is present, the options it overrides should be either disabled and/or somehow marked as overridden by project editor settings file.
  2. When project editor settings file is present and the user tries to change the options it overrides in the UI, these changes are reflected in the project editor settings file, or both, in project and user settings file. Currently only user settings file is modified leaving the user puzzled why it's not working.

Please, let UX designers or other responsible people in your team know about this. Encountering something like this for the first time is extremely frustrating.

Thanks!

BR,
thiemeljiri

@bpasero bpasero added bug Issue identified by VS Code Team member as probable bug config VS Code configuration, set up issues and removed info-needed Issue requires more information from poster labels Oct 22, 2020
@bpasero bpasero added this to the October 2020 milestone Oct 22, 2020
@bpasero
Copy link
Member

bpasero commented Oct 22, 2020

@thiemeljiri great catch, we should be able to handle that case better.

@bpasero bpasero added the help wanted Issues identified as good community contribution opportunities label Oct 22, 2020
@bpasero
Copy link
Member

bpasero commented Oct 22, 2020

Opening up for a PR, the code that needs to be looked at is:

async toggleAutoSave(): Promise<void> {
const setting = this.configurationService.inspect('files.autoSave');
let userAutoSaveConfig = setting.userValue;
if (isUndefinedOrNull(userAutoSaveConfig)) {
userAutoSaveConfig = setting.defaultValue; // use default if setting not defined
}
let newAutoSaveValue: string;
if ([AutoSaveConfiguration.AFTER_DELAY, AutoSaveConfiguration.ON_FOCUS_CHANGE, AutoSaveConfiguration.ON_WINDOW_CHANGE].some(s => s === userAutoSaveConfig)) {
newAutoSaveValue = AutoSaveConfiguration.OFF;
} else {
newAutoSaveValue = AutoSaveConfiguration.AFTER_DELAY;
}
return this.configurationService.updateValue('files.autoSave', newAutoSaveValue, ConfigurationTarget.USER);
}

@jeanp413
Copy link
Contributor

I'll take a look at this

jeanp413 added a commit to jeanp413/vscode that referenced this issue Oct 24, 2020
bpasero pushed a commit that referenced this issue Oct 26, 2020
@bpasero bpasero changed the title Cannot disable file auto save Cannot disable file auto save if configured in workspace Oct 26, 2020
@bpasero
Copy link
Member

bpasero commented Oct 26, 2020

Verification: verify auto save can be turned on and off via File > Auto Save toggle in main menu. Verify this also works if files.autoSave is configured as workspace setting and then is updated inside the workspace.

@bpasero bpasero added the author-verification-requested Issues potentially verifiable by issue author label Oct 27, 2020
@github-actions
Copy link

This bug has been fixed in to the latest release of VS Code Insiders!

@thiemeljiri, you can help us out by confirming things are working as expected in the latest Insiders release. If things look good, please leave a comment with the text /verified to let us know. If not, please ensure you're on version e5c0007 of Insiders (today's or later - you can use Help: About in the command pallete to check), and leave a comment letting us know what isn't working as expected.

Happy Coding!

@jrieken jrieken added the verified Verification succeeded label Oct 29, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Dec 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
author-verification-requested Issues potentially verifiable by issue author bug Issue identified by VS Code Team member as probable bug config VS Code configuration, set up issues help wanted Issues identified as good community contribution opportunities insiders-released Patch has been released in VS Code Insiders verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants
@bpasero @jrieken @isidorn @thiemeljiri @jeanp413 and others