Save/restore queries on close or manually
I'm a multitasker, and I usually have 7 or 8 (or 20) tabs open in LINQPad. When I need to restart my computer, or for whatever reason close LINQPad, I could to save each of my queries (coming up with a meaningful name for each), remember which ones I had open, and reopen them one by one when I restart, but I find it's quicker and easier to just kill LINQPad with Task Manager so that it will offer to reload all my tabs for me automatically. I would be nice if LINQPad had the option to save and restore all queries on close/start, and/or the option to save and reload a group of queries at will.
This is now available from V6.9.12 (in beta as of June 2020). It employs a new autosave engine that serializes all editor operations, so that the undo/redo stack is restored along with the query. You can choose to shelve queries upon exit, or by default in the Edit | Preferences dialog. A conflict-detection mechanism ensures that you can’t accidentally overwrite a query that’s been subsequently edited via cloud synchronization or another application. Enjoy!
I too am accustomed to Notepad++'s "remember everything" feature (b), but I would be happy to see (a) as a "90% solution" as others have stated.
Sean Wright commented
Most of the time I'm creating queries that I need for a couple of sessions (restarts of my laptop or LINQPad) but not after that. So (A) would be awesome.
(B) would be cool but I feel that if I've already saved a query I probably want to continue saving it, so being forced to save these isn't as necessary of a feature.
I think what I would like to have would be best described as the behaviour that I know from Sublime Text:
If I close the program, it just doesn't bother me. Everything stays the exact same way.
A saved Query that was opened:
A Query never saved:
A Query once saved but modified:
Get's opened and restored just like before, nothing is written do disk from the users perspective.
The key point for me is: I never need to bother on closing the program, especially when I shut down my computer in a rush.
Of course, it would be nice to have it like (b) in the way Notepad++ it does. But - in my point of view - the difference between (a) and (b) is more like a 90% and 100% solution. To get the feature faster, (a) will be a great step.
Moreover, on a quick estimate and not knowing anything about Linqpad internals, I can't see why (b) is a much bigger step. On close, save all files as they are in a temporary location. On load check, if the origin file is deleted or is different from temp -> file must be marked as unsaved; otherwise not.
I also do this by killing the Linqpad-process, please add this feature.
Mike D. commented
Notepad ++ does this and it is very handy. Please implement!
Please, please, please. I'd buy LINQPad again just for this feature.
This would make Linqpad literally the best thing ever.
Adam C commented
I quite often have 8-10 unsaved scratch queries as well but every so often killing the process loses the scratch queries.
Additionally, I want all queries restored on load, not just the unsaved one's.
Notepad++ is a great example of this functionality.
We use LINQPad for measurement automation among other things (kicks LabView's ass!). I typically have a query that controls my function generator, another one grabs an oscilloscope screenshot, another one pulls an S11 sweep from a network analyzer and so on.
These queries are all unnamed. I'll usually start with a saved query that has the basic functionality and tweak it for the task at hand.
Often, such queries are only relevant for a few days while I'm working on a problem. Then they can be thrown away. Autosave would be great, since then I wouldn't have to think of a name and location for each of these.
I would like it to work like my oscilloscope: just push the power button to turn it off. No questions. When I turn it on again, I'm back to what I was doing.
Sublime Text works like that and I love it. No questions when closing the program. It only asks if you are closing a specific file.
This would be a brilliant time saver.
Josh Buedel commented
Notepad++ does this. In the options it is called "Enable session snapshot and periodic backup", and is quite helpful. Unsaved tabs just open right back up. Very convenient.
Exactly the same for me, it would be nice when it behaves like sublime text, just keep them "open" for next session" e.g. linqpad saves them for us to come back to until we close them explicitly...
Chris Berger commented
I know it's cliche, but I felt the need to add this: http://cdn.memegenerator.net/instances/500x/44672582.jpg
Drew Noakes commented
Came here to say this. I would love this feature. I've taken to closing LINQPad from Task Manager so that when I reopen it, my query tabs are back to how they were when I left off. Please add this feature! The autosave/restore stuff is already there, so hopefully it's just a config setting and UI change.