提交 efe38fc1 编写于 作者: I isidor

strict null checks: terminalSupport

上级 630eb0ef
......@@ -33,6 +33,7 @@
"./vs/workbench/services/timer/**/*.ts",
"./vs/workbench/contrib/webview/**/*.ts",
"./vs/workbench/contrib/debug/common/**/*.ts",
"./vs/workbench/contrib/debug/browser/**/*.ts",
"./vs/workbench/contrib/debug/node/**/*.ts",
"./vs/workbench/contrib/preferences/common/**/*.ts",
"./vs/workbench/contrib/preferences/**/settings*.ts",
......@@ -155,26 +156,10 @@
"./vs/workbench/contrib/comments/electron-browser/commentsTreeViewer.ts",
"./vs/workbench/contrib/comments/electron-browser/reactionsAction.ts",
"./vs/workbench/contrib/comments/electron-browser/simpleCommentEditor.ts",
"./vs/workbench/contrib/debug/browser/baseDebugView.ts",
"./vs/workbench/contrib/debug/browser/breakpointsView.ts",
"./vs/workbench/contrib/debug/browser/debugANSIHandling.ts",
"./vs/workbench/contrib/debug/browser/debugActionItems.ts",
"./vs/workbench/contrib/debug/browser/debugActions.ts",
"./vs/workbench/contrib/debug/browser/debugCommands.ts",
"./vs/workbench/contrib/debug/browser/debugContentProvider.ts",
"./vs/workbench/contrib/debug/browser/debugEditorActions.ts",
"./vs/workbench/contrib/debug/browser/debugEditorModelManager.ts",
"./vs/workbench/contrib/debug/browser/debugQuickOpen.ts",
"./vs/workbench/contrib/debug/browser/debugStatus.ts",
"./vs/workbench/contrib/debug/browser/debugToolbar.ts",
"./vs/workbench/contrib/debug/browser/debugViewlet.ts",
"./vs/workbench/contrib/debug/browser/exceptionWidget.ts",
"./vs/workbench/contrib/debug/browser/linkDetector.ts",
"./vs/workbench/contrib/debug/browser/loadedScriptsView.ts",
"./vs/workbench/contrib/debug/browser/statusbarColorProvider.ts",
"./vs/workbench/contrib/debug/electron-browser/breakpointWidget.ts",
"./vs/workbench/contrib/debug/electron-browser/debugEditorContribution.ts",
"./vs/workbench/contrib/debug/electron-browser/debugHover.ts",
"./vs/workbench/contrib/debug/electron-browser/terminalSupport.ts",
"./vs/workbench/contrib/debug/electron-browser/debugSession.ts",
"./vs/workbench/contrib/debug/electron-browser/electronDebugActions.ts",
"./vs/workbench/contrib/debug/electron-browser/rawDebugSession.ts",
......
......@@ -9,10 +9,11 @@ import { ITerminalService, ITerminalInstance } from 'vs/workbench/contrib/termin
import { IExternalTerminalService } from 'vs/workbench/contrib/externalTerminal/common/externalTerminal';
import { ITerminalLauncher, ITerminalSettings } from 'vs/workbench/contrib/debug/common/debug';
import { hasChildProcesses, prepareCommand } from 'vs/workbench/contrib/debug/node/terminals';
import { IProcessEnvironment } from 'vs/base/common/platform';
export class TerminalLauncher implements ITerminalLauncher {
private integratedTerminalInstance: ITerminalInstance;
private integratedTerminalInstance: ITerminalInstance | undefined;
private terminalDisposedListener: IDisposable;
constructor(
......@@ -24,20 +25,20 @@ export class TerminalLauncher implements ITerminalLauncher {
runInTerminal(args: DebugProtocol.RunInTerminalRequestArguments, config: ITerminalSettings): Promise<number | undefined> {
if (args.kind === 'external') {
return this.externalTerminalService.runInTerminal(args.title, args.cwd, args.args, args.env || {});
return this.externalTerminalService.runInTerminal(args.title || '', args.cwd, args.args, <IProcessEnvironment>args.env || {});
}
if (!this.terminalDisposedListener) {
// React on terminal disposed and check if that is the debug terminal #12956
this.terminalDisposedListener = this.terminalService.onInstanceDisposed(terminal => {
if (this.integratedTerminalInstance && this.integratedTerminalInstance.id === terminal.id) {
this.integratedTerminalInstance = null;
this.integratedTerminalInstance = undefined;
}
});
}
let t = this.integratedTerminalInstance;
if ((t && hasChildProcesses(t.processId)) || !t) {
if ((t && (typeof t.processId === 'number') && hasChildProcesses(t.processId)) || !t) {
t = this.terminalService.createTerminal({ name: args.title || nls.localize('debug.terminal.title', "debuggee") });
this.integratedTerminalInstance = t;
}
......@@ -45,14 +46,13 @@ export class TerminalLauncher implements ITerminalLauncher {
this.terminalService.showPanel(true);
return new Promise<number | undefined>((resolve, error) => {
if (typeof t.processId === 'number') {
if (t && typeof t.processId === 'number') {
// no need to wait
resolve(t.processId);
}
// shell not ready: wait for ready event
const toDispose = t.onProcessIdReady(t => {
const toDispose = t!.onProcessIdReady(t => {
toDispose.dispose();
resolve(t.processId);
});
......@@ -65,7 +65,7 @@ export class TerminalLauncher implements ITerminalLauncher {
}).then(shellProcessId => {
const command = prepareCommand(args, config);
t.sendText(command, true);
t!.sendText(command, true);
return shellProcessId;
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册