Recent

Author Topic: [Solved] AutoSave feature?  (Read 2892 times)

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
[Solved] AutoSave feature?
« on: April 25, 2018, 08:05:25 pm »
Hi, I've looked at the options first this time =)

But I can't find an autosave feature. I say like the one used by IntelliJ, so I never need to Ctrl + S again.

And if something bad happens, I always use Git, so there is no problem with that for me.

Any ideas / plugin / script to make this possible?
« Last Edit: April 26, 2018, 12:16:59 am by lainz »

balazsszekely

  • Guest
Re: AutoSave feature?
« Reply #1 on: April 25, 2018, 08:47:09 pm »
You can easily implement this feature:
1. Create a new package
2. Add IDEIntf to the required packages
3. Add IDECommands to the uses clauses
4. On IDE startup, start a timer, preferably a thread timer so you don't interfere with the IDE, when the timer ticks just call:
Code: Pascal  [Select][+][-]
  1. uses IDECommands;
  2.   //...
  3.   IDECommands.ExecuteIDECommand(Self, ecSaveAll);
  4.   //..
  5.  
5. You can also create a dialog where the user can set the interval, or disable the feature, etc...

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: AutoSave feature?
« Reply #2 on: April 25, 2018, 08:50:19 pm »
Thanks, seems easy.

And sorry I'm new to that kind of plugins, there is a way to save all before closing Lazarus / closing Project?

balazsszekely

  • Guest
Re: AutoSave feature?
« Reply #3 on: April 25, 2018, 08:59:14 pm »
AFAIK when you close the IDE, the changes are saved. The IDE even ask you: "Save changes to project xy?"

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: AutoSave feature?
« Reply #4 on: April 25, 2018, 09:18:29 pm »
Yes, I know that dialog.

What I wanted is like IntelliJ that saves it when you close with no prompt, and always it's saving. Like the Google Docs application, where there is no save button, everything is automatically saved.

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: AutoSave feature?
« Reply #5 on: April 25, 2018, 09:23:01 pm »
But you're right, with a delay it will be enough, I'm looking that VS Code also has 1000 ms delay between saves, so It's really small and already good.

I will make the plugin here:
https://forum.lazarus.freepascal.org/index.php?topic=41052.msg284206;topicseen#new
« Last Edit: April 25, 2018, 10:02:57 pm by lainz »

 

TinyPortal © 2005-2018