Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add setting to reuse an existing terminal window #37

Merged
merged 2 commits into from
Oct 21, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@
"Use the preview version of Windows Terminal"
]
},
"windowsTerminal.reuseExistingWindow": {
"type": "boolean",
"default": false,
"description": "Whether to reuse an existing Windows Terminal window."
},
"windowsTerminal.explorer.showOpen": {
"type": "boolean",
"default": true,
Expand Down
6 changes: 6 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,18 @@ async function refreshInstallation(force: boolean = false) {
}

async function openWindowsTerminal(profile: IWTProfile, uri?: vscode.Uri) {
const config = vscode.workspace.getConfiguration('windowsTerminal');
const reuseWindow = config.get<boolean>('reuseExistingWindow');

await refreshInstallation();
if (!installation) {
return;
}

const args = ['-p', profile.name];
if (reuseWindow) {
args.splice(0, 0, '-w', '0');
}

// If there is no URI, set it to the first workspace folder
if (!uri) {
Expand Down