You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

25 lines
669 B

import type { Disposable, Terminal } from 'vscode';
import { window } from 'vscode';
import { Container } from './container';
let _terminal: Terminal | undefined;
let _disposable: Disposable | undefined;
const extensionTerminalName = 'GitLens';
export function ensureGitTerminal(): Terminal {
if (_terminal == null) {
_terminal = window.createTerminal(extensionTerminalName);
_disposable = window.onDidCloseTerminal((e: Terminal) => {
if (e.name === extensionTerminalName) {
_terminal = undefined;
_disposable?.dispose();
_disposable = undefined;
}
});
Container.instance.context.subscriptions.push(_disposable);
}
return _terminal;
}