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.)
I think it should be similar behavior to what VS Code offers. Saved documents that were modified are just saved, untitled/unsaved documents are persisted in some temp area (in Local portion of user profile) and all of them are reopened next time LinqPad is started, in the same tab order. Thanks.
Union Palenshus commented
Came here to request this feature and found out I'm in good company. I use the same workaround as everyone else, killing it with taskman, but this would make a lot more sense. Notepad++'s solution would work great for this. Joe, any update on this? Thanks!
Chris Core commented
Infact, just implementing the behaviour that already exists when killing the LINQPad process would work perfectly well imo.
Chris Core commented
@Daddy, you can do this now (although with a bit of workaround) by killing the LINQPad process in task manager. Seems that LINQPad has some kind of crash recovery built into it, so doing this will prompt you to re-open unsaved queries next time you launch :)
R.e the feature behaviour, I also think it would be great to emulate the way that notepad++ deals with this.
Option (a) would be nice, but (b) would be better.
What I'm actually hoping for would just be to keep a list of open tabs (saved or not) that will be opened, but have that setting be localized. That way if I have two different portable deployments of LINQPad for different contexts, then I could open either of those windows and get back the tabs I was working on previously, for that specific portable deployment.
This would be awesome!!! thanks for considering it!
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.