rubberduck-vba / Rubberduck

Every programmer needs a rubberduck. COM add-in for the VBA & VB6 IDE (VBE).
https://rubberduckvba.com
GNU General Public License v3.0
1.9k stars 299 forks source link

Request for timed project save #4469

Open ghost opened 5 years ago

ghost commented 5 years ago

If there are no immediate plans to reintroduce version control to RubberDuck would it be possible to introduce exporting the project file every X minutes.

Vogel612 commented 5 years ago

There used to be some autosave functionality. It was notoriously good at stealing focus and saving exactly when you didn't really want it to save. I assume it's similar with this suggestion.

An alternative might be to "automatically export on save" as an opt-in setting. Thoughts?

ghost commented 5 years ago

I'm just expressing a wish to save snapshots of the code independently from the template because you can't save versions of the code from within the VBA IDE or from within Word itself. If stealing of the focus was an issue in the past then I'd be happy for Rubberduck to save just the module that the focus is leaving at any change of focus. Syncthing or some other versioning package will take care of any subsequent 'filing issues'.

retailcoder commented 5 years ago

How about having a hotkey for export project?

That said the focus issue with the defunct autosave feature was because we were saving the host document - exporting code files might be less disruptive.

comintern commented 5 years ago

Just brainstorming here, but it might be possible to minimize disruption if we leverage the parser's cache to only export files that have changed since the last export.

ghost commented 5 years ago

Not really a contribution other than an expression of frustration which supports my request above. Does anyone else experience Word crashing on what seems like a routine basis when just editing VBA code. I've just lost another hours+ worth of work due to this issue. It seems to happen to me at least once a day (and office gets at least a weekly full installation). Yes I could save the template every 2 minutes but when you are deep in though resolving issues you don't always remember to do this. I'm strongly tempted to move my (personal) project to c# and Visual Studio (mutter mutter mutter whinge whinge whinge)

majkaz commented 5 years ago

I have a related question: I don't need autosave exactly, it is enough for me to export the code on each save / compile / close and I can use the VBA itself for this. The problem child for me is Outlook, where the code isn't exposed natively. The only way from there I have found is using olevba and parse the result, and this is the way I am using currently...

Is there a way to trigger the export function from inside of Outlook VBA?

comintern commented 5 years ago

@majkaz I'm not sure that I understand what you mean by "the code isn't exposed natively". Do you mean that the VBProject isn't available via the Outlook object model, or something else? If that's the case you should be able to simply reference the VB extensibility objects and use those (if you're willing to deal with the security implications of doing that).

majkaz commented 5 years ago

Yes, VBProject isn't available via the Outlook object model. When I was searching for a solution, I have just found (maybe false) information that there is no possibility to export the code from Outlook. I have currently a working way to get this using olevba, I am just looking for a solution that doesn't need the extra tools (and Python). Edit: It is not possible to get the reference from VB extensibility objects either...