Skip to content

Commit

Permalink
strictPropertyInitialization
Browse files Browse the repository at this point in the history
  • Loading branch information
isidorn committed Aug 6, 2019
1 parent bb0e9fd commit 31cd6ae
Show file tree
Hide file tree
Showing 12 changed files with 49 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const DEBUG_SELECTED_ROOT = 'debug.selectedroot';
export class ConfigurationManager implements IConfigurationManager {
private debuggers: Debugger[];
private breakpointModeIdsSet = new Set<string>();
private launches: ILaunch[];
private launches!: ILaunch[];
private selectedName: string | undefined;
private selectedLaunch: ILaunch | undefined;
private toDispose: IDisposable[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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[];
Expand All @@ -68,7 +68,7 @@ export class DebugEditorContribution implements IDebugEditorContribution {

private exceptionWidget: ExceptionWidget | undefined;

private configurationWidget: FloatingClickWidget;
private configurationWidget: FloatingClickWidget | undefined;

constructor(
private editor: ICodeEditor,
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class DebugEditorModelManager implements IWorkbenchContribution {
static readonly STICKINESS = TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges;
private modelDataMap: Map<string, IDebugEditorModelData>;
private toDispose: lifecycle.IDisposable[];
private ignoreDecorationsChangedEvent: boolean;
private ignoreDecorationsChangedEvent = false;

constructor(
@IModelService private readonly modelService: IModelService,
Expand Down
19 changes: 9 additions & 10 deletions src/vs/workbench/contrib/debug/browser/debugHover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,16 @@ export class DebugHoverWidget implements IContentWidget {
allowEditorOverflow = true;

private _isVisible: boolean;
private domNode: HTMLElement;
private tree: AsyncDataTree<IExpression, IExpression, any>;
private domNode!: HTMLElement;
private tree!: AsyncDataTree<IExpression, IExpression, any>;
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,
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/contrib/debug/browser/debugQuickOpen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/contrib/debug/browser/debugService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export class DebugService implements IDebugService {
private inDebugMode: IContextKey<boolean>;
private breakpointsToSendOnResourceSaved: Set<string>;
private initializing = false;
private previousState: State;
private previousState: State | undefined;

constructor(
@IStorageService private readonly storageService: IStorageService,
Expand Down
7 changes: 3 additions & 4 deletions src/vs/workbench/contrib/debug/browser/debugToolBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -126,7 +126,6 @@ export class DebugToolBar extends Themable implements IWorkbenchContribution {
this.registerListeners();

this.hide();
this.isBuilt = false;
}

private registerListeners(): void {
Expand Down
18 changes: 9 additions & 9 deletions src/vs/workbench/contrib/debug/browser/loadedScriptsView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class BaseTreeItem {

private _showedMoreThanOne: boolean;
private _children = new Map<string, BaseTreeItem>();
private _source: Source;
private _source: Source | undefined;

constructor(private _parent: BaseTreeItem | undefined, private _label: string) {
this._showedMoreThanOne = false;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -381,13 +381,13 @@ class SessionTreeItem extends BaseTreeItem {

export class LoadedScriptsView extends ViewletPanel {

private treeContainer: HTMLElement;
private treeContainer!: HTMLElement;
private loadedScriptsItemType: IContextKey<string>;
private tree: WorkbenchAsyncDataTree<LoadedScriptsItem, LoadedScriptsItem, FuzzyScore>;
private treeLabels: ResourceLabels;
private changeScheduler: RunOnceScheduler;
private treeNeedsRefreshOnVisible: boolean;
private filter: LoadedScriptsFilter;
private tree!: WorkbenchAsyncDataTree<LoadedScriptsItem, LoadedScriptsItem, FuzzyScore>;
private treeLabels!: ResourceLabels;
private changeScheduler!: RunOnceScheduler;
private treeNeedsRefreshOnVisible = false;
private filter!: LoadedScriptsFilter;

constructor(
options: IViewletViewOptions,
Expand Down Expand Up @@ -635,7 +635,7 @@ class LoadedSciptsAccessibilityProvider implements IAccessibilityProvider<Loaded

class LoadedScriptsFilter implements ITreeFilter<BaseTreeItem, FuzzyScore> {

private filterText: string;
private filterText: string | undefined;

setFilter(filterText: string) {
this.filterText = filterText;
Expand Down
23 changes: 8 additions & 15 deletions src/vs/workbench/contrib/debug/browser/rawDebugSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<DebugProtocol.InitializedEvent>;
Expand Down Expand Up @@ -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<DebugProtocol.InitializedEvent>();
this._onDidStop = new Emitter<DebugProtocol.StoppedEvent>();
Expand Down
4 changes: 2 additions & 2 deletions src/vs/workbench/contrib/debug/browser/variablesView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ export const variableSetEmitter = new Emitter<void>();
export class VariablesView extends ViewletPanel {

private onFocusStackFrameScheduler: RunOnceScheduler;
private needsRefresh: boolean;
private tree: WorkbenchAsyncDataTree<IViewModel | IExpression | IScope, IExpression | IScope, FuzzyScore>;
private needsRefresh = false;
private tree!: WorkbenchAsyncDataTree<IViewModel | IExpression | IScope, IExpression | IScope, FuzzyScore>;
private savedViewState: IAsyncDataTreeViewState | undefined;

constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<IDebugService | IExpression, IExpression, FuzzyScore>;
private needsRefresh = false;
private tree!: WorkbenchAsyncDataTree<IDebugService | IExpression, IExpression, FuzzyScore>;

constructor(
options: IViewletViewOptions,
Expand Down
6 changes: 3 additions & 3 deletions src/vs/workbench/contrib/debug/common/abstractDebugAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ export abstract class AbstractDebugAdapter implements IDebugAdapter {

private sequence: number;
private pendingRequests = new Map<number, (e: DebugProtocol.Response) => 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<Error>;
protected readonly _onExit: Emitter<number | null>;

Expand Down

0 comments on commit 31cd6ae

Please sign in to comment.