Skip to content

Commit a7ef42a

Browse files
committed
Fix strict null errors related to getActivePanel
1 parent 8d07776 commit a7ef42a

4 files changed

Lines changed: 5 additions & 4 deletions

File tree

src/vs/workbench/browser/actions/navigationActions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ abstract class BaseNavigationAction extends Action {
6868
return false;
6969
}
7070

71-
const activePanelId = this.panelService.getActivePanel().getId();
71+
const activePanelId = this.panelService.getActivePanel()!.getId();
7272

7373
return this.panelService.openPanel(activePanelId, true);
7474
}

src/vs/workbench/browser/panel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export abstract class TogglePanelAction extends Action {
9595
private isPanelActive(): boolean {
9696
const activePanel = this.panelService.getActivePanel();
9797

98-
return activePanel && activePanel.getId() === this.panelId;
98+
return !!activePanel && activePanel.getId() === this.panelId;
9999
}
100100

101101
private isPanelFocused(): boolean {

src/vs/workbench/contrib/terminal/electron-browser/terminalInstance.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ export class TerminalInstance implements ITerminalInstance {
924924

925925
private _refreshSelectionContextKey() {
926926
const activePanel = this._panelService.getActivePanel();
927-
const isActive = activePanel && activePanel.getId() === TERMINAL_PANEL_ID;
927+
const isActive = !!activePanel && activePanel.getId() === TERMINAL_PANEL_ID;
928928

929929
this._terminalHasTextContextKey.set(isActive && this.hasSelection());
930930
}

src/vs/workbench/services/timer/electron-browser/timerService.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@ class TimerService implements ITimerService {
378378
}
379379

380380
const activeViewlet = this._viewletService.getActiveViewlet();
381+
const activePanel = this._panelService.getActivePanel();
381382
return {
382383
version: 2,
383384
ellapsed: perf.getDuration(startMark, 'didStartWorkbench'),
@@ -389,7 +390,7 @@ class TimerService implements ITimerService {
389390
windowCount: await this._windowsService.getWindowCount(),
390391
viewletId: activeViewlet ? activeViewlet.getId() : undefined,
391392
editorIds: this._editorService.visibleEditors.map(input => input.getTypeId()),
392-
panelId: this._panelService.getActivePanel() ? this._panelService.getActivePanel().getId() : undefined,
393+
panelId: activePanel ? activePanel.getId() : undefined,
393394

394395
// timers
395396
timers: {

0 commit comments

Comments
 (0)