-
Notifications
You must be signed in to change notification settings - Fork 29.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restore terminal sessions between restarts #44302
Comments
I'm posting my thoughts about this, since I've tackled this issue with my Terminals extension.
Restoring shell, args and env: I might be wrong on this but I think one can't even set these variables on a per-terminal basis when creating terminals manually, so we would be either restoring terminals with default shell, args and env (nothing to restore basically), or terminals created by extensions, which are going to get recreated by those extensions anyway (there's no way of getting a list of opened terminals, so those extensions can't re-use restored terminals even if they wanted to). Restoring layout: this is certainly useful, but I personally don't like if throwaway/temporary terminals get restored. And there's no way of knowing which terminal is important and which isn't without providing some kind of configuration.
IMHO the real value comes from restoring commands as well as the layout, and possibly outputs too. Given the relatively low value of a restored layout without commands/output and the problem with duplicated terminals that get recreated by extensions I think it's not worth implementing this into the core.
I personally don't use tasks at all, and I'm not sure how terminals have anything to do with debug, what do you mean exactly? While we're at it, these are a few API suggestions that would allow me to provide a more powerful/complete extension:
|
You can have debuggers run their processes inside the terminal, I think the main benefit here is you get to see the stdout of the process.
While possible to do, I'm not convinced this would be useful if the process needs to be recreated?
I think we need this #45407
|
I think it depends on the output, for my use cases this wouldn't be particularly valuable either, but maybe it would be useful for all those times one finds himself scrolling back the terminal. |
Other than my 👍 , the only thing I would want to ask for is to extend this from just restarts into having configurations associated with workspaces/folders Which of course, @fabiospampinato's extension does wonderfully, but if we end up with an "official" api for this, it could enable core and/or other extensions to hook into the functionality. |
The result of the investigation this iteration is:
|
@Tyriar my biggest use case is to reconnect to a running " |
@Tyriar the payoff is that the VS Code team could selfhost on the integrated terminal without tmux (which brakes basically everything), so I would give it a shot :) |
I'm planning on removing the experimentalRestore setting in August. |
I removed the experimentalRestore setting as I don't think it's the direction we're going to go in and I'm concerned about bugs/stability issues it could be causing. |
Confirming that if I have a Java process running in the terminal, after a window reload (e.g. installed an extension) the Java process remains running but now in the background, and a new blank terminal loads in the window.
|
@brunoborges please create an issue with repro steps and OS/vscode version details. |
@Tyriar Isn't the issue the same? |
@brunoborges aren't you pointing out this:
The process should be killed? This issue is a feature request about retaining terminal processes across window reload, currently the expected behavior is to kill all terminal processes. |
The process should not be killed. And the terminal should be retained. |
@brunoborges for that behavior is this feature request. Until this issue is handled, all the processes are meant to be killed when you close VS Code, you indicated that this is not the case currently. |
@Tyriar That is correct. But I'd rather see this feature implemented than that bug fixed. Priorities :) |
First step should be to reopen VSCode and have restored terminals, their names, and paths. If the processes have to be killed and restarted then that can the second step. I can live with restarting my processes if I have to but reopening my terminals and going to the correct paths is time consuming. |
@Tyriar So what's the status on this 🙂 Still split terminals don't get restored on restart. |
We have no plans on restoring sessions like this as the experiment I built earlier ended up revealing it would be a lot of code/config to get this right. Instead we're opting for extensions like Terminals Manager to take up this role which will be able to cater to complex setups better. Currently the API is limited in this area around splitting, vote on #45407 to help bump that up. |
This issue is being closed to keep the number of issues in our inbox on a manageable level, we are closing issues that are not going to be addressed in the foreseeable future: We look at the number of votes the issue has received and the number of duplicate issues filed. More details here. If you disagree and feel that this issue is crucial: We are happy to listen and to reconsider. If you wonder what we are up to, please see our roadmap and issue reporting guidelines. Thanks for your understanding and happy coding! |
I made an extension to do just this https://marketplace.visualstudio.com/items?itemName=EthanSK.restore-terminals |
All the extensions proposed as solutions expect me to decide in advance which terminals I want opened with a workspace. What I want is that terminals I have started are restarted the next time I open the workspace. Basically I would like the terminals to be a part of the workspace state just like opened files. |
@artm they should be now? See https://code.visualstudio.com/docs/terminal/advanced#_persistent-sessions |
Hmm, doesn't seem to do much for me: I use WSL terminals, after restart one of them might have contents of the last session restored, but I never get multiple terminals back |
@artm it's working for me in both local and wsl windows. Do you input in them when you're testing? Because they only get restored if they had some interaction. Please create another issue with this info as you might be referring to a new bug. |
Forking off from #20013, this issue is about restoring the terminal process shell, args, env and layout (dropdown/splits).
The text was updated successfully, but these errors were encountered: