Skip to content

Commit efe38fc

Browse files
committed
strict null checks: terminalSupport
1 parent 630eb0e commit efe38fc

2 files changed

Lines changed: 10 additions & 25 deletions

File tree

src/tsconfig.strictNullChecks.json

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"./vs/workbench/services/timer/**/*.ts",
3434
"./vs/workbench/contrib/webview/**/*.ts",
3535
"./vs/workbench/contrib/debug/common/**/*.ts",
36+
"./vs/workbench/contrib/debug/browser/**/*.ts",
3637
"./vs/workbench/contrib/debug/node/**/*.ts",
3738
"./vs/workbench/contrib/preferences/common/**/*.ts",
3839
"./vs/workbench/contrib/preferences/**/settings*.ts",
@@ -155,26 +156,10 @@
155156
"./vs/workbench/contrib/comments/electron-browser/commentsTreeViewer.ts",
156157
"./vs/workbench/contrib/comments/electron-browser/reactionsAction.ts",
157158
"./vs/workbench/contrib/comments/electron-browser/simpleCommentEditor.ts",
158-
"./vs/workbench/contrib/debug/browser/baseDebugView.ts",
159-
"./vs/workbench/contrib/debug/browser/breakpointsView.ts",
160-
"./vs/workbench/contrib/debug/browser/debugANSIHandling.ts",
161-
"./vs/workbench/contrib/debug/browser/debugActionItems.ts",
162-
"./vs/workbench/contrib/debug/browser/debugActions.ts",
163-
"./vs/workbench/contrib/debug/browser/debugCommands.ts",
164-
"./vs/workbench/contrib/debug/browser/debugContentProvider.ts",
165-
"./vs/workbench/contrib/debug/browser/debugEditorActions.ts",
166-
"./vs/workbench/contrib/debug/browser/debugEditorModelManager.ts",
167-
"./vs/workbench/contrib/debug/browser/debugQuickOpen.ts",
168-
"./vs/workbench/contrib/debug/browser/debugStatus.ts",
169-
"./vs/workbench/contrib/debug/browser/debugToolbar.ts",
170-
"./vs/workbench/contrib/debug/browser/debugViewlet.ts",
171-
"./vs/workbench/contrib/debug/browser/exceptionWidget.ts",
172-
"./vs/workbench/contrib/debug/browser/linkDetector.ts",
173-
"./vs/workbench/contrib/debug/browser/loadedScriptsView.ts",
174-
"./vs/workbench/contrib/debug/browser/statusbarColorProvider.ts",
175159
"./vs/workbench/contrib/debug/electron-browser/breakpointWidget.ts",
176160
"./vs/workbench/contrib/debug/electron-browser/debugEditorContribution.ts",
177161
"./vs/workbench/contrib/debug/electron-browser/debugHover.ts",
162+
"./vs/workbench/contrib/debug/electron-browser/terminalSupport.ts",
178163
"./vs/workbench/contrib/debug/electron-browser/debugSession.ts",
179164
"./vs/workbench/contrib/debug/electron-browser/electronDebugActions.ts",
180165
"./vs/workbench/contrib/debug/electron-browser/rawDebugSession.ts",

src/vs/workbench/contrib/debug/electron-browser/terminalSupport.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ import { ITerminalService, ITerminalInstance } from 'vs/workbench/contrib/termin
99
import { IExternalTerminalService } from 'vs/workbench/contrib/externalTerminal/common/externalTerminal';
1010
import { ITerminalLauncher, ITerminalSettings } from 'vs/workbench/contrib/debug/common/debug';
1111
import { hasChildProcesses, prepareCommand } from 'vs/workbench/contrib/debug/node/terminals';
12+
import { IProcessEnvironment } from 'vs/base/common/platform';
1213

1314
export class TerminalLauncher implements ITerminalLauncher {
1415

15-
private integratedTerminalInstance: ITerminalInstance;
16+
private integratedTerminalInstance: ITerminalInstance | undefined;
1617
private terminalDisposedListener: IDisposable;
1718

1819
constructor(
@@ -24,35 +25,34 @@ export class TerminalLauncher implements ITerminalLauncher {
2425
runInTerminal(args: DebugProtocol.RunInTerminalRequestArguments, config: ITerminalSettings): Promise<number | undefined> {
2526

2627
if (args.kind === 'external') {
27-
return this.externalTerminalService.runInTerminal(args.title, args.cwd, args.args, args.env || {});
28+
return this.externalTerminalService.runInTerminal(args.title || '', args.cwd, args.args, <IProcessEnvironment>args.env || {});
2829
}
2930

3031
if (!this.terminalDisposedListener) {
3132
// React on terminal disposed and check if that is the debug terminal #12956
3233
this.terminalDisposedListener = this.terminalService.onInstanceDisposed(terminal => {
3334
if (this.integratedTerminalInstance && this.integratedTerminalInstance.id === terminal.id) {
34-
this.integratedTerminalInstance = null;
35+
this.integratedTerminalInstance = undefined;
3536
}
3637
});
3738
}
3839

3940
let t = this.integratedTerminalInstance;
40-
if ((t && hasChildProcesses(t.processId)) || !t) {
41+
if ((t && (typeof t.processId === 'number') && hasChildProcesses(t.processId)) || !t) {
4142
t = this.terminalService.createTerminal({ name: args.title || nls.localize('debug.terminal.title', "debuggee") });
4243
this.integratedTerminalInstance = t;
4344
}
4445
this.terminalService.setActiveInstance(t);
4546
this.terminalService.showPanel(true);
4647

4748
return new Promise<number | undefined>((resolve, error) => {
48-
49-
if (typeof t.processId === 'number') {
49+
if (t && typeof t.processId === 'number') {
5050
// no need to wait
5151
resolve(t.processId);
5252
}
5353

5454
// shell not ready: wait for ready event
55-
const toDispose = t.onProcessIdReady(t => {
55+
const toDispose = t!.onProcessIdReady(t => {
5656
toDispose.dispose();
5757
resolve(t.processId);
5858
});
@@ -65,7 +65,7 @@ export class TerminalLauncher implements ITerminalLauncher {
6565
}).then(shellProcessId => {
6666

6767
const command = prepareCommand(args, config);
68-
t.sendText(command, true);
68+
t!.sendText(command, true);
6969

7070
return shellProcessId;
7171
});

0 commit comments

Comments
 (0)