Vscode: Add setting to configure if saving non-dirty file should touch the file

Created on 18 Jan 2018  路  19Comments  路  Source: microsoft/vscode

  • VSCode Version: Code 1.19.1 (0759f77bb8d86658bc935a10a64f6182c5a1eeba, 2017-12-19T09:35:14.671Z)
  • OS Version: Darwin x64 16.7.0
  • Extensions:

Extension|Author (truncated)|Version
---|---|---
vscode-eslint|dba|1.4.4
cpptools|ms-|0.14.6


Steps to Reproduce:

  1. check timestamp of a file (getShedStructure.js).
  2. open file
  3. save file with no changes
  4. check the file timestamp.
    actual: the file's timestamp is updated after saving with no changes.
    expected: the file's timestamp is not updated because nothing changed.

i'm trying to switch from Webstorm to VS Code, and Webstorm does not do this. I am not sure about Atom.

jan-18-2018 06-27-21


Reproduces without extensions: Yes

feature-request file-io

Most helpful comment

You're right it's my opinion - but although I'm not sure I'm nonetheless quite convinced, that I'm in the majority on this. I can't think of another major app that works this way, including Visual Studio.

But I agree with you and @shelbyspeegle that this should be an option, there shouldn't be breaking changes for current users.

All 19 comments

@shelbyspeegle this actually works "as designed" for the reason you state: some people want to trigger file watchers by saving even if the file is not dirty.

Maybe we need a setting for this.

@bpasero thank you for your quick reply.

that is a great point. i think a setting could be useful.

could you elaborate on the most common scenario for why someone would want to trigger a file watcher for an unmodified file?

would you accept a PR for adding this setting?

if so, could you give me a reference to a file i could look at or documentation on adding a setting?

could you elaborate on the most common scenario for why someone would want to trigger a file watcher for an unmodified file?

Yes, to trigger a reload of the server for testing without having to make a change.

would you accept a PR for adding this setting?

Sure, why not. The touch() happens here and a configuration setting could make this conditional.

This is not how it works in other IDEs (as well as Visual Studio proper). Every app of any distinction does not work this way. I'm sure the number of people who want this peculiar behavior is much less than those that don't - a file should only be saved/touched if it was actually dirty.

If the only way to deal with this is to have an option, that is fine. But this is not a minor matter, it's a complete nuisance for the exact reason given that it is "by design" - every save triggers watcher reloads that shouldn't occur.

Like I said in my related issue, surely vscode should not save in these cases:

  • file hasn't changed
  • undo buffer is empty (i.e. file was changed but the change was reverted, so file is in fact unchanged)

every save triggers watcher reloads that shouldn't occur

Well, that is your opinion. There are many users that actually want exactly this behaviour and asked for it. As such, an option is the only way out imho.

You're right it's my opinion - but although I'm not sure I'm nonetheless quite convinced, that I'm in the majority on this. I can't think of another major app that works this way, including Visual Studio.

But I agree with you and @shelbyspeegle that this should be an option, there shouldn't be breaking changes for current users.

Could we close this and reopen later if necessary? I don't think the issue fits in the roadmap / has garnered enough votes currently.

@christopherkang what's the benefit of closing? Where do you view the current roadmap and issues ranked by votes? What's the criteria?

https://github.com/Microsoft/vscode/wiki/Issue-Grooming - I'd say that we could keep the issue open if we can get a contributor on it, but as stated above, the current save system works for most users as expected.

@christopherkang I don't have the data on how many users prefer one way or the other but @lonix1 had good comments above.

I think that's fair and @bpasero pointed out its need for server refresh. Also, this issue is contingent upon getting a contributor.... could we get a help-wanted tag added? Would this issue be easy to fix (maybe we could make it a good "first time" issue)?

+1. By the way, aren't there less "hacky" ways to trigger server reloads? Surely you can do it in the aforementioned IDEs?

For discoverability, linking the old issue where saving unchanged files was requested: #7470.
Hope the linkback will show up there even though that issue is locked.

I totally agree this behavior should be optional, if present at all.

Can anyone help?

This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

Is this issue been fixed?
If yes, whats the new setting to handle it.

This feature request has not yet received the 20 community upvotes it takes to make to our backlog. 10 days to go. To learn more about how we handle feature requests, please see our documentation.

Happy Coding

:slightly_frowning_face: In the last 60 days, this feature request has received less than 20 community upvotes and we closed it. Still a big Thank You to you for taking the time to create this issue! To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mrkiley picture mrkiley  路  3Comments

chrisdias picture chrisdias  路  3Comments

omidgolparvar picture omidgolparvar  路  3Comments

ryan-wong picture ryan-wong  路  3Comments

shanalikhan picture shanalikhan  路  3Comments