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.
I need some feedback on this feature. First:
(a) Would you expect it to apply only to untitled queries? Or:
(b) Would you also expect it to apply to saved queries that were modified?
(The reason I ask is that option (a) is simple to implement, whereas option (b) creates numerous complications.)
Marty Casey commented
I could really use this. My workaround of killing the process so LinqPad restores itself when I relaunch it is cumbersome to say the least.
Jude Melancon commented
(b) does no harm over (a) obviously, but (a) would provide most of the benefit to my personal usage.
Shukhrat Nekbaev commented
definitely some solution is required. For example like in Notepad++.
I was also killing the process to preserve, but just now it started clean, I had tabs created in the last two or three weeks (I don't reboot that frequently). You can imagine my frustration ATM :( And it's not the first time either...
P.S. licensed user.
Marc Selman commented
I would really like to see this implemented.
Option (a) is mostly neccessary but for option (b) maybe you could:
Save the query as an untitled query (same as (a)) but save the original saved query file location as meta-data.
Then, when opening Linqpad again, all unsaved queries can open and if there's a file location as meta-data available, just check if that file still exists and open that file and replace the contents with the unsaved query.
Aaron Bauman commented
Automatically save untitled queries.
Ask to save titled queries.
SQLPrompt does this and it hasn't bothered me yet.
Yaroslav Veremenko commented
+1 for behavior like Notepad++ On exit do not save the queries, but load them as it was closed and mark them unsaved.
Pretty pretty please (b). Having this feature would pretty much mean my whole taskbar works the same way. (Notepad++, all the jetbrains stuff (phpstorm, datagrip, dotpeek etc), and chrome)
James Curran commented
I was about to write that I'd be happy with (A), since saving a named file involves just clicking the toolbar icon --- then I realized that LINQPad doesn't have a "Save FIle" icon. GIve me that button, and I'd be happy with option (a).
I wasn't kidding about buying LINQPad again for this feature. I've pre-emptively kept my word by just now buying a 2nd user license. GO LINQPAD!
Joe: in response to your feedback request, I believe mimicking the behaviour of notepad++ would make the community happy, since then we wouldn't need to remember which application behaves in which manner
Carl Kelley commented
I usually have many queries open in LINQPAD 5 when I close it. LINQPAD already prompts me whether to save modified queries before closing. What I'd really like it to do is re-open those queries when I restart LINQPAD so that I don't have to hunt around for them.
I vote for option (b). However, applying it to saved queries means that next time I open LINQPad, their state is all the same, the edits I made are still there, in the editor, but not in the files. A temporary version should be maintained at all times like in Sublime Text.
Drew Noakes commented
Best option is to follow the lead of editors such as Notepad++ and Sublime Text:
When the user closes and reopens the program _NOTHING CHANGES_.
That is, all buffers are exactly as they were. Any unsaved changes are still unchanged.
Once you use this feature for a bit, it feels amazing. There's no cognitive barrier to closing the program, because you know it'll be there when you get back. It mightn't be the easiest to implement, but it's not so bad in reality, and it truly is the gold standard in behaviour, IMHO.
Tim May commented
Adam C commented
(b) -> I would expect it to act like other text / code editors, re-opening everything in the same order and same state as before, just like it does if the task is killed.
It would also be nice sub-feature if we could choose where the session / autosave is stored. Occasionally my restored session is lost and some in-progress queries that I needed were also lost.
but having to choose between a or b, I'd take b so as not to lose anything...
(sorry I went a bit overboard in my previous answer)
My personal use case is that I usually am in a context, tackling a specific problem (like "building a specific export/tool/whatever for client ABC", usually working at or for client ABC at that precise moment. Then at the end of the day, I close shop, ending up with dozens of opened tabs...
During the night, the computer could reboot (the dreaded update, or whatever)... or I could have to run to school fetch the kids, or whatever, closing the computer in haste... risking losing all my tabs...
Or in between work sessions for client ABC, there could a session for client DEF...
Ideally, for me, I could just close the app, it would save the context of that specific moment, and I could reopen the app afterwards, choose the saved context from a list (by date, if not named, by name like "context client ABC" "work for DEF" or "ABC" and "DEF", If I took premptively the time to name that context, or change the name afterwards... ) and "voila" I would be back to the point I left.
Optionally, context "ABC" from week04 would coexist with context "ABC" from week07... ;)
Mike D. commented
I vote for (b).
Feature (a) is also nice, but, if there are both untitled files and modified saved files in the session, the behavior of (a) may cause some confusion.
I think the behavior of (b) is easy to understand for users, because all unsaved modifications are kept.
Option (a) is what what I am looking for.