Is it possible to have the Integrated Terminal open automatically on start of Visual Studio Code?

杀马特。学长 韩版系。学妹 提交于 2020-07-08 12:00:08

问题


Is it possible to configure User Settings to have the Integrated Terminal to start automatically when opening Visual Studio Code?


回答1:


The following has worked for me:

// Whether to restore terminal sessions for the workspace automatically when launching VS Code. This is an experimental setting; it may be buggy and could change in the future.

Paste the below in your user settings:

"terminal.integrated.experimentalRestore": true




回答2:


There is now an extension that lets you set terminals on startup, and even works with split terminal views!

https://marketplace.visualstudio.com/items?itemName=EthanSK.restore-terminals

ps i wrote it




回答3:


As of v1.45.0, the setting mentioned in the other answer has no effect anymore and is grayed-out and marked as "Unknown Configuration Setting" when you put it in settings.json. It seems they removed it in https://github.com/microsoft/vscode/issues/44302#issuecomment-410818051:

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.

Currently, on my VS Code setup, it remembers the last state of my workspace and restores it. If I have the Integrated Terminal panel opened before I closed the window, it gets reopened when I reload or reopen the workspace (I can't seem to find the setting for this though). So basically, the Integrated Terminal is already auto displayed. (I use Ubuntu 18 and macOS 10.15.)

If you have a specific terminal setup (ex. multiple terminals opened to different directories, python envs, workspaces, etc.), you could check out Terminals Manager which is for "setting-up multiple terminals at once" and can be configured to auto-run on startup.

You just need to add a terminals.json file in your workspace (under .vscode) with something like this, and set autorun to true. This would auto-run the Terminals: Run command on startup, and restore your terminal setup on startup.

{
    "autorun": true,
    "autokill": true,
    "terminals": [
        {
            "name": "GIT",
            "description": "For running git commands",
            "open": true,
            "focus": true,
            "commands": [
                "pwd",
                "git fetch -v"
            ]
        },
        {
            "name": "BUILD",
            "description": "For running build commands",
            "open": true,
            "focus": false,
            "commands": [
                "cd apps",
                "./clean.sh"
            ]
        },
        {
            "name": "SCRIPTS",
            "description": "For running python commands",
            "open": true,
            "focus": false,
            "commands": [
                "source $VENV_DIR/test-py38/bin/activate",
                "python -V"
            ]
        },
    ]
}


来源:https://stackoverflow.com/questions/45957618/is-it-possible-to-have-the-integrated-terminal-open-automatically-on-start-of-vi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!