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

[autosave] Add settings for more granular behavior #1140

Open
1 task done
NormPlum opened this issue Nov 20, 2024 · 2 comments
Open
1 task done

[autosave] Add settings for more granular behavior #1140

NormPlum opened this issue Nov 20, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@NormPlum
Copy link

Have you checked for existing feature requests?

  • Completed

Summary

The Autosave package has a single setting: the Enabled toggle. This enables automatically saving the editor when it loses focus, is destroyed, or the window is closed.

This isn't very flexible, so I'd like to propose adding additional settings:

  • On losing focus
  • On destroy
  • On close

(or any combination thereof)

What benefits does this feature provide?

This would allow you to choose when the editor is autosaved.

My use case is that I have the Whitespace package installed, which is set to remove all trailing whitespace on save. With Autosave also enabled, this means when I have my cursor indented on a new line ready to add code, and then I alt-tab away to look something up, when I come back the editor has been saved, the whitespace is removed, and my cursor is no longer indented.

So being able to choose exactly when the editor is autosaved would be really handy. In my case I'd have it autosave on destory and when the window's closed, but not when it loses focus.

Any alternatives?

I think adding additional settings here makes more sense, rather than in another (community) package.

Other examples:

No response

@NormPlum NormPlum added the enhancement New feature or request label Nov 20, 2024
@savetheclocktower
Copy link
Contributor

The good news is that there's a setting in the whitespace package that will prevent this outcome: make sure to check Ignore Whitespace On Current Line if you want to prevent autosave from dedenting your cursor in these scenarios.

(I was worried it was failing to treat the current line as the current line in a situation where focus was lost, but I just tried this out, and it worked the way I hoped.)

In the meantime, this is a fair feature request even if there's a workaround for your scenario, so I'll leave this open. Thanks for the report!

@savetheclocktower savetheclocktower changed the title Additional settings for Autosave package [autosave] Add settings for more granular behavior Nov 25, 2024
@NormPlum
Copy link
Author

Thanks @savetheclocktower. Yeah, I saw that option in the Whitespace settings, but I've had trouble in the past when my cursor's on a line with trailing whitespace and I save and close Pulsar, then the whitespace remains (when it should be removed).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants