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

Add a setting to auto save after delay when stopped typing #46338

Closed
liesislukas opened this issue Mar 22, 2018 · 8 comments
Closed

Add a setting to auto save after delay when stopped typing #46338

liesislukas opened this issue Mar 22, 2018 · 8 comments
Assignees
Labels
info-needed Issue requires more information from poster

Comments

@liesislukas
Copy link

  • VSCode Version: Version 1.21.1 (1.21.1)
  • OS Version: macOs 10.13.3 (17D102)

Steps to Reproduce:

  1. run nodejs script with e.g. nodemon or some other watcher which restarts after file update
  2. open javascript file and start typing
  3. nodemon will detect file save event and will fire restart all the time during the typing and it will be huge CPU spike. It will throw type errors while you are in the middle of typing.

It should save after delay:

  1. Type type type
  2. wait autoSaveDelay ms
  3. save the file

Or we could have another option: "files.autoSaveWhileTyping": false and it would wait till no keyboard input for e.g. 250ms before autosaving, then wait for autoSaveDelay and then save.

Does this issue occur when all extensions are disabled?: Yes

@liesislukas liesislukas changed the title autoSaveDelay should not save file during the typing autoSaveDelay should not save file while typing Mar 22, 2018
@bpasero bpasero added feature-request Request for new features or functionality file-io File I/O labels Mar 23, 2018
@bpasero bpasero removed their assignment Mar 23, 2018
@bpasero bpasero changed the title autoSaveDelay should not save file while typing Add a setting to auto save after delay when stopped typing Sep 20, 2018
@GrCOTE7
Copy link

GrCOTE7 commented Dec 29, 2018

Hi.

Is this point resolved today?

Does exist a setting we can set in settings.json i.e. ?

Else does exist simply a way to set a delay in this auto-save, without looking for typing or not ?

Thanks for answers...

@liesislukas
Copy link
Author

there could be an option to autosave when the editor loses focus. Because while typing you may stop to think and it could throw type errors easily. Or if autosave while typing, do it when no clear errors on file.

@aal89
Copy link

aal89 commented Feb 28, 2019

In my settings.json file I have:

{
    "files.autoSave": "afterDelay",
    "files.autoSaveDelay": 250,
}

I think you missed the afterDelay setting?

Using nodemon you can set a delay too. In package.json or some other config file:

{
  "name": "nodemon",
  "homepage": "http://nodemon.io",
  "...": "... other standard package.json values",
  "nodemonConfig": {
    "ignore": ["test/*", "docs/*"],
    "delay": "250"
  }
}

@fullstackwebdev
Copy link

"autoSave" "afterDelay" is actually really buggy. Because it doesn't wait until after you are done typing, it only waits after you have made changes, and it will autosave while you are still moving the cursor to another spot to make more changes.

The expected behavior should be -- wait until all keyboard input is done, then start the delay timer. That way a user can move to the next spot (like a closing bracket a few lines down) without having to worry about racing against the editor saving a broken,due to the buggy delay code -- to then easily navigate to the next area, make changes, then wait for the delay to start to save.

it should be called "afterDelayFromChanges" and "afterDelay" should actually wait until .. there is a total delay in keyboard input.

this is really nasty bug in my opinion, I am constantly having go to to 'autosave off' then make my changes, then turn autosave back on -- or all my nodemon watch tests will fail, unless I am fast enough to get to the next area (usually a closing bracket) needing changes.

@ryanpag3
Copy link

This causes a lot of performance degradation for me. I'm also running nodemon and often the VSCode process will freeze due to poor save delay timing.

@bpasero bpasero added this to the Backlog milestone Oct 24, 2019
@bpasero bpasero modified the milestones: Backlog, Backlog Candidates Nov 3, 2019
@minig0d
Copy link

minig0d commented Jan 4, 2020

Completely agree with all the above. In fact, I honestly don't understand why anyone would want it to save while they are actively interacting with the UI.

I would think be it default behavior or a separate setting that ideally it should wait for the app to be completely idle before starting the delay period. And by idle, I mean not just keyboard interaction but mouse as well.

If you wanted to get REALLY technical, I'm kind of ok with mouse interaction outside of focus being considered "idle" but definitely if I'm actively typing or using the mouse within the file, I would not want the autosave delay to start counting down.

For those who code for long periods without a gap long enough for the autosave delay to kick in, there could be a new setting created that is basically "if we haven't autosaved in the past X minutes due to constant user activity, proceed with autosave anyway". This way it's seemingly the best of both worlds.

@bpasero
Copy link
Member

bpasero commented Jan 10, 2020

@liesislukas and others, the code that triggers auto save today will work as requested: as long as the editor is being modified, the auto save is pushed out. You can see that from the code here:

I am not sure what the original author saw or if it still applies, but I would go ahead and close this issue as invalid unless someone can show me an actual problem with auto save.

@bpasero bpasero removed feature-request Request for new features or functionality file-io File I/O labels Jan 10, 2020
@bpasero bpasero self-assigned this Jan 10, 2020
@bpasero bpasero removed this from the Backlog Candidates milestone Jan 10, 2020
@bpasero bpasero added the info-needed Issue requires more information from poster label Jan 10, 2020
@vscodebot vscodebot bot closed this as completed Jan 22, 2020
@vscodebot
Copy link

vscodebot bot commented Jan 22, 2020

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!

@vscodebot vscodebot bot locked and limited conversation to collaborators Mar 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

7 participants