拡張機能をインストール
Terminal Keeper という拡張機能をインストールします。
設定ファイルを作成
コマンドパレットを開き、「Terminal Keeper: Active Terminal Session」を実行し、「Yes」を選択します。
すると設定ファイルが生成されます。
生成された設定ファイルにVSCode起動時に実行したいコマンドやアイコンなどを記述します。
.vscode/sessions.json
{
"$schema": "https://cdn.statically.io/gh/nguyenngoclongdev/cdn/main/schema/v10/terminal-keeper.json",
"theme": "tribe",
"active": "default",
"activateOnStartup": true,
"keepExistingTerminals": false,
"sessions": {
"default": [
{
"name": "rails",
"autoExecuteCommands": true,
"icon": "ruby",
"color": "terminal.ansiRed",
"commands": ["rails s"]
},
]
}
}
上記の場合には起動時にターミナルが起動し、 rails s
コマンドが実行されます。
設定項目の詳細については以下をご確認ください。