Skip to content

Commit 31cd6ae

Browse files
committed
strictPropertyInitialization
microsoft#78168
1 parent bb0e9fd commit 31cd6ae

12 files changed

Lines changed: 49 additions & 54 deletions

src/vs/workbench/contrib/debug/browser/debugConfigurationManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const DEBUG_SELECTED_ROOT = 'debug.selectedroot';
4444
export class ConfigurationManager implements IConfigurationManager {
4545
private debuggers: Debugger[];
4646
private breakpointModeIdsSet = new Set<string>();
47-
private launches: ILaunch[];
47+
private launches!: ILaunch[];
4848
private selectedName: string | undefined;
4949
private selectedLaunch: ILaunch | undefined;
5050
private toDispose: IDisposable[];

src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ export class DebugEditorContribution implements IDebugEditorContribution {
5757

5858
private toDispose: lifecycle.IDisposable[];
5959
private hoverWidget: DebugHoverWidget;
60-
private nonDebugHoverPosition: Position;
61-
private hoverRange: Range;
60+
private nonDebugHoverPosition: Position | undefined;
61+
private hoverRange: Range | null = null;
6262
private mouseDown = false;
6363

6464
private breakpointHintDecoration: string[];
@@ -68,7 +68,7 @@ export class DebugEditorContribution implements IDebugEditorContribution {
6868

6969
private exceptionWidget: ExceptionWidget | undefined;
7070

71-
private configurationWidget: FloatingClickWidget;
71+
private configurationWidget: FloatingClickWidget | undefined;
7272

7373
constructor(
7474
private editor: ICodeEditor,
@@ -377,7 +377,11 @@ export class DebugEditorContribution implements IDebugEditorContribution {
377377

378378
@memoize
379379
private get showHoverScheduler(): RunOnceScheduler {
380-
const scheduler = new RunOnceScheduler(() => this.showHover(this.hoverRange, false), HOVER_DELAY);
380+
const scheduler = new RunOnceScheduler(() => {
381+
if (this.hoverRange) {
382+
this.showHover(this.hoverRange, false);
383+
}
384+
}, HOVER_DELAY);
381385
this.toDispose.push(scheduler);
382386

383387
return scheduler;
@@ -398,7 +402,7 @@ export class DebugEditorContribution implements IDebugEditorContribution {
398402
@memoize
399403
private get provideNonDebugHoverScheduler(): RunOnceScheduler {
400404
const scheduler = new RunOnceScheduler(() => {
401-
if (this.editor.hasModel()) {
405+
if (this.editor.hasModel() && this.nonDebugHoverPosition) {
402406
getHover(this.editor.getModel(), this.nonDebugHoverPosition, CancellationToken.None);
403407
}
404408
}, HOVER_DELAY);

src/vs/workbench/contrib/debug/browser/debugEditorModelManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export class DebugEditorModelManager implements IWorkbenchContribution {
3636
static readonly STICKINESS = TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges;
3737
private modelDataMap: Map<string, IDebugEditorModelData>;
3838
private toDispose: lifecycle.IDisposable[];
39-
private ignoreDecorationsChangedEvent: boolean;
39+
private ignoreDecorationsChangedEvent = false;
4040

4141
constructor(
4242
@IModelService private readonly modelService: IModelService,

src/vs/workbench/contrib/debug/browser/debugHover.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,16 @@ export class DebugHoverWidget implements IContentWidget {
4141
allowEditorOverflow = true;
4242

4343
private _isVisible: boolean;
44-
private domNode: HTMLElement;
45-
private tree: AsyncDataTree<IExpression, IExpression, any>;
44+
private domNode!: HTMLElement;
45+
private tree!: AsyncDataTree<IExpression, IExpression, any>;
4646
private showAtPosition: Position | null;
4747
private highlightDecorations: string[];
48-
private complexValueContainer: HTMLElement;
49-
private complexValueTitle: HTMLElement;
50-
private valueContainer: HTMLElement;
51-
private treeContainer: HTMLElement;
48+
private complexValueContainer!: HTMLElement;
49+
private complexValueTitle!: HTMLElement;
50+
private valueContainer!: HTMLElement;
51+
private treeContainer!: HTMLElement;
5252
private toDispose: lifecycle.IDisposable[];
53-
private scrollbar: DomScrollableElement;
54-
private dataSource: DebugHoverDataSource;
53+
private scrollbar!: DomScrollableElement;
5554

5655
constructor(
5756
private editor: ICodeEditor,
@@ -72,10 +71,10 @@ export class DebugHoverWidget implements IContentWidget {
7271
this.complexValueTitle = dom.append(this.complexValueContainer, $('.title'));
7372
this.treeContainer = dom.append(this.complexValueContainer, $('.debug-hover-tree'));
7473
this.treeContainer.setAttribute('role', 'tree');
75-
this.dataSource = new DebugHoverDataSource();
74+
const dataSource = new DebugHoverDataSource();
7675

7776
this.tree = this.instantiationService.createInstance(WorkbenchAsyncDataTree, this.treeContainer, new DebugHoverDelegate(), [this.instantiationService.createInstance(VariablesRenderer)],
78-
this.dataSource, {
77+
dataSource, {
7978
ariaLabel: nls.localize('treeAriaLabel', "Debug Hover"),
8079
accessibilityProvider: new DebugHoverAccessibilityProvider(),
8180
mouseSupport: false,

src/vs/workbench/contrib/debug/browser/debugQuickOpen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export class DebugQuickOpenHandler extends QuickOpenHandler {
7777

7878
public static readonly ID = 'workbench.picker.launch';
7979

80-
private autoFocusIndex: number;
80+
private autoFocusIndex: number | undefined;
8181

8282
constructor(
8383
@IDebugService private readonly debugService: IDebugService,

src/vs/workbench/contrib/debug/browser/debugService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export class DebugService implements IDebugService {
8787
private inDebugMode: IContextKey<boolean>;
8888
private breakpointsToSendOnResourceSaved: Set<string>;
8989
private initializing = false;
90-
private previousState: State;
90+
private previousState: State | undefined;
9191

9292
constructor(
9393
@IStorageService private readonly storageService: IStorageService,

src/vs/workbench/contrib/debug/browser/debugToolBar.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ export class DebugToolBar extends Themable implements IWorkbenchContribution {
5555
private activeActions: IAction[];
5656
private updateScheduler: RunOnceScheduler;
5757
private debugToolBarMenu: IMenu;
58-
private disposeOnUpdate: IDisposable;
58+
private disposeOnUpdate: IDisposable | undefined;
5959

60-
private isVisible: boolean;
61-
private isBuilt: boolean;
60+
private isVisible = false;
61+
private isBuilt = false;
6262

6363
constructor(
6464
@INotificationService private readonly notificationService: INotificationService,
@@ -126,7 +126,6 @@ export class DebugToolBar extends Themable implements IWorkbenchContribution {
126126
this.registerListeners();
127127

128128
this.hide();
129-
this.isBuilt = false;
130129
}
131130

132131
private registerListeners(): void {

src/vs/workbench/contrib/debug/browser/loadedScriptsView.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class BaseTreeItem {
4646

4747
private _showedMoreThanOne: boolean;
4848
private _children = new Map<string, BaseTreeItem>();
49-
private _source: Source;
49+
private _source: Source | undefined;
5050

5151
constructor(private _parent: BaseTreeItem | undefined, private _label: string) {
5252
this._showedMoreThanOne = false;
@@ -184,7 +184,7 @@ class BaseTreeItem {
184184
}
185185

186186
// skips intermediate single-child nodes
187-
getSource(): Source {
187+
getSource(): Source | undefined {
188188
const child = this.oneChild();
189189
if (child) {
190190
return child.getSource();
@@ -381,13 +381,13 @@ class SessionTreeItem extends BaseTreeItem {
381381

382382
export class LoadedScriptsView extends ViewletPanel {
383383

384-
private treeContainer: HTMLElement;
384+
private treeContainer!: HTMLElement;
385385
private loadedScriptsItemType: IContextKey<string>;
386-
private tree: WorkbenchAsyncDataTree<LoadedScriptsItem, LoadedScriptsItem, FuzzyScore>;
387-
private treeLabels: ResourceLabels;
388-
private changeScheduler: RunOnceScheduler;
389-
private treeNeedsRefreshOnVisible: boolean;
390-
private filter: LoadedScriptsFilter;
386+
private tree!: WorkbenchAsyncDataTree<LoadedScriptsItem, LoadedScriptsItem, FuzzyScore>;
387+
private treeLabels!: ResourceLabels;
388+
private changeScheduler!: RunOnceScheduler;
389+
private treeNeedsRefreshOnVisible = false;
390+
private filter!: LoadedScriptsFilter;
391391

392392
constructor(
393393
options: IViewletViewOptions,
@@ -635,7 +635,7 @@ class LoadedSciptsAccessibilityProvider implements IAccessibilityProvider<Loaded
635635

636636
class LoadedScriptsFilter implements ITreeFilter<BaseTreeItem, FuzzyScore> {
637637

638-
private filterText: string;
638+
private filterText: string | undefined;
639639

640640
setFilter(filterText: string) {
641641
this.filterText = filterText;

src/vs/workbench/contrib/debug/browser/rawDebugSession.ts

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,19 @@ interface ILaunchVSCodeArguments {
3737
*/
3838
export class RawDebugSession {
3939

40-
private allThreadsContinued: boolean;
41-
private _readyForBreakpoints: boolean;
40+
private allThreadsContinued = true;
41+
private _readyForBreakpoints = false;
4242
private _capabilities: DebugProtocol.Capabilities;
4343

4444
// shutdown
45-
private debugAdapterStopped: boolean;
46-
private inShutdown: boolean;
47-
private terminated: boolean;
48-
private firedAdapterExitEvent: boolean;
45+
private debugAdapterStopped = false;
46+
private inShutdown = false;
47+
private terminated = false;
48+
private firedAdapterExitEvent = false;
4949

5050
// telemetry
51-
private startTime: number;
52-
private didReceiveStoppedEvent: boolean;
51+
private startTime = 0;
52+
private didReceiveStoppedEvent = false;
5353

5454
// DAP events
5555
private readonly _onDidInitialize: Emitter<DebugProtocol.InitializedEvent>;
@@ -78,13 +78,6 @@ export class RawDebugSession {
7878
) {
7979
this.debugAdapter = debugAdapter;
8080
this._capabilities = Object.create(null);
81-
this._readyForBreakpoints = false;
82-
this.inShutdown = false;
83-
this.debugAdapterStopped = false;
84-
this.firedAdapterExitEvent = false;
85-
this.didReceiveStoppedEvent = false;
86-
87-
this.allThreadsContinued = true;
8881

8982
this._onDidInitialize = new Emitter<DebugProtocol.InitializedEvent>();
9083
this._onDidStop = new Emitter<DebugProtocol.StoppedEvent>();

src/vs/workbench/contrib/debug/browser/variablesView.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ export const variableSetEmitter = new Emitter<void>();
3939
export class VariablesView extends ViewletPanel {
4040

4141
private onFocusStackFrameScheduler: RunOnceScheduler;
42-
private needsRefresh: boolean;
43-
private tree: WorkbenchAsyncDataTree<IViewModel | IExpression | IScope, IExpression | IScope, FuzzyScore>;
42+
private needsRefresh = false;
43+
private tree!: WorkbenchAsyncDataTree<IViewModel | IExpression | IScope, IExpression | IScope, FuzzyScore>;
4444
private savedViewState: IAsyncDataTreeViewState | undefined;
4545

4646
constructor(

0 commit comments

Comments
 (0)