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

Save editor on focus lost #171

Open
guw opened this issue Jun 22, 2022 · 5 comments
Open

Save editor on focus lost #171

guw opened this issue Jun 22, 2022 · 5 comments
Labels
enhancement New feature or request

Comments

@guw
Copy link
Contributor

guw commented Jun 22, 2022

It would be great if there is an option in Eclipse to turn on auto-save when the IDE window looses focus.

@mickaelistria mickaelistria added the enhancement New feature or request label Jun 22, 2022
@jukzi
Copy link
Contributor

jukzi commented May 17, 2023

I don't want such enabled as default. It can cause real trouble when saving during a build or team operation.
However if autosave is enabled anyway it could be default to have "focus lost" as trigger. But not more often then the autosave interval.
image
@guw do you plan to contribute something or do we close it as not-planned?

HannesWell pushed a commit to HannesWell/eclipse.platform.ui that referenced this issue Jul 1, 2023
…atform#171)

* Fix ClassCastException in TextSearchVisitor.TextSearchJob

- TextSearchVisitor.TextSearchJob.processFile() has a catch
  for FileCharSequenceProvider.FileCharSequenceException and
  tries to rethrow the exception cause.  In the case, where the
  cause is an IOException, throw the original FileCharSequenceException
  which is RuntimeException
- discovered by eclipse-jdt/eclipse.jdt.ui#436

* Update org.eclipse.search/search/org/eclipse/search/internal/core/text/TextSearchVisitor.java

Use Java 17

Co-authored-by: Mickael Istria <[email protected]>

---------

Co-authored-by: Mickael Istria <[email protected]>
@elsazac
Copy link
Member

elsazac commented Jan 25, 2024

However if autosave is enabled anyway it could be default to have “focus lost” as trigger. But not more often than the autosave interval.

@jukzi - just curious, if the autosave is enabled, it will anyways trigger the save after the autosave interval right? then what added benefit the focus lost trigger will provide?

@mickaelistria
Copy link
Contributor

I'm curious about the bigger story: why does one use auto-save? Is it to prevent from data loss?
I've seen some editors doing things smarter, by keeping internally in their disk area (eg ~/eclipse-workspace/.metadata) a copy of the document that are under edition, with the state as we see it in the editor. And if the editor happens to crash, then the editor tries to restore its content from the working copy cache. This is much less intrusive than auto-save.

@jukzi
Copy link
Contributor

jukzi commented Jan 25, 2024

I agree with @mickaelistria , for example notepad++ does a great job at this: it does not even ask if unchanged files should be saved on shutdown. It just already saved it somewhere and keeps bothersome questions away from me if i have to restart my computer.

@laeubi
Copy link
Contributor

laeubi commented Jan 25, 2024

Regarding autosave on focus lost, what I often encounter is the following:

  1. Have two classes A + B where A reference B and their editors open
  2. No in A type a new method that do not exits in B
  3. Now JDT offers a quickfix to add the missing method and if I accept this is jumping to B where I can edit the method
  4. If one now switches back to A it still complains that the method is missing and offers to add the method unless one saves B

So saving is sometimes required to let other things happen so not saving is most of the time not an option anyways...

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

5 participants