From 31cd6aea845f3c5ea5d526211bfbd73c474451d3 Mon Sep 17 00:00:00 2001 From: isidor Date: Tue, 6 Aug 2019 10:50:20 +0200 Subject: [PATCH] strictPropertyInitialization #78168 --- .../browser/debugConfigurationManager.ts | 2 +- .../debug/browser/debugEditorContribution.ts | 14 +++++++---- .../debug/browser/debugEditorModelManager.ts | 2 +- .../contrib/debug/browser/debugHover.ts | 19 ++++++++------- .../contrib/debug/browser/debugQuickOpen.ts | 2 +- .../contrib/debug/browser/debugService.ts | 2 +- .../contrib/debug/browser/debugToolBar.ts | 7 +++--- .../debug/browser/loadedScriptsView.ts | 18 +++++++-------- .../contrib/debug/browser/rawDebugSession.ts | 23 +++++++------------ .../contrib/debug/browser/variablesView.ts | 4 ++-- .../debug/browser/watchExpressionsView.ts | 4 ++-- .../debug/common/abstractDebugAdapter.ts | 6 ++--- 12 files changed, 49 insertions(+), 54 deletions(-) diff --git a/src/vs/workbench/contrib/debug/browser/debugConfigurationManager.ts b/src/vs/workbench/contrib/debug/browser/debugConfigurationManager.ts index df8a68cbc6725..6ace957453ca9 100644 --- a/src/vs/workbench/contrib/debug/browser/debugConfigurationManager.ts +++ b/src/vs/workbench/contrib/debug/browser/debugConfigurationManager.ts @@ -44,7 +44,7 @@ const DEBUG_SELECTED_ROOT = 'debug.selectedroot'; export class ConfigurationManager implements IConfigurationManager { private debuggers: Debugger[]; private breakpointModeIdsSet = new Set(); - private launches: ILaunch[]; + private launches!: ILaunch[]; private selectedName: string | undefined; private selectedLaunch: ILaunch | undefined; private toDispose: IDisposable[]; diff --git a/src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts b/src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts index 1b6dbbb7d5f3d..2074a14ab74b4 100644 --- a/src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts +++ b/src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts @@ -57,8 +57,8 @@ export class DebugEditorContribution implements IDebugEditorContribution { private toDispose: lifecycle.IDisposable[]; private hoverWidget: DebugHoverWidget; - private nonDebugHoverPosition: Position; - private hoverRange: Range; + private nonDebugHoverPosition: Position | undefined; + private hoverRange: Range | null = null; private mouseDown = false; private breakpointHintDecoration: string[]; @@ -68,7 +68,7 @@ export class DebugEditorContribution implements IDebugEditorContribution { private exceptionWidget: ExceptionWidget | undefined; - private configurationWidget: FloatingClickWidget; + private configurationWidget: FloatingClickWidget | undefined; constructor( private editor: ICodeEditor, @@ -377,7 +377,11 @@ export class DebugEditorContribution implements IDebugEditorContribution { @memoize private get showHoverScheduler(): RunOnceScheduler { - const scheduler = new RunOnceScheduler(() => this.showHover(this.hoverRange, false), HOVER_DELAY); + const scheduler = new RunOnceScheduler(() => { + if (this.hoverRange) { + this.showHover(this.hoverRange, false); + } + }, HOVER_DELAY); this.toDispose.push(scheduler); return scheduler; @@ -398,7 +402,7 @@ export class DebugEditorContribution implements IDebugEditorContribution { @memoize private get provideNonDebugHoverScheduler(): RunOnceScheduler { const scheduler = new RunOnceScheduler(() => { - if (this.editor.hasModel()) { + if (this.editor.hasModel() && this.nonDebugHoverPosition) { getHover(this.editor.getModel(), this.nonDebugHoverPosition, CancellationToken.None); } }, HOVER_DELAY); diff --git a/src/vs/workbench/contrib/debug/browser/debugEditorModelManager.ts b/src/vs/workbench/contrib/debug/browser/debugEditorModelManager.ts index 9a4cdf0bb6ece..84dd90e705604 100644 --- a/src/vs/workbench/contrib/debug/browser/debugEditorModelManager.ts +++ b/src/vs/workbench/contrib/debug/browser/debugEditorModelManager.ts @@ -36,7 +36,7 @@ export class DebugEditorModelManager implements IWorkbenchContribution { static readonly STICKINESS = TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges; private modelDataMap: Map; private toDispose: lifecycle.IDisposable[]; - private ignoreDecorationsChangedEvent: boolean; + private ignoreDecorationsChangedEvent = false; constructor( @IModelService private readonly modelService: IModelService, diff --git a/src/vs/workbench/contrib/debug/browser/debugHover.ts b/src/vs/workbench/contrib/debug/browser/debugHover.ts index 37e81c80c5242..f06919be1d914 100644 --- a/src/vs/workbench/contrib/debug/browser/debugHover.ts +++ b/src/vs/workbench/contrib/debug/browser/debugHover.ts @@ -41,17 +41,16 @@ export class DebugHoverWidget implements IContentWidget { allowEditorOverflow = true; private _isVisible: boolean; - private domNode: HTMLElement; - private tree: AsyncDataTree; + private domNode!: HTMLElement; + private tree!: AsyncDataTree; private showAtPosition: Position | null; private highlightDecorations: string[]; - private complexValueContainer: HTMLElement; - private complexValueTitle: HTMLElement; - private valueContainer: HTMLElement; - private treeContainer: HTMLElement; + private complexValueContainer!: HTMLElement; + private complexValueTitle!: HTMLElement; + private valueContainer!: HTMLElement; + private treeContainer!: HTMLElement; private toDispose: lifecycle.IDisposable[]; - private scrollbar: DomScrollableElement; - private dataSource: DebugHoverDataSource; + private scrollbar!: DomScrollableElement; constructor( private editor: ICodeEditor, @@ -72,10 +71,10 @@ export class DebugHoverWidget implements IContentWidget { this.complexValueTitle = dom.append(this.complexValueContainer, $('.title')); this.treeContainer = dom.append(this.complexValueContainer, $('.debug-hover-tree')); this.treeContainer.setAttribute('role', 'tree'); - this.dataSource = new DebugHoverDataSource(); + const dataSource = new DebugHoverDataSource(); this.tree = this.instantiationService.createInstance(WorkbenchAsyncDataTree, this.treeContainer, new DebugHoverDelegate(), [this.instantiationService.createInstance(VariablesRenderer)], - this.dataSource, { + dataSource, { ariaLabel: nls.localize('treeAriaLabel', "Debug Hover"), accessibilityProvider: new DebugHoverAccessibilityProvider(), mouseSupport: false, diff --git a/src/vs/workbench/contrib/debug/browser/debugQuickOpen.ts b/src/vs/workbench/contrib/debug/browser/debugQuickOpen.ts index d75f5a9b0dff3..64a399d212f3f 100644 --- a/src/vs/workbench/contrib/debug/browser/debugQuickOpen.ts +++ b/src/vs/workbench/contrib/debug/browser/debugQuickOpen.ts @@ -77,7 +77,7 @@ export class DebugQuickOpenHandler extends QuickOpenHandler { public static readonly ID = 'workbench.picker.launch'; - private autoFocusIndex: number; + private autoFocusIndex: number | undefined; constructor( @IDebugService private readonly debugService: IDebugService, diff --git a/src/vs/workbench/contrib/debug/browser/debugService.ts b/src/vs/workbench/contrib/debug/browser/debugService.ts index 1ae35d5a2482b..da261aa003295 100644 --- a/src/vs/workbench/contrib/debug/browser/debugService.ts +++ b/src/vs/workbench/contrib/debug/browser/debugService.ts @@ -87,7 +87,7 @@ export class DebugService implements IDebugService { private inDebugMode: IContextKey; private breakpointsToSendOnResourceSaved: Set; private initializing = false; - private previousState: State; + private previousState: State | undefined; constructor( @IStorageService private readonly storageService: IStorageService, diff --git a/src/vs/workbench/contrib/debug/browser/debugToolBar.ts b/src/vs/workbench/contrib/debug/browser/debugToolBar.ts index dc603f4eedb88..5146eac7f7810 100644 --- a/src/vs/workbench/contrib/debug/browser/debugToolBar.ts +++ b/src/vs/workbench/contrib/debug/browser/debugToolBar.ts @@ -55,10 +55,10 @@ export class DebugToolBar extends Themable implements IWorkbenchContribution { private activeActions: IAction[]; private updateScheduler: RunOnceScheduler; private debugToolBarMenu: IMenu; - private disposeOnUpdate: IDisposable; + private disposeOnUpdate: IDisposable | undefined; - private isVisible: boolean; - private isBuilt: boolean; + private isVisible = false; + private isBuilt = false; constructor( @INotificationService private readonly notificationService: INotificationService, @@ -126,7 +126,6 @@ export class DebugToolBar extends Themable implements IWorkbenchContribution { this.registerListeners(); this.hide(); - this.isBuilt = false; } private registerListeners(): void { diff --git a/src/vs/workbench/contrib/debug/browser/loadedScriptsView.ts b/src/vs/workbench/contrib/debug/browser/loadedScriptsView.ts index 70a962e46ec17..6a70b78319ba4 100644 --- a/src/vs/workbench/contrib/debug/browser/loadedScriptsView.ts +++ b/src/vs/workbench/contrib/debug/browser/loadedScriptsView.ts @@ -46,7 +46,7 @@ class BaseTreeItem { private _showedMoreThanOne: boolean; private _children = new Map(); - private _source: Source; + private _source: Source | undefined; constructor(private _parent: BaseTreeItem | undefined, private _label: string) { this._showedMoreThanOne = false; @@ -184,7 +184,7 @@ class BaseTreeItem { } // skips intermediate single-child nodes - getSource(): Source { + getSource(): Source | undefined { const child = this.oneChild(); if (child) { return child.getSource(); @@ -381,13 +381,13 @@ class SessionTreeItem extends BaseTreeItem { export class LoadedScriptsView extends ViewletPanel { - private treeContainer: HTMLElement; + private treeContainer!: HTMLElement; private loadedScriptsItemType: IContextKey; - private tree: WorkbenchAsyncDataTree; - private treeLabels: ResourceLabels; - private changeScheduler: RunOnceScheduler; - private treeNeedsRefreshOnVisible: boolean; - private filter: LoadedScriptsFilter; + private tree!: WorkbenchAsyncDataTree; + private treeLabels!: ResourceLabels; + private changeScheduler!: RunOnceScheduler; + private treeNeedsRefreshOnVisible = false; + private filter!: LoadedScriptsFilter; constructor( options: IViewletViewOptions, @@ -635,7 +635,7 @@ class LoadedSciptsAccessibilityProvider implements IAccessibilityProvider { - private filterText: string; + private filterText: string | undefined; setFilter(filterText: string) { this.filterText = filterText; diff --git a/src/vs/workbench/contrib/debug/browser/rawDebugSession.ts b/src/vs/workbench/contrib/debug/browser/rawDebugSession.ts index a0f2120b92007..39bb171c4ecc0 100644 --- a/src/vs/workbench/contrib/debug/browser/rawDebugSession.ts +++ b/src/vs/workbench/contrib/debug/browser/rawDebugSession.ts @@ -37,19 +37,19 @@ interface ILaunchVSCodeArguments { */ export class RawDebugSession { - private allThreadsContinued: boolean; - private _readyForBreakpoints: boolean; + private allThreadsContinued = true; + private _readyForBreakpoints = false; private _capabilities: DebugProtocol.Capabilities; // shutdown - private debugAdapterStopped: boolean; - private inShutdown: boolean; - private terminated: boolean; - private firedAdapterExitEvent: boolean; + private debugAdapterStopped = false; + private inShutdown = false; + private terminated = false; + private firedAdapterExitEvent = false; // telemetry - private startTime: number; - private didReceiveStoppedEvent: boolean; + private startTime = 0; + private didReceiveStoppedEvent = false; // DAP events private readonly _onDidInitialize: Emitter; @@ -78,13 +78,6 @@ export class RawDebugSession { ) { this.debugAdapter = debugAdapter; this._capabilities = Object.create(null); - this._readyForBreakpoints = false; - this.inShutdown = false; - this.debugAdapterStopped = false; - this.firedAdapterExitEvent = false; - this.didReceiveStoppedEvent = false; - - this.allThreadsContinued = true; this._onDidInitialize = new Emitter(); this._onDidStop = new Emitter(); diff --git a/src/vs/workbench/contrib/debug/browser/variablesView.ts b/src/vs/workbench/contrib/debug/browser/variablesView.ts index 71559c50d3c5e..45eb8037c717b 100644 --- a/src/vs/workbench/contrib/debug/browser/variablesView.ts +++ b/src/vs/workbench/contrib/debug/browser/variablesView.ts @@ -39,8 +39,8 @@ export const variableSetEmitter = new Emitter(); export class VariablesView extends ViewletPanel { private onFocusStackFrameScheduler: RunOnceScheduler; - private needsRefresh: boolean; - private tree: WorkbenchAsyncDataTree; + private needsRefresh = false; + private tree!: WorkbenchAsyncDataTree; private savedViewState: IAsyncDataTreeViewState | undefined; constructor( diff --git a/src/vs/workbench/contrib/debug/browser/watchExpressionsView.ts b/src/vs/workbench/contrib/debug/browser/watchExpressionsView.ts index 7b0430d25045b..ecc9524f0166f 100644 --- a/src/vs/workbench/contrib/debug/browser/watchExpressionsView.ts +++ b/src/vs/workbench/contrib/debug/browser/watchExpressionsView.ts @@ -36,8 +36,8 @@ const MAX_VALUE_RENDER_LENGTH_IN_VIEWLET = 1024; export class WatchExpressionsView extends ViewletPanel { private onWatchExpressionsUpdatedScheduler: RunOnceScheduler; - private needsRefresh: boolean; - private tree: WorkbenchAsyncDataTree; + private needsRefresh = false; + private tree!: WorkbenchAsyncDataTree; constructor( options: IViewletViewOptions, diff --git a/src/vs/workbench/contrib/debug/common/abstractDebugAdapter.ts b/src/vs/workbench/contrib/debug/common/abstractDebugAdapter.ts index 17dfdf746adc7..74d087e06b7c3 100644 --- a/src/vs/workbench/contrib/debug/common/abstractDebugAdapter.ts +++ b/src/vs/workbench/contrib/debug/common/abstractDebugAdapter.ts @@ -14,9 +14,9 @@ export abstract class AbstractDebugAdapter implements IDebugAdapter { private sequence: number; private pendingRequests = new Map void>(); - private requestCallback: (request: DebugProtocol.Request) => void; - private eventCallback: (request: DebugProtocol.Event) => void; - private messageCallback: (message: DebugProtocol.ProtocolMessage) => void; + private requestCallback: ((request: DebugProtocol.Request) => void) | undefined; + private eventCallback: ((request: DebugProtocol.Event) => void) | undefined; + private messageCallback: ((message: DebugProtocol.ProtocolMessage) => void) | undefined; protected readonly _onError: Emitter; protected readonly _onExit: Emitter;