Skip to content

Restore terminal sessions between restarts #44302

Closed

Description

@Tyriar

Forking off from #20013, this issue is about restoring the terminal process shell, args, env and layout (dropdown/splits).

Activity

  1. added
    feature-request
    terminal
    on Feb 23, 2018
  2. fabiospampinato commented on Mar 9, 2018

    @fabiospampinato
    Contributor

    I'm posting my thoughts about this, since I've tackled this issue with my Terminals extension.

    this issue is about restoring the terminal process shell, args, env and layout

    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.

    it would be good to have some basic restoring if it won't get in the way, we certainly wouldn't want to add the complexity that this extension allows.

    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 need to do some thinking about it, how it interacts with tasks and debug

    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:

    • Output restoration: It would be cool if we could restore the output of the terminals, for doing so I think a couple of APIs for reading and replacing a terminal's content are necessary.
    • Splits restoration: As mentioned here an API for splitting terminals would be necessary in order to add this functionality.
    • Listing all the terminals: Providing an array of all the opened terminals could be useful.
  3. Tyriar commented on Mar 9, 2018

    @Tyriar
    ContributorAuthor

    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?

    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.

    Output restoration

    While possible to do, I'm not convinced this would be useful if the process needs to be recreated?

    Splits restoration

    I think we need this #45407

    Listing all the terminals

    #13267

  4. fabiospampinato commented on Mar 9, 2018

    @fabiospampinato
    Contributor

    I'm not convinced this would be useful if the process needs to be recreated?

    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.

  5. M-Zuber commented on Mar 11, 2018

    @M-Zuber

    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, Fabio Spampinato (@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.

  6. added
    under-discussion
    and removed
    feature-request
    on Mar 19, 2018
  7. 19 remaining items

  8. brunoborges commented on Sep 21, 2018

    @brunoborges
    Member

    The process should not be killed. And the terminal should be retained.

  9. Tyriar commented on Sep 23, 2018

    @Tyriar
    ContributorAuthor

    Bruno Borges (@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.

  10. brunoborges commented on Sep 24, 2018

    @brunoborges
    Member

    Daniel Imms (@Tyriar) That is correct. But I'd rather see this feature implemented than that bug fixed. Priorities :)

  11. wallzero commented on Jan 25, 2019

    @wallzero

    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.

  12. mrfloppi commented on Jul 8, 2019

    @mrfloppi

    Daniel Imms (@Tyriar) So what's the status on this 🙂 Still split terminals don't get restored on restart.

  13. Tyriar commented on Oct 8, 2019

    @Tyriar
    ContributorAuthor

    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.

  14. added
    *out-of-scope
    on Oct 8, 2019
  15. vscodebot commented on Oct 8, 2019

    @vscodebot

    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!

  16. EthanSK commented on Jun 26, 2020

    @EthanSK
  17. artm commented on Nov 24, 2022

    @artm

    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.

  18. artm commented on Dec 2, 2022

    @artm

    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

  19. Tyriar commented on Dec 2, 2022

    @Tyriar
    ContributorAuthor

    Artem Baguinski (@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.

  20. locked as resolved and limited conversation to collaborators on Dec 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

*out-of-scopeterminalunder-discussion

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions