diff --git a/src/tsconfig.strictNullChecks.json b/src/tsconfig.strictNullChecks.json index 9a1c682a83f..5a9778018f9 100644 --- a/src/tsconfig.strictNullChecks.json +++ b/src/tsconfig.strictNullChecks.json @@ -91,50 +91,80 @@ "./vs/code/electron-main/keyboard.ts", "./vs/code/electron-main/theme.ts", "./vs/code/node/shellEnv.ts", + "./vs/editor/browser/config/elementSizeObserver.ts", + "./vs/editor/common/commands/replaceCommand.ts", + "./vs/editor/common/commands/surroundSelectionCommand.ts", "./vs/editor/common/config/editorOptions.ts", "./vs/editor/common/config/editorZoom.ts", "./vs/editor/common/config/fontInfo.ts", "./vs/editor/common/controller/cursorEvents.ts", "./vs/editor/common/controller/wordCharacterClassifier.ts", "./vs/editor/common/core/characterClassifier.ts", + "./vs/editor/common/core/editOperation.ts", + "./vs/editor/common/core/lineTokens.ts", "./vs/editor/common/core/position.ts", "./vs/editor/common/core/range.ts", "./vs/editor/common/core/rgba.ts", "./vs/editor/common/core/selection.ts", "./vs/editor/common/core/stringBuilder.ts", + "./vs/editor/common/core/token.ts", "./vs/editor/common/core/uint.ts", + "./vs/editor/common/editorAction.ts", + "./vs/editor/common/editorCommon.ts", + "./vs/editor/common/editorContextKeys.ts", "./vs/editor/common/model.ts", "./vs/editor/common/model/editStack.ts", + "./vs/editor/common/model/indentationGuesser.ts", "./vs/editor/common/model/intervalTree.ts", - "./vs/editor/common/editorContextKeys.ts", "./vs/editor/common/model/mirrorTextModel.ts", "./vs/editor/common/model/pieceTreeTextBuffer/pieceTreeBase.ts", "./vs/editor/common/model/pieceTreeTextBuffer/pieceTreeTextBuffer.ts", + "./vs/editor/common/model/pieceTreeTextBuffer/pieceTreeTextBufferBuilder.ts", "./vs/editor/common/model/pieceTreeTextBuffer/rbTreeBase.ts", "./vs/editor/common/model/textModel.ts", "./vs/editor/common/model/textModelEvents.ts", - "./vs/editor/common/modes/languageSelector.ts", "./vs/editor/common/model/textModelSearch.ts", "./vs/editor/common/model/textModelTokens.ts", "./vs/editor/common/model/wordHelper.ts", "./vs/editor/common/modes.ts", + "./vs/editor/common/modes/abstractMode.ts", + "./vs/editor/common/modes/languageConfiguration.ts", "./vs/editor/common/modes/languageConfigurationRegistry.ts", "./vs/editor/common/modes/languageFeatureRegistry.ts", + "./vs/editor/common/modes/languageSelector.ts", "./vs/editor/common/modes/nullMode.ts", + "./vs/editor/common/modes/supports.ts", + "./vs/editor/common/modes/supports/characterPair.ts", "./vs/editor/common/modes/supports/electricCharacter.ts", + "./vs/editor/common/modes/supports/indentRules.ts", "./vs/editor/common/modes/supports/onEnter.ts", "./vs/editor/common/modes/supports/richEditBrackets.ts", "./vs/editor/common/modes/tokenizationRegistry.ts", + "./vs/editor/common/services/editorWorkerService.ts", + "./vs/editor/common/services/modeService.ts", + "./vs/editor/common/services/modelService.ts", + "./vs/editor/common/services/resolverService.ts", "./vs/editor/common/view/overviewZoneManager.ts", "./vs/editor/common/viewLayout/whitespaceComputer.ts", "./vs/editor/common/viewModel/prefixSumComputer.ts", "./vs/editor/contrib/codeAction/codeActionTrigger.ts", + "./vs/editor/contrib/colorPicker/colorPickerModel.ts", "./vs/editor/contrib/find/findState.ts", + "./vs/editor/contrib/find/replaceAllCommand.ts", "./vs/editor/contrib/find/replacePattern.ts", + "./vs/editor/contrib/inPlaceReplace/inPlaceReplaceCommand.ts", "./vs/editor/contrib/indentation/indentUtils.ts", + "./vs/editor/contrib/linesOperations/copyLinesCommand.ts", "./vs/editor/standalone/common/monarch/monarchCommon.ts", "./vs/editor/standalone/common/monarch/monarchCompile.ts", "./vs/editor/standalone/common/monarch/monarchTypes.ts", + "./vs/editor/test/common/commentMode.ts", + "./vs/editor/test/common/core/viewLineToken.ts", + "./vs/editor/test/common/editorTestUtils.ts", + "./vs/editor/test/common/mocks/mockMode.ts", + "./vs/editor/test/common/model/benchmark/benchmarkUtils.ts", + "./vs/editor/test/common/modes/supports/javascriptOnEnterRules.ts", + "./vs/editor/test/common/modesTestUtils.ts", "./vs/nls.mock.ts", "./vs/platform/broadcast/electron-browser/broadcastService.ts", "./vs/platform/clipboard/common/clipboardService.ts", @@ -191,17 +221,20 @@ "./vs/workbench/common/extensionHostProtocol.ts", "./vs/workbench/common/panel.ts", "./vs/workbench/common/viewlet.ts", + "./vs/workbench/parts/codeEditor/browser/simpleEditorOptions.ts", "./vs/workbench/parts/execution/common/execution.ts", "./vs/workbench/parts/extensions/common/extensionQuery.ts", "./vs/workbench/parts/logs/common/logConstants.ts", "./vs/workbench/parts/markers/electron-browser/constants.ts", "./vs/workbench/parts/outline/electron-browser/outline.ts", "./vs/workbench/parts/output/common/output.ts", + "./vs/workbench/parts/scm/electron-browser/scmUtil.ts", "./vs/workbench/parts/search/common/constants.ts", "./vs/workbench/parts/terminal/browser/terminalWidgetManager.ts", "./vs/workbench/parts/terminal/common/terminal.ts", "./vs/workbench/parts/welcome/page/electron-browser/vs_code_welcome_page.ts", "./vs/workbench/services/activity/common/activity.ts", + "./vs/workbench/services/backup/common/backup.ts", "./vs/workbench/services/configuration/common/jsonEditing.ts", "./vs/workbench/services/decorations/browser/decorations.ts", "./vs/workbench/services/extensions/node/lazyPromise.ts", @@ -212,7 +245,10 @@ "./vs/workbench/services/hash/common/hashService.ts", "./vs/workbench/services/hash/node/hashService.ts", "./vs/workbench/services/panel/common/panelService.ts", + "./vs/workbench/services/scm/common/scm.ts", + "./vs/workbench/services/scm/common/scmService.ts", "./vs/workbench/services/search/node/search.ts", + "./vs/workbench/services/textMate/electron-browser/textMateService.ts", "./vs/workbench/services/title/common/titleService.ts", "./vs/workbench/test/electron-browser/api/mock.ts" ], diff --git a/src/vs/base/browser/dom.ts b/src/vs/base/browser/dom.ts index f36e59ba51b..f1746bb8830 100644 --- a/src/vs/base/browser/dom.ts +++ b/src/vs/base/browser/dom.ts @@ -272,7 +272,7 @@ export function addDisposableNonBubblingMouseOutListener(node: Element, handler: interface IRequestAnimationFrame { (callback: (time: number) => void): number; } -let _animationFrame: IRequestAnimationFrame = null; +let _animationFrame: IRequestAnimationFrame | null = null; function doRequestAnimationFrame(callback: (time: number) => void): number { if (!_animationFrame) { const emulatedRequestAnimationFrame = (callback: (time: number) => void): any => { @@ -425,7 +425,7 @@ class TimeoutThrottledDomListener extends Disposable { constructor(node: any, type: string, handler: (event: R) => void, eventMerger: IEventMerger = DEFAULT_EVENT_MERGER, minimumTimeMs: number = MINIMUM_TIME_MS) { super(); - let lastEvent: R = null; + let lastEvent: R | null = null; let lastHandlerTime = 0; let timeout = this._register(new TimeoutTimer()); @@ -771,7 +771,7 @@ export function createStyleSheet(container: HTMLElement = document.getElementsBy return style; } -let _sharedStyleSheet: HTMLStyleElement = null; +let _sharedStyleSheet: HTMLStyleElement | null = null; function getSharedStyleSheet(): HTMLStyleElement { if (!_sharedStyleSheet) { _sharedStyleSheet = createStyleSheet(); diff --git a/src/vs/base/browser/ui/actionbar/actionbar.ts b/src/vs/base/browser/ui/actionbar/actionbar.ts index 4d25c01ecfd..d07946d2aa3 100644 --- a/src/vs/base/browser/ui/actionbar/actionbar.ts +++ b/src/vs/base/browser/ui/actionbar/actionbar.ts @@ -286,7 +286,7 @@ export class ActionItem extends BaseActionItem { } updateTooltip(): void { - let title: string = null; + let title: string | null = null; if (this.getAction().tooltip) { title = this.getAction().tooltip; @@ -602,7 +602,7 @@ export class ActionBar extends Disposable implements IActionRunner { e.stopPropagation(); })); - let item: IActionItem = null; + let item: IActionItem | null = null; if (this.options.actionItemProvider) { item = this.options.actionItemProvider(action); diff --git a/src/vs/base/browser/ui/inputbox/inputBox.ts b/src/vs/base/browser/ui/inputbox/inputBox.ts index 39b3a5c0fe9..947e36a2c77 100644 --- a/src/vs/base/browser/ui/inputbox/inputBox.ts +++ b/src/vs/base/browser/ui/inputbox/inputBox.ts @@ -260,7 +260,7 @@ export class InputBox extends Widget { return document.activeElement === this.input; } - public select(range: IRange = null): void { + public select(range: IRange | null = null): void { this.input.select(); if (range) { @@ -339,7 +339,7 @@ export class InputBox extends Widget { } public validate(): boolean { - let errorMsg: IMessage = null; + let errorMsg: IMessage | null = null; if (this.validation) { errorMsg = this.validation(this.value); diff --git a/src/vs/base/browser/ui/menu/menu.ts b/src/vs/base/browser/ui/menu/menu.ts index 57a6253d2b5..1cc3f375b27 100644 --- a/src/vs/base/browser/ui/menu/menu.ts +++ b/src/vs/base/browser/ui/menu/menu.ts @@ -347,7 +347,7 @@ class MenuActionItem extends BaseActionItem { } updateTooltip(): void { - let title: string = null; + let title: string | null = null; if (this.getAction().tooltip) { title = this.getAction().tooltip; diff --git a/src/vs/base/browser/ui/splitview/panelview.ts b/src/vs/base/browser/ui/splitview/panelview.ts index fb3fb024e09..4364bf1432d 100644 --- a/src/vs/base/browser/ui/splitview/panelview.ts +++ b/src/vs/base/browser/ui/splitview/panelview.ts @@ -334,7 +334,7 @@ class PanelDraggable extends Disposable { } private render(): void { - let backgroundColor: string = null; + let backgroundColor: string | null = null; if (this.dragOverCounter > 0) { backgroundColor = (this.panel.dropBackground || PanelDraggable.DefaultDragOverBackgroundColor).toString(); diff --git a/src/vs/base/common/json.ts b/src/vs/base/common/json.ts index 1c812fc2801..1cfaa1f4201 100644 --- a/src/vs/base/common/json.ts +++ b/src/vs/base/common/json.ts @@ -636,7 +636,7 @@ export interface ParseOptions { * Therefore always check the errors list to find out if the input was valid. */ export function parse(text: string, errors: ParseError[] = [], options?: ParseOptions): any { - let currentProperty: string = null; + let currentProperty: string | null = null; let currentParent: any = []; let previousParents: any[] = []; diff --git a/src/vs/base/node/extfs.ts b/src/vs/base/node/extfs.ts index a68494a325d..2ac37d7e9cc 100644 --- a/src/vs/base/node/extfs.ts +++ b/src/vs/base/node/extfs.ts @@ -252,7 +252,7 @@ function rmRecursive(path: string, callback: (error: Error) => void): void { } else if (children.length === 0) { fs.rmdir(path, callback); } else { - let firstError: Error = null; + let firstError: Error | null = null; let childrenLeft = children.length; children.forEach(child => { rmRecursive(paths.join(path, child), (err: Error) => { @@ -643,7 +643,7 @@ export function watch(path: string, onChange: (type: string, path?: string) => v const watcher = fs.watch(path); watcher.on('change', (type, raw) => { - let file: string = null; + let file: string | null = null; if (raw) { // https://github.com/Microsoft/vscode/issues/38191 file = raw.toString(); if (platform.isMacintosh) { diff --git a/src/vs/base/node/pfs.ts b/src/vs/base/node/pfs.ts index 153b1c300fb..f559e86c97c 100644 --- a/src/vs/base/node/pfs.ts +++ b/src/vs/base/node/pfs.ts @@ -157,7 +157,7 @@ export function fileExists(path: string): Promise { /** * Deletes a path from disk. */ -let _tmpDir: string = null; +let _tmpDir: string | null = null; function getTmpDir(): string { if (!_tmpDir) { _tmpDir = os.tmpdir(); diff --git a/src/vs/base/parts/quickopen/browser/quickOpenModel.ts b/src/vs/base/parts/quickopen/browser/quickOpenModel.ts index 141a41e5990..4855968e00a 100644 --- a/src/vs/base/parts/quickopen/browser/quickOpenModel.ts +++ b/src/vs/base/parts/quickopen/browser/quickOpenModel.ts @@ -328,7 +328,7 @@ class Renderer implements IRenderer { private actionProvider: IActionProvider; private actionRunner: IActionRunner; - constructor(actionProvider: IActionProvider = new NoActionProvider(), actionRunner: IActionRunner = null) { + constructor(actionProvider: IActionProvider = new NoActionProvider(), actionRunner: IActionRunner | null = null) { this.actionProvider = actionProvider; this.actionRunner = actionRunner; } diff --git a/src/vs/base/parts/tree/browser/treeImpl.ts b/src/vs/base/parts/tree/browser/treeImpl.ts index db01cf9b38a..a93ad2bdeb4 100644 --- a/src/vs/base/parts/tree/browser/treeImpl.ts +++ b/src/vs/base/parts/tree/browser/treeImpl.ts @@ -199,7 +199,7 @@ export class Tree implements _.ITree { return this.model.getExpandedElements(); } - public reveal(element: any, relativeTop: number = null): WinJS.Promise { + public reveal(element: any, relativeTop: number | null = null): WinJS.Promise { return this.model.reveal(element, relativeTop); } diff --git a/src/vs/base/parts/tree/browser/treeModel.ts b/src/vs/base/parts/tree/browser/treeModel.ts index 097b8b2b9bf..d9c6c0bcf32 100644 --- a/src/vs/base/parts/tree/browser/treeModel.ts +++ b/src/vs/base/parts/tree/browser/treeModel.ts @@ -346,7 +346,7 @@ export class Item { this.expanded = value; } - public reveal(relativeTop: number = null): void { + public reveal(relativeTop: number | null = null): void { var eventData: IItemRevealEvent = { item: this, relativeTop: relativeTop }; this._onDidReveal.fire(eventData); } @@ -838,8 +838,8 @@ function getRange(one: Item, other: Item): Item[] { var item = oneHierarchy[length - 1]; var nav = item.getNavigator(); - var oneIndex: number = null; - var otherIndex: number = null; + var oneIndex: number | null = null; + var otherIndex: number | null = null; var index = 0; var result: Item[] = []; @@ -1078,7 +1078,7 @@ export class TreeModel { return result; } - public reveal(element: any, relativeTop: number = null): WinJS.Promise { + public reveal(element: any, relativeTop: number | null = null): WinJS.Promise { return this.resolveUnknownParentChain(element).then((chain: any[]) => { var result = WinJS.TPromise.as(null); @@ -1221,8 +1221,8 @@ export class TreeModel { public selectPrevious(count: number = 1, clearSelection: boolean = true, eventPayload?: any): void { var selection = this.getSelection(), - item: Item = null, - previousItem: Item = null; + item: Item | null = null, + previousItem: Item | null = null; if (selection.length === 0) { let nav = this.getNavigator(this.input); diff --git a/src/vs/base/parts/tree/browser/treeView.ts b/src/vs/base/parts/tree/browser/treeView.ts index 392aa4c7bc4..47431675779 100644 --- a/src/vs/base/parts/tree/browser/treeView.ts +++ b/src/vs/base/parts/tree/browser/treeView.ts @@ -1657,7 +1657,7 @@ export class TreeView extends HeightMap { // DOM changes private insertItemInDOM(item: ViewItem): void { - var elementAfter: HTMLElement = null; + var elementAfter: HTMLElement | null = null; var itemAfter = this.itemAfter(item); if (itemAfter && itemAfter.element) { diff --git a/src/vs/base/parts/tree/browser/treeViewModel.ts b/src/vs/base/parts/tree/browser/treeViewModel.ts index 0238c16102f..ee14736039f 100644 --- a/src/vs/base/parts/tree/browser/treeViewModel.ts +++ b/src/vs/base/parts/tree/browser/treeViewModel.ts @@ -28,7 +28,7 @@ export class HeightMap { return !last ? 0 : last.top + last.height; } - public onInsertItems(iterator: INextIterator, afterItemId: string = null): number { + public onInsertItems(iterator: INextIterator, afterItemId: string | null = null): number { var item: Item; var viewItem: IViewItem; var i: number, j: number; @@ -90,7 +90,7 @@ export class HeightMap { public onRemoveItems(iterator: INextIterator): void { var itemId: string; var viewItem: IViewItem; - var startIndex: number = null; + var startIndex: number | null = null; var i: number; var sizeDiff = 0; @@ -140,7 +140,7 @@ export class HeightMap { var item: Item; var viewItem: IViewItem; var newHeight: number; - var i: number, j: number = null; + var i: number, j: number | null = null; var cummDiff = 0; while (item = iterator.next()) { diff --git a/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts b/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts index 7ef2e0704bb..5b574e3f341 100644 --- a/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts +++ b/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts @@ -99,7 +99,7 @@ function main(server: Server, initData: ISharedProcessInitData, configuration: I telemetryLogService.info('The below are logs for every telemetry event sent from VS Code once the log level is set to trace.'); telemetryLogService.info('==========================================================='); - let appInsightsAppender: ITelemetryAppender = NullAppender; + let appInsightsAppender: ITelemetryAppender | null = NullAppender; if (product.aiConfig && product.aiConfig.asimovKey && isBuilt) { appInsightsAppender = new AppInsightsAppender(eventPrefix, null, product.aiConfig.asimovKey, telemetryLogService); disposables.push(appInsightsAppender); // Ensure the AI appender is disposed so that it flushes remaining data diff --git a/src/vs/code/electron-main/app.ts b/src/vs/code/electron-main/app.ts index 2c048bdec2d..44464ac8044 100644 --- a/src/vs/code/electron-main/app.ts +++ b/src/vs/code/electron-main/app.ts @@ -556,7 +556,7 @@ export class CodeApplication { private afterWindowOpen(accessor: ServicesAccessor): void { const windowsMainService = accessor.get(IWindowsMainService); - let windowsMutex: Mutex = null; + let windowsMutex: Mutex | null = null; if (platform.isWindows) { // Setup Windows mutex diff --git a/src/vs/code/node/paths.ts b/src/vs/code/node/paths.ts index cdc14af2197..5774c6b6265 100644 --- a/src/vs/code/node/paths.ts +++ b/src/vs/code/node/paths.ts @@ -99,8 +99,8 @@ export function parseLineAndColumnAware(rawPath: string): IPathWithLineAndColumn const segments = rawPath.split(':'); // C:\file.txt:: let path: string; - let line: number = null; - let column: number = null; + let line: number | null = null; + let column: number | null = null; segments.forEach(segment => { const segmentAsNumber = Number(segment); diff --git a/src/vs/editor/browser/config/configuration.ts b/src/vs/editor/browser/config/configuration.ts index 96a0bc604d4..024eb619358 100644 --- a/src/vs/editor/browser/config/configuration.ts +++ b/src/vs/editor/browser/config/configuration.ts @@ -321,7 +321,7 @@ export class Configuration extends CommonEditorConfiguration { private readonly _elementSizeObserver: ElementSizeObserver; - constructor(options: IEditorOptions, referenceDomElement: HTMLElement = null) { + constructor(options: IEditorOptions, referenceDomElement: HTMLElement | null = null) { super(options); this._elementSizeObserver = this._register(new ElementSizeObserver(referenceDomElement, () => this._onReferenceDomElementSizeChanged())); diff --git a/src/vs/editor/browser/controller/mouseTarget.ts b/src/vs/editor/browser/controller/mouseTarget.ts index 943643ac49b..159fcfbdc34 100644 --- a/src/vs/editor/browser/controller/mouseTarget.ts +++ b/src/vs/editor/browser/controller/mouseTarget.ts @@ -97,7 +97,7 @@ export class MouseTarget implements IMouseTarget { public readonly range: EditorRange; public readonly detail: any; - constructor(element: Element, type: MouseTargetType, mouseColumn: number = 0, position: Position = null, range: EditorRange = null, detail: any = null) { + constructor(element: Element, type: MouseTargetType, mouseColumn: number = 0, position: Position | null = null, range: EditorRange | null = null, detail: any = null) { this.element = element; this.type = type; this.mouseColumn = mouseColumn; @@ -258,9 +258,9 @@ export class HitTestContext { if (viewZoneWhitespace) { let viewZoneMiddle = viewZoneWhitespace.verticalOffset + viewZoneWhitespace.height / 2, lineCount = context.model.getLineCount(), - positionBefore: Position = null, + positionBefore: Position | null = null, position: Position, - positionAfter: Position = null; + positionAfter: Position | null = null; if (viewZoneWhitespace.afterLineNumber !== lineCount) { // There are more lines after this view zone @@ -406,7 +406,7 @@ class HitTestRequest extends BareHitTestRequest { return `pos(${this.pos.x},${this.pos.y}), editorPos(${this.editorPos.x},${this.editorPos.y}), mouseVerticalOffset: ${this.mouseVerticalOffset}, mouseContentHorizontalOffset: ${this.mouseContentHorizontalOffset}\n\ttarget: ${this.target ? (this.target).outerHTML : null}`; } - public fulfill(type: MouseTargetType, position: Position = null, range: EditorRange = null, detail: any = null): MouseTarget { + public fulfill(type: MouseTargetType, position: Position | null = null, range: EditorRange | null = null, detail: any = null): MouseTarget { return new MouseTarget(this.target, type, this.mouseColumn, position, range, detail); } @@ -484,7 +484,7 @@ export class MouseTargetFactory { return this._createMouseTarget(ctx, request.withTarget(hitTestResult.hitTarget), true); } - let result: MouseTarget = null; + let result: MouseTarget | null = null; result = result || MouseTargetFactory._hitTestContentWidget(ctx, request); result = result || MouseTargetFactory._hitTestOverlayWidget(ctx, request); @@ -895,8 +895,8 @@ export class MouseTargetFactory { * Most probably IE */ private static _doHitTestWithMoveToPoint(ctx: HitTestContext, coords: ClientCoordinates): IHitTestResult { - let resultPosition: Position = null; - let resultHitTarget: Element = null; + let resultPosition: Position | null = null; + let resultHitTarget: Element | null = null; let textRange: IETextRange = (document.body).createTextRange(); try { diff --git a/src/vs/editor/browser/controller/textAreaHandler.ts b/src/vs/editor/browser/controller/textAreaHandler.ts index 5626d51f04d..264b6ef6864 100644 --- a/src/vs/editor/browser/controller/textAreaHandler.ts +++ b/src/vs/editor/browser/controller/textAreaHandler.ts @@ -172,7 +172,7 @@ export class TextAreaHandler extends ViewPart { const multicursorText = (Array.isArray(rawWhatToCopy) ? rawWhatToCopy : null); const whatToCopy = (Array.isArray(rawWhatToCopy) ? rawWhatToCopy.join(newLineCharacter) : rawWhatToCopy); - let metadata: LocalClipboardMetadata = null; + let metadata: LocalClipboardMetadata | null = null; if (isFromEmptySelection || multicursorText) { // Only store the non-default metadata @@ -442,7 +442,7 @@ export class TextAreaHandler extends ViewPart { // --- end view API - private _primaryCursorVisibleRange: HorizontalRange = null; + private _primaryCursorVisibleRange: HorizontalRange | null = null; public prepareRender(ctx: RenderingContext): void { if (this._accessibilitySupport === platform.AccessibilitySupport.Enabled) { diff --git a/src/vs/editor/browser/controller/textAreaInput.ts b/src/vs/editor/browser/controller/textAreaInput.ts index 1e28ba6b950..d39dbf29792 100644 --- a/src/vs/editor/browser/controller/textAreaInput.ts +++ b/src/vs/editor/browser/controller/textAreaInput.ts @@ -479,7 +479,7 @@ export class TextAreaInput extends Disposable { return; } - let copyHTML: string = null; + let copyHTML: string | null = null; if (browser.hasClipboardSupport() && (copyPlainText.length < 65536 || CopyOptions.forceCopyWithSyntaxHighlighting)) { copyHTML = this._host.getHTMLToCopy(); } diff --git a/src/vs/editor/browser/controller/textAreaState.ts b/src/vs/editor/browser/controller/textAreaState.ts index aacee92053d..350b9a93f5f 100644 --- a/src/vs/editor/browser/controller/textAreaState.ts +++ b/src/vs/editor/browser/controller/textAreaState.ts @@ -153,7 +153,7 @@ export class TextAreaState { // the only hints we can use is that the selection is immediately after the inserted emoji // and that none of the old text has been deleted - let potentialEmojiInput: string = null; + let potentialEmojiInput: string | null = null; if (currentSelectionStart === currentValue.length) { // emoji potentially inserted "somewhere" after the previous selection => it should appear at the end of `currentValue` @@ -255,7 +255,7 @@ export class PagedScreenReaderStrategy { let posttextRange = selectionEndPageRange.intersectRanges(new Range(selection.endLineNumber, selection.endColumn, lastLine, lastLineMaxColumn)); let posttext = model.getValueInRange(posttextRange, EndOfLinePreference.LF); - let text: string = null; + let text: string | null = null; if (selectionStartPage === selectionEndPage || selectionStartPage + 1 === selectionEndPage) { // take full selection text = model.getValueInRange(selection, EndOfLinePreference.LF); diff --git a/src/vs/editor/browser/core/editorState.ts b/src/vs/editor/browser/core/editorState.ts index ffa9991abb9..38d2df1be8a 100644 --- a/src/vs/editor/browser/core/editorState.ts +++ b/src/vs/editor/browser/core/editorState.ts @@ -74,7 +74,7 @@ export class EditorState { export class StableEditorScrollState { public static capture(editor: ICodeEditor): StableEditorScrollState { - let visiblePosition: Position = null; + let visiblePosition: Position | null = null; let visiblePositionScrollDelta = 0; if (editor.getScrollTop() !== 0) { const visibleRanges = editor.getVisibleRanges(); diff --git a/src/vs/editor/browser/services/abstractCodeEditorService.ts b/src/vs/editor/browser/services/abstractCodeEditorService.ts index 244b2398ac9..646126850df 100644 --- a/src/vs/editor/browser/services/abstractCodeEditorService.ts +++ b/src/vs/editor/browser/services/abstractCodeEditorService.ts @@ -71,7 +71,7 @@ export abstract class AbstractCodeEditorService extends Disposable implements IC } getFocusedCodeEditor(): ICodeEditor { - let editorWithWidgetFocus: ICodeEditor = null; + let editorWithWidgetFocus: ICodeEditor | null = null; let editors = this.listCodeEditors(); for (let i = 0; i < editors.length; i++) { diff --git a/src/vs/editor/browser/services/openerService.ts b/src/vs/editor/browser/services/openerService.ts index 5e08fadd765..f3f7687428c 100644 --- a/src/vs/editor/browser/services/openerService.ts +++ b/src/vs/editor/browser/services/openerService.ts @@ -22,7 +22,7 @@ export class OpenerService implements IOpenerService { constructor( @ICodeEditorService private readonly _editorService: ICodeEditorService, @ICommandService private readonly _commandService: ICommandService, - @optional(ITelemetryService) private _telemetryService: ITelemetryService = NullTelemetryService + @optional(ITelemetryService) private _telemetryService: ITelemetryService | null = NullTelemetryService ) { // } diff --git a/src/vs/editor/browser/viewParts/contentWidgets/contentWidgets.ts b/src/vs/editor/browser/viewParts/contentWidgets/contentWidgets.ts index 2c2a475229b..ee7f3449a02 100644 --- a/src/vs/editor/browser/viewParts/contentWidgets/contentWidgets.ts +++ b/src/vs/editor/browser/viewParts/contentWidgets/contentWidgets.ts @@ -443,7 +443,7 @@ class Widget { return null; } - let placement: IBoxLayoutResult = null; + let placement: IBoxLayoutResult | null = null; let fetchPlacement = (): void => { if (placement) { return; diff --git a/src/vs/editor/browser/viewParts/decorations/decorations.ts b/src/vs/editor/browser/viewParts/decorations/decorations.ts index 77055d440d9..93e6d330d39 100644 --- a/src/vs/editor/browser/viewParts/decorations/decorations.ts +++ b/src/vs/editor/browser/viewParts/decorations/decorations.ts @@ -149,9 +149,9 @@ export class DecorationsOverlay extends DynamicViewOverlay { const lineHeight = String(this._lineHeight); const visibleStartLineNumber = ctx.visibleRange.startLineNumber; - let prevClassName: string = null; + let prevClassName: string | null = null; let prevShowIfCollapsed: boolean = false; - let prevRange: Range = null; + let prevRange: Range | null = null; for (let i = 0, lenI = decorations.length; i < lenI; i++) { const d = decorations[i]; diff --git a/src/vs/editor/browser/viewParts/glyphMargin/glyphMargin.ts b/src/vs/editor/browser/viewParts/glyphMargin/glyphMargin.ts index 9192bb5eb68..4bc3aa48849 100644 --- a/src/vs/editor/browser/viewParts/glyphMargin/glyphMargin.ts +++ b/src/vs/editor/browser/viewParts/glyphMargin/glyphMargin.ts @@ -47,7 +47,7 @@ export abstract class DedupOverlay extends DynamicViewOverlay { return (a.className < b.className ? -1 : 1); }); - let prevClassName: string = null; + let prevClassName: string | null = null; let prevEndLineIndex = 0; for (let i = 0, len = decorations.length; i < len; i++) { let d = decorations[i]; diff --git a/src/vs/editor/browser/viewParts/lines/viewLine.ts b/src/vs/editor/browser/viewParts/lines/viewLine.ts index f6664f47cee..7d2481d6dab 100644 --- a/src/vs/editor/browser/viewParts/lines/viewLine.ts +++ b/src/vs/editor/browser/viewParts/lines/viewLine.ts @@ -225,7 +225,7 @@ export class ViewLine implements IVisibleLine { sb.appendASCIIString(''); - let renderedViewLine: IRenderedViewLine = null; + let renderedViewLine: IRenderedViewLine | null = null; if (canUseFastRenderedViewLine && lineData.isBasicASCII && options.useMonospaceOptimizations && output.containsForeignElements === ForeignElementType.None) { if (lineData.content.length < 300 && renderLineInput.lineTokens.getCount() < 100) { // Browser rounding errors have been observed in Chrome and IE, so using the fast diff --git a/src/vs/editor/browser/viewParts/selections/selections.ts b/src/vs/editor/browser/viewParts/selections/selections.ts index c5253571d01..890dc425fa7 100644 --- a/src/vs/editor/browser/viewParts/selections/selections.ts +++ b/src/vs/editor/browser/viewParts/selections/selections.ts @@ -158,8 +158,8 @@ export class SelectionsOverlay extends DynamicViewOverlay { private _enrichVisibleRangesWithStyle(viewport: Range, linesVisibleRanges: LineVisibleRangesWithStyle[], previousFrame: LineVisibleRangesWithStyle[]): void { const epsilon = this._typicalHalfwidthCharacterWidth / 4; - let previousFrameTop: HorizontalRangeWithStyle = null; - let previousFrameBottom: HorizontalRangeWithStyle = null; + let previousFrameTop: HorizontalRangeWithStyle | null = null; + let previousFrameBottom: HorizontalRangeWithStyle | null = null; if (previousFrame && previousFrame.length > 0 && linesVisibleRanges.length > 0) { diff --git a/src/vs/editor/browser/widget/codeEditorWidget.ts b/src/vs/editor/browser/widget/codeEditorWidget.ts index 4b868e26166..71fedb09e9b 100644 --- a/src/vs/editor/browser/widget/codeEditorWidget.ts +++ b/src/vs/editor/browser/widget/codeEditorWidget.ts @@ -376,7 +376,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE return this.model; } - public setModel(model: ITextModel = null): void { + public setModel(model: ITextModel | null = null): void { if (this.model === model) { // Current model is the new model return; @@ -1462,7 +1462,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE } private _detachModel(): ITextModel { - let removeDomNode: HTMLElement = null; + let removeDomNode: HTMLElement | null = null; if (this._view) { this._view.dispose(); diff --git a/src/vs/editor/browser/widget/diffEditorWidget.ts b/src/vs/editor/browser/widget/diffEditorWidget.ts index 86f20ba3d29..951c28430e8 100644 --- a/src/vs/editor/browser/widget/diffEditorWidget.ts +++ b/src/vs/editor/browser/widget/diffEditorWidget.ts @@ -847,8 +847,8 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE this._beginUpdateDecorationsTimeout = window.setTimeout(() => this._beginUpdateDecorations(), DiffEditorWidget.UPDATE_DIFF_DECORATIONS_DELAY); } - private _lastOriginalWarning: URI = null; - private _lastModifiedWarning: URI = null; + private _lastOriginalWarning: URI | null = null; + private _lastModifiedWarning: URI | null = null; private static _equals(a: URI, b: URI): boolean { if (!a && !b) { @@ -1334,7 +1334,7 @@ abstract class ViewZonesComputer { viewZoneLineNumber = originalEndEquivalentLineNumber; } - let marginDomNode: HTMLDivElement = null; + let marginDomNode: HTMLDivElement | null = null; if (lineChange && lineChange.modifiedStartLineNumber <= modifiedForeignVZ.current.afterLineNumber && modifiedForeignVZ.current.afterLineNumber <= lineChange.modifiedEndLineNumber) { marginDomNode = this._createOriginalMarginDomNodeForModifiedForeignViewZoneInAddedRegion(); } diff --git a/src/vs/editor/common/modes/linkComputer.ts b/src/vs/editor/common/modes/linkComputer.ts index 1813894e58d..b7f8b2d29b0 100644 --- a/src/vs/editor/common/modes/linkComputer.ts +++ b/src/vs/editor/common/modes/linkComputer.ts @@ -75,7 +75,7 @@ class StateMachine { } // State machine for http:// or https:// or file:// -let _stateMachine: StateMachine = null; +let _stateMachine: StateMachine | null = null; function getStateMachine(): StateMachine { if (_stateMachine === null) { _stateMachine = new StateMachine([ diff --git a/src/vs/editor/common/modes/supports/inplaceReplaceSupport.ts b/src/vs/editor/common/modes/supports/inplaceReplaceSupport.ts index ccefd954f4c..800568652d2 100644 --- a/src/vs/editor/common/modes/supports/inplaceReplaceSupport.ts +++ b/src/vs/editor/common/modes/supports/inplaceReplaceSupport.ts @@ -76,7 +76,7 @@ export class BasicInplaceReplace { } private valueSetsReplace(valueSets: string[][], value: string, up: boolean): string { - let result: string = null; + let result: string | null = null; for (let i = 0, len = valueSets.length; result === null && i < len; i++) { result = this.valueSetReplace(valueSets[i], value, up); } diff --git a/src/vs/editor/common/modes/supports/tokenization.ts b/src/vs/editor/common/modes/supports/tokenization.ts index b6bdbe778e0..c82bb3460bf 100644 --- a/src/vs/editor/common/modes/supports/tokenization.ts +++ b/src/vs/editor/common/modes/supports/tokenization.ts @@ -73,12 +73,12 @@ export function parseTokenTheme(source: ITokenThemeRule[]): ParsedTokenThemeRule } } - let foreground: string = null; + let foreground: string | null = null; if (typeof entry.foreground === 'string') { foreground = entry.foreground; } - let background: string = null; + let background: string | null = null; if (typeof entry.background === 'string') { background = entry.background; } diff --git a/src/vs/editor/common/services/editorSimpleWorker.ts b/src/vs/editor/common/services/editorSimpleWorker.ts index a2e0e336409..b5e0c80454f 100644 --- a/src/vs/editor/common/services/editorSimpleWorker.ts +++ b/src/vs/editor/common/services/editorSimpleWorker.ts @@ -547,7 +547,7 @@ export abstract class BaseEditorSimpleWorker { let selectionText = model.getValueInRange(range); let wordRange = model.getWordAtPosition({ lineNumber: range.startLineNumber, column: range.startColumn }, wordDefRegExp); - let word: string = null; + let word: string | null = null; if (wordRange !== null) { word = model.getValueInRange(wordRange); } diff --git a/src/vs/editor/common/services/languagesRegistry.ts b/src/vs/editor/common/services/languagesRegistry.ts index dd42f985385..34ea8598633 100644 --- a/src/vs/editor/common/services/languagesRegistry.ts +++ b/src/vs/editor/common/services/languagesRegistry.ts @@ -85,7 +85,7 @@ export class LanguagesRegistry { private _registerLanguage(lang: ILanguageExtensionPoint): void { const langId = lang.id; - let resolvedLanguage: IResolvedLanguage = null; + let resolvedLanguage: IResolvedLanguage | null = null; if (hasOwnProperty.call(this._languages, langId)) { resolvedLanguage = this._languages[langId]; } else { @@ -109,7 +109,7 @@ export class LanguagesRegistry { private _mergeLanguage(resolvedLanguage: IResolvedLanguage, lang: ILanguageExtensionPoint): void { const langId = lang.id; - let primaryMime: string = null; + let primaryMime: string | null = null; if (Array.isArray(lang.mimetypes) && lang.mimetypes.length > 0) { resolvedLanguage.mimetypes.push(...lang.mimetypes); diff --git a/src/vs/editor/common/services/modeServiceImpl.ts b/src/vs/editor/common/services/modeServiceImpl.ts index 0e99262b381..61b1a81b9f0 100644 --- a/src/vs/editor/common/services/modeServiceImpl.ts +++ b/src/vs/editor/common/services/modeServiceImpl.ts @@ -105,7 +105,7 @@ export class ModeServiceImpl implements IModeService { if (isPlainText) { // Try to do it synchronously - let r: IMode = null; + let r: IMode | null = null; this.getOrCreateMode(commaSeparatedMimetypesOrCommaSeparatedIds).then((mode) => { r = mode; }, onUnexpectedError); diff --git a/src/vs/editor/common/services/modelServiceImpl.ts b/src/vs/editor/common/services/modelServiceImpl.ts index 226dfea8816..301941c34d8 100644 --- a/src/vs/editor/common/services/modelServiceImpl.ts +++ b/src/vs/editor/common/services/modelServiceImpl.ts @@ -163,7 +163,7 @@ class ModelMarkerHandler { } } - let hoverMessage: MarkdownString = null; + let hoverMessage: MarkdownString | null = null; let { message, source, relatedInformation } = marker; if (typeof message === 'string') { diff --git a/src/vs/editor/common/view/minimapCharRenderer.ts b/src/vs/editor/common/view/minimapCharRenderer.ts index 82ed1c196eb..49d6afab3d9 100644 --- a/src/vs/editor/common/view/minimapCharRenderer.ts +++ b/src/vs/editor/common/view/minimapCharRenderer.ts @@ -8,7 +8,7 @@ import { Event, Emitter } from 'vs/base/common/event'; import { RGBA8 } from 'vs/editor/common/core/rgba'; export class MinimapTokensColorTracker { - private static _INSTANCE: MinimapTokensColorTracker = null; + private static _INSTANCE: MinimapTokensColorTracker | null = null; public static getInstance(): MinimapTokensColorTracker { if (!this._INSTANCE) { this._INSTANCE = new MinimapTokensColorTracker(); diff --git a/src/vs/editor/common/view/runtimeMinimapCharRenderer.ts b/src/vs/editor/common/view/runtimeMinimapCharRenderer.ts index 181c646378c..b8896f635b6 100644 --- a/src/vs/editor/common/view/runtimeMinimapCharRenderer.ts +++ b/src/vs/editor/common/view/runtimeMinimapCharRenderer.ts @@ -13,7 +13,7 @@ function toUint8ClampedArrat(arr: number[]): Uint8ClampedArray { return r; } -let minimapCharRenderer: MinimapCharRenderer = null; +let minimapCharRenderer: MinimapCharRenderer | null = null; export function getOrCreateMinimapCharRenderer(): MinimapCharRenderer { if (!minimapCharRenderer) { let _x1Data = toUint8ClampedArrat(x1Data); diff --git a/src/vs/editor/common/viewModel/splitLinesCollection.ts b/src/vs/editor/common/viewModel/splitLinesCollection.ts index 62042a5b391..84e5248438c 100644 --- a/src/vs/editor/common/viewModel/splitLinesCollection.ts +++ b/src/vs/editor/common/viewModel/splitLinesCollection.ts @@ -547,7 +547,7 @@ export class SplitLinesCollection implements IViewModelLinesCollection { const modelStartLineIndex = modelStart.lineNumber - 1; const modelEndLineIndex = modelEnd.lineNumber - 1; - let reqStart: Position = null; + let reqStart: Position | null = null; for (let modelLineIndex = modelStartLineIndex; modelLineIndex <= modelEndLineIndex; modelLineIndex++) { const line = this.lines[modelLineIndex]; if (line.isVisible()) { @@ -818,7 +818,7 @@ export class SplitLinesCollection implements IViewModelLinesCollection { const modelStartLineIndex = modelStart.lineNumber - 1; const modelEndLineIndex = modelEnd.lineNumber - 1; - let reqStart: Position = null; + let reqStart: Position | null = null; for (let modelLineIndex = modelStartLineIndex; modelLineIndex <= modelEndLineIndex; modelLineIndex++) { const line = this.lines[modelLineIndex]; if (line.isVisible()) { @@ -857,7 +857,7 @@ export class SplitLinesCollection implements IViewModelLinesCollection { // Eliminate duplicate decorations that might have intersected our visible ranges multiple times let finalResult: IModelDecoration[] = [], finalResultLen = 0; - let prevDecId: string = null; + let prevDecId: string | null = null; for (let i = 0, len = result.length; i < len; i++) { const dec = result[i]; const decId = dec.id; diff --git a/src/vs/editor/common/viewModel/viewModelImpl.ts b/src/vs/editor/common/viewModel/viewModelImpl.ts index bbc30dd1ae1..d2e0cd8deda 100644 --- a/src/vs/editor/common/viewModel/viewModelImpl.ts +++ b/src/vs/editor/common/viewModel/viewModelImpl.ts @@ -127,7 +127,7 @@ export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel private _onConfigurationChanged(eventsCollector: viewEvents.ViewEventsCollector, e: IConfigurationChangedEvent): void { // We might need to restore the current centered view range, so save it (if available) - let previousViewportStartModelPosition: Position = null; + let previousViewportStartModelPosition: Position | null = null; if (this.viewportStartLine !== -1) { let previousViewportStartViewPosition = new Position(this.viewportStartLine, this.getLineMinColumn(this.viewportStartLine)); previousViewportStartModelPosition = this.coordinatesConverter.convertViewPositionToModelPosition(previousViewportStartViewPosition); diff --git a/src/vs/editor/contrib/bracketMatching/bracketMatching.ts b/src/vs/editor/contrib/bracketMatching/bracketMatching.ts index 94611bc6bae..7a7b8c01d16 100644 --- a/src/vs/editor/contrib/bracketMatching/bracketMatching.ts +++ b/src/vs/editor/contrib/bracketMatching/bracketMatching.ts @@ -153,7 +153,7 @@ export class BracketMatchingController extends Disposable implements editorCommo // find matching brackets if position is on a bracket const brackets = model.matchBracket(position); - let newCursorPosition: Position = null; + let newCursorPosition: Position | null = null; if (brackets) { if (brackets[0].containsPosition(position)) { newCursorPosition = brackets[1].getStartPosition(); @@ -191,8 +191,8 @@ export class BracketMatchingController extends Disposable implements editorCommo let brackets = model.matchBracket(position); - let openBracket: Position = null; - let closeBracket: Position = null; + let openBracket: Position | null = null; + let closeBracket: Position | null = null; if (!brackets) { const nextBracket = model.findNextBracket(position); diff --git a/src/vs/editor/contrib/contextmenu/contextmenu.ts b/src/vs/editor/contrib/contextmenu/contextmenu.ts index 668cdcc3617..3268ea4da95 100644 --- a/src/vs/editor/contrib/contextmenu/contextmenu.ts +++ b/src/vs/editor/contrib/contextmenu/contextmenu.ts @@ -137,7 +137,7 @@ export class ContextMenuController implements IEditorContribution { return result; } - private _doShowContextMenu(actions: IAction[], forcedPosition: IPosition = null): void { + private _doShowContextMenu(actions: IAction[], forcedPosition: IPosition | null = null): void { // Disable hover const oldHoverSetting = this._editor.getConfiguration().contribInfo.hover; diff --git a/src/vs/editor/contrib/find/findDecorations.ts b/src/vs/editor/contrib/find/findDecorations.ts index e05f4be3987..2b5a30ff8c6 100644 --- a/src/vs/editor/contrib/find/findDecorations.ts +++ b/src/vs/editor/contrib/find/findDecorations.ts @@ -93,7 +93,7 @@ export class FindDecorations implements IDisposable { } public setCurrentFindMatch(nextMatch: Range): number { - let newCurrentDecorationId: string = null; + let newCurrentDecorationId: string | null = null; let matchPosition = 0; if (nextMatch) { for (let i = 0, len = this._decorations.length; i < len; i++) { diff --git a/src/vs/editor/contrib/find/findModel.ts b/src/vs/editor/contrib/find/findModel.ts index 00db5dc69dc..146d28ad3d8 100644 --- a/src/vs/editor/contrib/find/findModel.ts +++ b/src/vs/editor/contrib/find/findModel.ts @@ -170,7 +170,7 @@ export class FindModelBoundToEditorModel { } private research(moveCursor: boolean, newFindScope?: Range): void { - let findScope: Range = null; + let findScope: Range | null = null; if (typeof newFindScope !== 'undefined') { findScope = newFindScope; } else { diff --git a/src/vs/editor/contrib/find/replacePattern.ts b/src/vs/editor/contrib/find/replacePattern.ts index e82ff9dc45a..a4ee990ea20 100644 --- a/src/vs/editor/contrib/find/replacePattern.ts +++ b/src/vs/editor/contrib/find/replacePattern.ts @@ -195,7 +195,7 @@ export function parseReplaceString(replaceString: string): ReplacePattern { } let nextChCode = replaceString.charCodeAt(i); - // let replaceWithCharacter: string = null; + // let replaceWithCharacter: string | null = null; switch (nextChCode) { case CharCode.Backslash: diff --git a/src/vs/editor/contrib/folding/syntaxRangeProvider.ts b/src/vs/editor/contrib/folding/syntaxRangeProvider.ts index 9c9c51a5abd..0fec4f9b450 100644 --- a/src/vs/editor/contrib/folding/syntaxRangeProvider.ts +++ b/src/vs/editor/contrib/folding/syntaxRangeProvider.ts @@ -156,7 +156,7 @@ export function sanitizeRanges(rangeData: IFoldingRangeData[], limit: number): F }); let collector = new RangesCollector(limit); - let top: IFoldingRangeData = null; + let top: IFoldingRangeData | null = null; let previous = []; for (let entry of sorted) { if (!top) { diff --git a/src/vs/editor/contrib/markdown/markdownRenderer.ts b/src/vs/editor/contrib/markdown/markdownRenderer.ts index 671fdbc165c..561d886ea12 100644 --- a/src/vs/editor/contrib/markdown/markdownRenderer.ts +++ b/src/vs/editor/contrib/markdown/markdownRenderer.ts @@ -28,7 +28,7 @@ export class MarkdownRenderer { constructor( private readonly _editor: ICodeEditor, @IModeService private readonly _modeService: IModeService, - @optional(IOpenerService) private readonly _openerService: IOpenerService = NullOpenerService, + @optional(IOpenerService) private readonly _openerService: IOpenerService | null = NullOpenerService, ) { } diff --git a/src/vs/editor/contrib/multicursor/multicursor.ts b/src/vs/editor/contrib/multicursor/multicursor.ts index 55bfa59e446..c37b1d7a7be 100644 --- a/src/vs/editor/contrib/multicursor/multicursor.ts +++ b/src/vs/editor/contrib/multicursor/multicursor.ts @@ -206,7 +206,7 @@ export class MultiCursorSession { const s = editor.getSelection(); let searchText: string; - let currentMatch: Selection = null; + let currentMatch: Selection | null = null; if (s.isEmpty()) { // selection is empty => expand to current word diff --git a/src/vs/editor/contrib/smartSelect/test/tokenSelectionSupport.test.ts b/src/vs/editor/contrib/smartSelect/test/tokenSelectionSupport.test.ts index a31987aab62..54f7e4601b9 100644 --- a/src/vs/editor/contrib/smartSelect/test/tokenSelectionSupport.test.ts +++ b/src/vs/editor/contrib/smartSelect/test/tokenSelectionSupport.test.ts @@ -35,9 +35,9 @@ class MockJSMode extends MockMode { suite('TokenSelectionSupport', () => { - let modelService: ModelServiceImpl = null; + let modelService: ModelServiceImpl | null = null; let tokenSelectionSupport: TokenSelectionSupport; - let mode: MockJSMode = null; + let mode: MockJSMode | null = null; setup(() => { modelService = new ModelServiceImpl(null, new TestConfigurationService()); diff --git a/src/vs/editor/standalone/browser/colorizer.ts b/src/vs/editor/standalone/browser/colorizer.ts index 4e79aaaed50..47a2bc4aa05 100644 --- a/src/vs/editor/standalone/browser/colorizer.ts +++ b/src/vs/editor/standalone/browser/colorizer.ts @@ -65,8 +65,8 @@ export class Colorizer { } return new Promise((resolve, reject) => { - let listener: IDisposable = null; - let timeout: TimeoutTimer = null; + let listener: IDisposable | null = null; + let timeout: TimeoutTimer | null = null; const execute = () => { if (listener) { diff --git a/src/vs/editor/standalone/browser/quickOpen/quickOutline.ts b/src/vs/editor/standalone/browser/quickOpen/quickOutline.ts index f81c9c3801b..24526f675d5 100644 --- a/src/vs/editor/standalone/browser/quickOpen/quickOutline.ts +++ b/src/vs/editor/standalone/browser/quickOpen/quickOutline.ts @@ -190,7 +190,7 @@ export class QuickOutlineAction extends BaseEditorQuickOpenAction { if (highlights) { // Show parent scope as description - let description: string = null; + let description: string | null = null; if (element.containerName) { description = element.containerName; } @@ -211,8 +211,8 @@ export class QuickOutlineAction extends BaseEditorQuickOpenAction { // Mark all type groups if (results.length > 0 && searchValue.indexOf(SCOPE_PREFIX) === 0) { - let currentType: string = null; - let currentResult: SymbolEntry = null; + let currentType: string | null = null; + let currentResult: SymbolEntry | null = null; let typeCounter = 0; for (let i = 0; i < results.length; i++) { diff --git a/src/vs/editor/standalone/browser/standaloneEditor.ts b/src/vs/editor/standalone/browser/standaloneEditor.ts index de8707ac01b..9edf689c5f5 100644 --- a/src/vs/editor/standalone/browser/standaloneEditor.ts +++ b/src/vs/editor/standalone/browser/standaloneEditor.ts @@ -40,7 +40,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur function withAllStandaloneServices(domElement: HTMLElement, override: IEditorOverrideServices, callback: (services: DynamicStandaloneServices) => T): T { let services = new DynamicStandaloneServices(domElement, override); - let simpleEditorModelResolverService: SimpleEditorModelResolverService = null; + let simpleEditorModelResolverService: SimpleEditorModelResolverService | null = null; if (!services.has(ITextModelService)) { simpleEditorModelResolverService = new SimpleEditorModelResolverService(); services.set(ITextModelService, simpleEditorModelResolverService); diff --git a/src/vs/editor/standalone/browser/standaloneServices.ts b/src/vs/editor/standalone/browser/standaloneServices.ts index d7394655adf..ea773d81490 100644 --- a/src/vs/editor/standalone/browser/standaloneServices.ts +++ b/src/vs/editor/standalone/browser/standaloneServices.ts @@ -168,7 +168,7 @@ export class DynamicStandaloneServices extends Disposable { const themeService = this.get(IThemeService); let ensure = (serviceId: ServiceIdentifier, factory: () => T): T => { - let value: T = null; + let value: T | null = null; if (overrides) { value = overrides[serviceId.toString()]; } diff --git a/src/vs/editor/standalone/common/monarch/monarchLexer.ts b/src/vs/editor/standalone/common/monarch/monarchLexer.ts index 2e15f360eaa..f6aa9ed5733 100644 --- a/src/vs/editor/standalone/common/monarch/monarchLexer.ts +++ b/src/vs/editor/standalone/common/monarch/monarchLexer.ts @@ -529,11 +529,11 @@ class MonarchTokenizer implements modes.ITokenizationSupport { const state = stack.state; let matches: string[] = null; - let matched: string = null; + let matched: string | null = null; let action: monarchCommon.FuzzyAction | monarchCommon.FuzzyAction[] = null; let rule: monarchCommon.IRule = null; - let enteringEmbeddedMode: string = null; + let enteringEmbeddedMode: string | null = null; // check if we need to process group matches first if (groupActions) { @@ -738,7 +738,7 @@ class MonarchTokenizer implements modes.ITokenizationSupport { // return the result (and check for brace matching) // todo: for efficiency we could pre-sanitize tokenPostfix and substitutions - let tokenType: string = null; + let tokenType: string | null = null; if (monarchCommon.isString(result) && result.indexOf('@brackets') === 0) { let rest = result.substr('@brackets'.length); let bracket = findBracket(this._lexer, matched); diff --git a/src/vs/editor/test/browser/controller/cursor.test.ts b/src/vs/editor/test/browser/controller/cursor.test.ts index fd97276f0db..b4df2444ab3 100644 --- a/src/vs/editor/test/browser/controller/cursor.test.ts +++ b/src/vs/editor/test/browser/controller/cursor.test.ts @@ -2384,7 +2384,7 @@ suite('Editor Controller - Cursor Configuration', () => { class TestCommand implements ICommand { - private _selectionId: string = null; + private _selectionId: string | null = null; public getEditOperations(model: ITextModel, builder: IEditOperationBuilder): void { builder.addEditOperation(new Range(1, 13, 1, 14), ''); @@ -3824,7 +3824,7 @@ suite('ElectricCharacter', () => { languageIdentifier: mode.getLanguageIdentifier() }, (model, cursor) => { moveTo(cursor, 1, 5); - let changeText: string = null; + let changeText: string | null = null; model.onDidChangeContent(e => { changeText = e.changes[0].text; }); diff --git a/src/vs/editor/test/browser/testCodeEditor.ts b/src/vs/editor/test/browser/testCodeEditor.ts index 914a82a127f..00233ee4c3a 100644 --- a/src/vs/editor/test/browser/testCodeEditor.ts +++ b/src/vs/editor/test/browser/testCodeEditor.ts @@ -54,7 +54,7 @@ export class TestCodeEditor extends CodeEditorWidget implements editorBrowser.IC } class TestEditorDomElement { - parentElement: IContextKeyServiceTarget = null; + parentElement: IContextKeyServiceTarget | null = null; setAttribute(attr: string, value: string): void { } removeAttribute(attr: string): void { } hasAttribute(attr: string): boolean { return false; } diff --git a/src/vs/editor/test/common/editorTestUtils.ts b/src/vs/editor/test/common/editorTestUtils.ts index daeeb7ea91f..6d800762f3b 100644 --- a/src/vs/editor/test/common/editorTestUtils.ts +++ b/src/vs/editor/test/common/editorTestUtils.ts @@ -24,7 +24,7 @@ export interface IRelaxedTextModelCreationOptions { largeFileOptimizations?: boolean; } -export function createTextModel(text: string, _options: IRelaxedTextModelCreationOptions = TextModel.DEFAULT_CREATION_OPTIONS, languageIdentifier: LanguageIdentifier = null, uri: URI = null): TextModel { +export function createTextModel(text: string, _options: IRelaxedTextModelCreationOptions = TextModel.DEFAULT_CREATION_OPTIONS, languageIdentifier: LanguageIdentifier | null = null, uri: URI | null = null): TextModel { const options: ITextModelCreationOptions = { tabSize: (typeof _options.tabSize === 'undefined' ? TextModel.DEFAULT_CREATION_OPTIONS.tabSize : _options.tabSize), insertSpaces: (typeof _options.insertSpaces === 'undefined' ? TextModel.DEFAULT_CREATION_OPTIONS.insertSpaces : _options.insertSpaces), diff --git a/src/vs/editor/test/common/model/model.modes.test.ts b/src/vs/editor/test/common/model/model.modes.test.ts index 177cd2c3d72..24281106b4e 100644 --- a/src/vs/editor/test/common/model/model.modes.test.ts +++ b/src/vs/editor/test/common/model/model.modes.test.ts @@ -32,8 +32,8 @@ suite('Editor Model - Model Modes 1', () => { } }; - let thisModel: TextModel = null; - let languageRegistration: IDisposable = null; + let thisModel: TextModel | null = null; + let languageRegistration: IDisposable | null = null; setup(() => { const TEXT = @@ -202,8 +202,8 @@ suite('Editor Model - Model Modes 2', () => { stateEqual((model)._tokens._lastState, states[len]); } - let thisModel: TextModel = null; - let languageRegistration: IDisposable = null; + let thisModel: TextModel | null = null; + let languageRegistration: IDisposable | null = null; setup(() => { const TEXT = diff --git a/src/vs/editor/test/common/model/model.test.ts b/src/vs/editor/test/common/model/model.test.ts index cdac6b024ca..8227f32b703 100644 --- a/src/vs/editor/test/common/model/model.test.ts +++ b/src/vs/editor/test/common/model/model.test.ts @@ -104,7 +104,7 @@ suite('Editor Model - Model', () => { }); test('model insert text without newline eventing', () => { - let e: ModelRawContentChangedEvent = null; + let e: ModelRawContentChangedEvent | null = null; thisModel.onDidChangeRawContent((_e) => { if (e !== null) { assert.fail('Unexpected assertion error'); @@ -123,7 +123,7 @@ suite('Editor Model - Model', () => { }); test('model insert text with one newline eventing', () => { - let e: ModelRawContentChangedEvent = null; + let e: ModelRawContentChangedEvent | null = null; thisModel.onDidChangeRawContent((_e) => { if (e !== null) { assert.fail('Unexpected assertion error'); @@ -200,7 +200,7 @@ suite('Editor Model - Model', () => { }); test('model delete text from one line eventing', () => { - let e: ModelRawContentChangedEvent = null; + let e: ModelRawContentChangedEvent | null = null; thisModel.onDidChangeRawContent((_e) => { if (e !== null) { assert.fail('Unexpected assertion error'); @@ -219,7 +219,7 @@ suite('Editor Model - Model', () => { }); test('model delete all text from a line eventing', () => { - let e: ModelRawContentChangedEvent = null; + let e: ModelRawContentChangedEvent | null = null; thisModel.onDidChangeRawContent((_e) => { if (e !== null) { assert.fail('Unexpected assertion error'); @@ -238,7 +238,7 @@ suite('Editor Model - Model', () => { }); test('model delete text from two lines eventing', () => { - let e: ModelRawContentChangedEvent = null; + let e: ModelRawContentChangedEvent | null = null; thisModel.onDidChangeRawContent((_e) => { if (e !== null) { assert.fail('Unexpected assertion error'); @@ -258,7 +258,7 @@ suite('Editor Model - Model', () => { }); test('model delete text from many lines eventing', () => { - let e: ModelRawContentChangedEvent = null; + let e: ModelRawContentChangedEvent | null = null; thisModel.onDidChangeRawContent((_e) => { if (e !== null) { assert.fail('Unexpected assertion error'); @@ -309,7 +309,7 @@ suite('Editor Model - Model', () => { // --------- setValue test('setValue eventing', () => { - let e: ModelRawContentChangedEvent = null; + let e: ModelRawContentChangedEvent | null = null; thisModel.onDidChangeRawContent((_e) => { if (e !== null) { assert.fail('Unexpected assertion error'); diff --git a/src/vs/editor/test/common/model/textModelWithTokens.test.ts b/src/vs/editor/test/common/model/textModelWithTokens.test.ts index d4f443411b6..9350a8278db 100644 --- a/src/vs/editor/test/common/model/textModelWithTokens.test.ts +++ b/src/vs/editor/test/common/model/textModelWithTokens.test.ts @@ -157,7 +157,7 @@ suite('TextModelWithTokens - bracket matching', () => { } const languageIdentifier = new LanguageIdentifier('bracketMode1', LanguageId.PlainText); - let registration: IDisposable = null; + let registration: IDisposable | null = null; setup(() => { registration = LanguageConfigurationRegistry.register(languageIdentifier, { diff --git a/src/vs/editor/test/common/viewModel/splitLinesCollection.test.ts b/src/vs/editor/test/common/viewModel/splitLinesCollection.test.ts index 08974cba494..6a022329bdd 100644 --- a/src/vs/editor/test/common/viewModel/splitLinesCollection.test.ts +++ b/src/vs/editor/test/common/viewModel/splitLinesCollection.test.ts @@ -321,8 +321,8 @@ suite('SplitLinesCollection', () => { ] ]; - let model: TextModel = null; - let languageRegistration: IDisposable = null; + let model: TextModel | null = null; + let languageRegistration: IDisposable | null = null; setup(() => { let _lineIndex = 0; diff --git a/src/vs/platform/configuration/common/configurationModels.ts b/src/vs/platform/configuration/common/configurationModels.ts index ade76fc5ec0..78ac8b14af8 100644 --- a/src/vs/platform/configuration/common/configurationModels.ts +++ b/src/vs/platform/configuration/common/configurationModels.ts @@ -190,7 +190,7 @@ export class DefaultConfigurationModel extends ConfigurationModel { export class ConfigurationModelParser { - private _configurationModel: ConfigurationModel = null; + private _configurationModel: ConfigurationModel | null = null; private _parseErrors: any[] = []; constructor(protected readonly _name: string) { } @@ -211,7 +211,7 @@ export class ConfigurationModelParser { protected parseContent(content: string): any { let raw: any = {}; - let currentProperty: string = null; + let currentProperty: string | null = null; let currentParent: any = []; let previousParents: any[] = []; let parseErrors: json.ParseError[] = []; @@ -276,7 +276,7 @@ export class ConfigurationModelParser { export class Configuration { - private _workspaceConsolidatedConfiguration: ConfigurationModel = null; + private _workspaceConsolidatedConfiguration: ConfigurationModel | null = null; private _foldersConsolidatedConfigurations: ResourceMap = new ResourceMap(); constructor( diff --git a/src/vs/platform/contextkey/browser/contextKeyService.ts b/src/vs/platform/contextkey/browser/contextKeyService.ts index 7bd1144931a..31b0b7f49f8 100644 --- a/src/vs/platform/contextkey/browser/contextKeyService.ts +++ b/src/vs/platform/contextkey/browser/contextKeyService.ts @@ -278,7 +278,7 @@ export class ContextKeyService extends AbstractContextKeyService implements ICon this._toDispose.push(myContext); // Uncomment this to see the contexts continuously logged - // let lastLoggedValue: string = null; + // let lastLoggedValue: string | null = null; // setInterval(() => { // let values = Object.keys(this._contexts).map((key) => this._contexts[key]); // let logValue = values.map(v => JSON.stringify(v._value, null, '\t')).join('\n'); diff --git a/src/vs/platform/extensionManagement/node/extensionManagementIpc.ts b/src/vs/platform/extensionManagement/node/extensionManagementIpc.ts index 80223ea024d..43931e9a68c 100644 --- a/src/vs/platform/extensionManagement/node/extensionManagementIpc.ts +++ b/src/vs/platform/extensionManagement/node/extensionManagementIpc.ts @@ -107,7 +107,7 @@ export class ExtensionManagementChannelClient implements IExtensionManagementSer return Promise.resolve(this.channel.call('reinstallFromGallery', [this._transformOutgoing(extension)])); } - getInstalled(type: LocalExtensionType = null): Promise { + getInstalled(type: LocalExtensionType | null = null): Promise { return Promise.resolve(this.channel.call('getInstalled', [type])) .then(extensions => extensions.map(extension => this._transformIncoming(extension))); } diff --git a/src/vs/platform/extensionManagement/node/extensionManagementService.ts b/src/vs/platform/extensionManagement/node/extensionManagementService.ts index 478f253a733..7e92f58fc62 100644 --- a/src/vs/platform/extensionManagement/node/extensionManagementService.ts +++ b/src/vs/platform/extensionManagement/node/extensionManagementService.ts @@ -713,7 +713,7 @@ export class ExtensionManagementService extends Disposable implements IExtension this._onDidUninstallExtension.fire({ identifier: extension.identifier, error: errorcode }); } - getInstalled(type: LocalExtensionType = null): Promise { + getInstalled(type: LocalExtensionType | null = null): Promise { const promises = []; if (type === null || type === LocalExtensionType.System) { @@ -852,7 +852,7 @@ export class ExtensionManagementService extends Disposable implements IExtension private async withUninstalledExtensions(fn: (uninstalled: { [id: string]: boolean; }) => T): Promise { return await this.uninstalledFileLimiter.queue(() => { - let result: T = null; + let result: T | null = null; return pfs.readFile(this.uninstalledPath, 'utf8') .then(null, err => err.code === 'ENOENT' ? Promise.resolve('{}') : Promise.reject(err)) .then<{ [id: string]: boolean }>(raw => { try { return JSON.parse(raw); } catch (e) { return {}; } }) diff --git a/src/vs/platform/keybinding/test/common/abstractKeybindingService.test.ts b/src/vs/platform/keybinding/test/common/abstractKeybindingService.test.ts index 0e881d97d50..43038d92f90 100644 --- a/src/vs/platform/keybinding/test/common/abstractKeybindingService.test.ts +++ b/src/vs/platform/keybinding/test/common/abstractKeybindingService.test.ts @@ -83,7 +83,7 @@ suite('AbstractKeybindingService', () => { } let createTestKeybindingService: (items: ResolvedKeybindingItem[], contextValue?: any) => TestKeybindingService = null; - let currentContextValue: IContext = null; + let currentContextValue: IContext | null = null; let executeCommandCalls: { commandId: string; args: any[]; }[] = null; let showMessageCalls: { sev: Severity, message: any; }[] = null; let statusMessageCalls: string[] = null; @@ -173,7 +173,7 @@ suite('AbstractKeybindingService', () => { statusMessageCallsDisposed = null; }); - function kbItem(keybinding: number, command: string, when: ContextKeyExpr = null): ResolvedKeybindingItem { + function kbItem(keybinding: number, command: string, when: ContextKeyExpr | null = null): ResolvedKeybindingItem { const resolvedKeybinding = (keybinding !== 0 ? new USLayoutResolvedKeybinding(createKeybinding(keybinding, OS), OS) : null); return new ResolvedKeybindingItem( resolvedKeybinding, diff --git a/src/vs/platform/localizations/node/localizations.ts b/src/vs/platform/localizations/node/localizations.ts index 46bd114b4cf..d08a4100a2f 100644 --- a/src/vs/platform/localizations/node/localizations.ts +++ b/src/vs/platform/localizations/node/localizations.ts @@ -170,7 +170,7 @@ class LanguagePacksCache extends Disposable { private withLanguagePacks(fn: (languagePacks: { [language: string]: ILanguagePack }) => T = () => null): TPromise { return this.languagePacksFileLimiter.queue(() => { - let result: T = null; + let result: T | null = null; return pfs.readFile(this.languagePacksFilePath, 'utf8') .then(null, err => err.code === 'ENOENT' ? TPromise.as('{}') : TPromise.wrapError(err)) .then<{ [language: string]: ILanguagePack }>(raw => { try { return JSON.parse(raw); } catch (e) { return {}; } }) diff --git a/src/vs/platform/search/common/replace.ts b/src/vs/platform/search/common/replace.ts index 647b5d51a0d..d5100b6fc7d 100644 --- a/src/vs/platform/search/common/replace.ts +++ b/src/vs/platform/search/common/replace.ts @@ -93,7 +93,7 @@ export class ReplacePattern { } let nextChCode = replaceString.charCodeAt(i); - let replaceWithCharacter: string = null; + let replaceWithCharacter: string | null = null; switch (nextChCode) { case CharCode.Backslash: @@ -127,7 +127,7 @@ export class ReplacePattern { } let nextChCode = replaceString.charCodeAt(i); - let replaceWithCharacter: string = null; + let replaceWithCharacter: string | null = null; switch (nextChCode) { case CharCode.Digit0: diff --git a/src/vs/platform/state/node/stateService.ts b/src/vs/platform/state/node/stateService.ts index 45d5792cdb6..57c369a9275 100644 --- a/src/vs/platform/state/node/stateService.ts +++ b/src/vs/platform/state/node/stateService.ts @@ -13,7 +13,7 @@ import { ILogService } from 'vs/platform/log/common/log'; export class FileStorage { - private database: object = null; + private database: object | null = null; constructor(private dbPath: string, private onError: (error) => void) { } diff --git a/src/vs/platform/update/electron-main/updateService.win32.ts b/src/vs/platform/update/electron-main/updateService.win32.ts index 26ce1ea7c7f..9bb827b2b9c 100644 --- a/src/vs/platform/update/electron-main/updateService.win32.ts +++ b/src/vs/platform/update/electron-main/updateService.win32.ts @@ -194,7 +194,7 @@ export class Win32UpdateService extends AbstractUpdateService { return this.cachePath.then(cachePath => path.join(cachePath, `CodeSetup-${product.quality}-${version}.exe`)); } - private cleanup(exceptVersion: string = null): Promise { + private cleanup(exceptVersion: string | null = null): Promise { const filter = exceptVersion ? one => !(new RegExp(`${product.quality}-${exceptVersion}\\.exe$`).test(one)) : () => true; return this.cachePath diff --git a/src/vs/platform/workspace/common/workspace.ts b/src/vs/platform/workspace/common/workspace.ts index ef2cab484e7..dbedcbd5f6b 100644 --- a/src/vs/platform/workspace/common/workspace.ts +++ b/src/vs/platform/workspace/common/workspace.ts @@ -145,7 +145,7 @@ export class Workspace implements IWorkspace { constructor( private _id: string, folders: WorkspaceFolder[] = [], - private _configuration: URI = null, + private _configuration: URI | null = null, private _ctime?: number ) { this.folders = folders; diff --git a/src/vs/workbench/api/electron-browser/mainThreadDocumentsAndEditors.ts b/src/vs/workbench/api/electron-browser/mainThreadDocumentsAndEditors.ts index 182ee957f5d..6ba27704f66 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadDocumentsAndEditors.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadDocumentsAndEditors.ts @@ -246,7 +246,7 @@ class MainThreadDocumentAndEditorStateComputer { // editor: only take those that have a not too large model const editors = new Map(); - let activeEditor: string = null; + let activeEditor: string | null = null; for (const editor of this._codeEditorService.listCodeEditors()) { if (editor.isSimpleWidget) { diff --git a/src/vs/workbench/api/electron-browser/mainThreadSaveParticipant.ts b/src/vs/workbench/api/electron-browser/mainThreadSaveParticipant.ts index 2f9bbc5ae56..a3363290ea8 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadSaveParticipant.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadSaveParticipant.ts @@ -86,7 +86,7 @@ class TrimWhitespaceParticipant implements ISaveParticipantParticipant { } function findEditor(model: ITextModel, codeEditorService: ICodeEditorService): ICodeEditor { - let candidate: ICodeEditor = null; + let candidate: ICodeEditor | null = null; if (model.isAttachedToEditor()) { for (const editor of codeEditorService.listCodeEditors()) { diff --git a/src/vs/workbench/api/node/extHost.api.impl.ts b/src/vs/workbench/api/node/extHost.api.impl.ts index f625545fdf4..2b90e28cc11 100644 --- a/src/vs/workbench/api/node/extHost.api.impl.ts +++ b/src/vs/workbench/api/node/extHost.api.impl.ts @@ -97,7 +97,7 @@ export function createApiFactory( extHostLogService: ExtHostLogService ): IExtensionApiFactory { - let schemeTransformer: ISchemeTransformer = null; + let schemeTransformer: ISchemeTransformer | null = null; // Addressable instances rpcProtocol.set(ExtHostContext.ExtHostLogService, extHostLogService); diff --git a/src/vs/workbench/api/node/extHostExtensionService.ts b/src/vs/workbench/api/node/extHostExtensionService.ts index 58aee7c4922..94ba0a24561 100644 --- a/src/vs/workbench/api/node/extHostExtensionService.ts +++ b/src/vs/workbench/api/node/extHostExtensionService.ts @@ -407,7 +407,7 @@ export class ExtHostExtensionService implements ExtHostExtensionServiceShape { } function loadCommonJSModule(logService: ILogService, modulePath: string, activationTimesBuilder: ExtensionActivationTimesBuilder): TPromise { - let r: T = null; + let r: T | null = null; activationTimesBuilder.codeLoadingStart(); logService.info(`ExtensionService#loadCommonJSModule ${modulePath}`); try { diff --git a/src/vs/workbench/api/node/extHostTerminalService.ts b/src/vs/workbench/api/node/extHostTerminalService.ts index edfa19e3fd5..ce1df33cafd 100644 --- a/src/vs/workbench/api/node/extHostTerminalService.ts +++ b/src/vs/workbench/api/node/extHostTerminalService.ts @@ -487,7 +487,7 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape { } private _getTerminalObjectIndexById(array: T[], id: number): number { - let index: number = null; + let index: number | null = null; array.some((item, i) => { const thisId = item._id; if (thisId === id) { diff --git a/src/vs/workbench/api/node/extHostTextEditor.ts b/src/vs/workbench/api/node/extHostTextEditor.ts index 2f559fc4180..286e1521399 100644 --- a/src/vs/workbench/api/node/extHostTextEditor.ts +++ b/src/vs/workbench/api/node/extHostTextEditor.ts @@ -76,7 +76,7 @@ export class TextEditorEdit { } replace(location: Position | Range | Selection, value: string): void { - let range: Range = null; + let range: Range | null = null; if (location instanceof Position) { range = new Range(location, location); @@ -94,7 +94,7 @@ export class TextEditorEdit { } delete(location: Range | Selection): void { - let range: Range = null; + let range: Range | null = null; if (location instanceof Range) { range = location; diff --git a/src/vs/workbench/browser/parts/editor/rangeDecorations.ts b/src/vs/workbench/browser/parts/editor/rangeDecorations.ts index 01b87948707..7bee04f8a7d 100644 --- a/src/vs/workbench/browser/parts/editor/rangeDecorations.ts +++ b/src/vs/workbench/browser/parts/editor/rangeDecorations.ts @@ -21,8 +21,8 @@ export interface IRangeHighlightDecoration { export class RangeHighlightDecorations extends Disposable { - private rangeHighlightDecorationId: string = null; - private editor: ICodeEditor = null; + private rangeHighlightDecorationId: string | null = null; + private editor: ICodeEditor | null = null; private editorDisposables: IDisposable[] = []; private readonly _onHighlightRemoved: Emitter = this._register(new Emitter()); diff --git a/src/vs/workbench/browser/parts/editor/resourceViewer.ts b/src/vs/workbench/browser/parts/editor/resourceViewer.ts index 9c6c760e2ae..73805e8ea9e 100644 --- a/src/vs/workbench/browser/parts/editor/resourceViewer.ts +++ b/src/vs/workbench/browser/parts/editor/resourceViewer.ts @@ -383,7 +383,7 @@ class InlineImageView { const initialState: ImageState = InlineImageView.imageStateCache.get(cacheKey) || { scale: 'fit', offsetX: 0, offsetY: 0 }; let scale = initialState.scale; - let image: HTMLImageElement = null; + let image: HTMLImageElement | null = null; function updateScale(newScale: Scale) { if (!image || !image.parentElement) { diff --git a/src/vs/workbench/browser/parts/quickinput/quickInputBox.ts b/src/vs/workbench/browser/parts/quickinput/quickInputBox.ts index ef72c944eea..0ab4759c312 100644 --- a/src/vs/workbench/browser/parts/quickinput/quickInputBox.ts +++ b/src/vs/workbench/browser/parts/quickinput/quickInputBox.ts @@ -46,7 +46,7 @@ export class QuickInputBox { this.inputBox.value = value; } - select(range: IRange = null): void { + select(range: IRange | null = null): void { this.inputBox.select(range); } diff --git a/src/vs/workbench/browser/parts/quickopen/quickopen.ts b/src/vs/workbench/browser/parts/quickopen/quickopen.ts index b83c4cd5476..b5029814e52 100644 --- a/src/vs/workbench/browser/parts/quickopen/quickopen.ts +++ b/src/vs/workbench/browser/parts/quickopen/quickopen.ts @@ -20,7 +20,7 @@ export const defaultQuickOpenContext = ContextKeyExpr.and(inQuickOpenContext, Co export const QUICKOPEN_ACTION_ID = 'workbench.action.quickOpen'; export const QUICKOPEN_ACION_LABEL = nls.localize('quickOpen', "Go to File..."); -CommandsRegistry.registerCommand(QUICKOPEN_ACTION_ID, function (accessor: ServicesAccessor, prefix: string = null) { +CommandsRegistry.registerCommand(QUICKOPEN_ACTION_ID, function (accessor: ServicesAccessor, prefix: string | null = null) { const quickOpenService = accessor.get(IQuickOpenService); return quickOpenService.show(typeof prefix === 'string' ? prefix : null).then(() => { @@ -29,7 +29,7 @@ CommandsRegistry.registerCommand(QUICKOPEN_ACTION_ID, function (accessor: Servic }); export const QUICKOPEN_FOCUS_SECONDARY_ACTION_ID = 'workbench.action.quickOpenPreviousEditor'; -CommandsRegistry.registerCommand(QUICKOPEN_FOCUS_SECONDARY_ACTION_ID, function (accessor: ServicesAccessor, prefix: string = null) { +CommandsRegistry.registerCommand(QUICKOPEN_FOCUS_SECONDARY_ACTION_ID, function (accessor: ServicesAccessor, prefix: string | null = null) { const quickOpenService = accessor.get(IQuickOpenService); return quickOpenService.show(null, { autoFocus: { autoFocusSecondEntry: true } }).then(() => { diff --git a/src/vs/workbench/electron-browser/resources.ts b/src/vs/workbench/electron-browser/resources.ts index 1fb0d516674..0fe7e095669 100644 --- a/src/vs/workbench/electron-browser/resources.ts +++ b/src/vs/workbench/electron-browser/resources.ts @@ -15,7 +15,7 @@ import { normalize } from 'vs/base/common/paths'; export class ResourceGlobMatcher extends Disposable { - private static readonly NO_ROOT: string = null; + private static readonly NO_ROOT: string | null = null; private readonly _onExpressionChange: Emitter = this._register(new Emitter()); get onExpressionChange(): Event { return this._onExpressionChange.event; } diff --git a/src/vs/workbench/electron-browser/workbench.ts b/src/vs/workbench/electron-browser/workbench.ts index 90a5bea714a..14f5dba8646 100644 --- a/src/vs/workbench/electron-browser/workbench.ts +++ b/src/vs/workbench/electron-browser/workbench.ts @@ -1177,7 +1177,7 @@ export class Workbench extends Disposable implements IPartService { } getContainer(part: Parts): HTMLElement { - let container: HTMLElement = null; + let container: HTMLElement | null = null; switch (part) { case Parts.TITLEBAR_PART: container = this.titlebarPart.getContainer(); diff --git a/src/vs/workbench/parts/cli/electron-browser/cli.contribution.ts b/src/vs/workbench/parts/cli/electron-browser/cli.contribution.ts index 29c3894ea60..2d9acea3803 100644 --- a/src/vs/workbench/parts/cli/electron-browser/cli.contribution.ts +++ b/src/vs/workbench/parts/cli/electron-browser/cli.contribution.ts @@ -21,11 +21,11 @@ import Severity from 'vs/base/common/severity'; import { ILogService } from 'vs/platform/log/common/log'; import { getPathFromAmdModule } from 'vs/base/common/amd'; -function ignore(code: string, value: T = null): (err: any) => TPromise { +function ignore(code: string, value: T | null = null): (err: any) => TPromise { return err => err.code === code ? TPromise.as(value) : TPromise.wrapError(err); } -let _source: string = null; +let _source: string | null = null; function getSource(): string { if (!_source) { const root = getPathFromAmdModule(require, ''); diff --git a/src/vs/workbench/parts/codeEditor/electron-browser/languageConfiguration/languageConfigurationExtensionPoint.ts b/src/vs/workbench/parts/codeEditor/electron-browser/languageConfiguration/languageConfigurationExtensionPoint.ts index 68752105ad6..686fa84efff 100644 --- a/src/vs/workbench/parts/codeEditor/electron-browser/languageConfiguration/languageConfigurationExtensionPoint.ts +++ b/src/vs/workbench/parts/codeEditor/electron-browser/languageConfiguration/languageConfigurationExtensionPoint.ts @@ -111,7 +111,7 @@ export class LanguageConfigurationFileHandler { return null; } - let result: CommentRule = null; + let result: CommentRule | null = null; if (typeof source.lineComment !== 'undefined') { if (typeof source.lineComment !== 'string') { console.warn(`[${languageIdentifier.language}]: language configuration: expected \`comments.lineComment\` to be a string.`); diff --git a/src/vs/workbench/parts/codeEditor/electron-browser/textMate/inspectTMScopes.ts b/src/vs/workbench/parts/codeEditor/electron-browser/textMate/inspectTMScopes.ts index ca4b63610d1..73ecf12bb06 100644 --- a/src/vs/workbench/parts/codeEditor/electron-browser/textMate/inspectTMScopes.ts +++ b/src/vs/workbench/parts/codeEditor/electron-browser/textMate/inspectTMScopes.ts @@ -349,7 +349,7 @@ class InspectTMScopesWidget extends Disposable implements IContentWidget { } private _getStateBeforeLine(grammar: IGrammar, lineNumber: number): StackElement { - let state: StackElement = null; + let state: StackElement | null = null; for (let i = 1; i < lineNumber; i++) { let tokenizationResult = grammar.tokenizeLine(this._model.getLineContent(i), state); diff --git a/src/vs/workbench/parts/comments/electron-browser/commentThreadWidget.ts b/src/vs/workbench/parts/comments/electron-browser/commentThreadWidget.ts index 0ac0bd5b3e1..ad58f7bb531 100644 --- a/src/vs/workbench/parts/comments/electron-browser/commentThreadWidget.ts +++ b/src/vs/workbench/parts/comments/electron-browser/commentThreadWidget.ts @@ -206,7 +206,7 @@ export class ReviewZoneWidget extends ZoneWidget { this._commentsElement.removeChild(commentElementsToDel[i].domNode); } - let lastCommentElement: HTMLElement = null; + let lastCommentElement: HTMLElement | null = null; let newCommentNodeList: CommentNode[] = []; for (let i = newCommentsLen - 1; i >= 0; i--) { let currentComment = commentThread.comments[i]; diff --git a/src/vs/workbench/parts/debug/browser/linkDetector.ts b/src/vs/workbench/parts/debug/browser/linkDetector.ts index 8846aa76a91..dee02d38435 100644 --- a/src/vs/workbench/parts/debug/browser/linkDetector.ts +++ b/src/vs/workbench/parts/debug/browser/linkDetector.ts @@ -46,7 +46,7 @@ export class LinkDetector { let match = pattern.exec(text); while (match !== null) { - let resource: uri = null; + let resource: uri | null = null; if (!resource) { match = pattern.exec(text); continue; diff --git a/src/vs/workbench/parts/debug/common/debugModel.ts b/src/vs/workbench/parts/debug/common/debugModel.ts index 05a7062960a..0c5cdfc04b2 100644 --- a/src/vs/workbench/parts/debug/common/debugModel.ts +++ b/src/vs/workbench/parts/debug/common/debugModel.ts @@ -271,7 +271,7 @@ export class Variable extends ExpressionContainer implements IExpression { namedVariables: number, indexedVariables: number, public presentationHint: DebugProtocol.VariablePresentationHint, - public type: string = null, + public type: string | null = null, public available = true, startOfVariables = 0 ) { @@ -1025,7 +1025,7 @@ export class DebugModel implements IDebugModel { } } - public removeWatchExpressions(id: string = null): void { + public removeWatchExpressions(id: string | null = null): void { this.watchExpressions = id ? this.watchExpressions.filter(we => we.getId() !== id) : []; this._onDidChangeWatchExpressions.fire(); } diff --git a/src/vs/workbench/parts/debug/electron-browser/replViewer.ts b/src/vs/workbench/parts/debug/electron-browser/replViewer.ts index 82bf8989a13..b4baba1d40d 100644 --- a/src/vs/workbench/parts/debug/electron-browser/replViewer.ts +++ b/src/vs/workbench/parts/debug/electron-browser/replViewer.ts @@ -351,7 +351,7 @@ export class ReplExpressionsActionProvider implements IActionProvider { export class ReplExpressionsController extends BaseDebugController { - private lastSelectedString: string = null; + private lastSelectedString: string | null = null; public toFocusOnClick: { focus(): void }; protected onLeftClick(tree: ITree, element: any, eventish: ICancelableEvent, origin: string = 'mouse'): boolean { diff --git a/src/vs/workbench/parts/debug/node/terminals.ts b/src/vs/workbench/parts/debug/node/terminals.ts index a2251d524f9..854e25cbb5d 100644 --- a/src/vs/workbench/parts/debug/node/terminals.ts +++ b/src/vs/workbench/parts/debug/node/terminals.ts @@ -58,7 +58,7 @@ export function getDefaultTerminalLinuxReady(): TPromise { return _DEFAULT_TERMINAL_LINUX_READY; } -let _DEFAULT_TERMINAL_WINDOWS: string = null; +let _DEFAULT_TERMINAL_WINDOWS: string | null = null; export function getDefaultTerminalWindows(): string { if (!_DEFAULT_TERMINAL_WINDOWS) { const isWoW64 = !!process.env.hasOwnProperty('PROCESSOR_ARCHITEW6432'); diff --git a/src/vs/workbench/parts/emmet/electron-browser/emmetActions.ts b/src/vs/workbench/parts/emmet/electron-browser/emmetActions.ts index 3154bcd46a3..b1a2371edca 100644 --- a/src/vs/workbench/parts/emmet/electron-browser/emmetActions.ts +++ b/src/vs/workbench/parts/emmet/electron-browser/emmetActions.ts @@ -26,7 +26,7 @@ export interface ILanguageIdentifierResolver { class GrammarContributions implements IGrammarContributions { - private static _grammars: ModeScopeMap = null; + private static _grammars: ModeScopeMap | null = null; constructor(contributions: ExtensionPointContribution[]) { if (GrammarContributions._grammars === null) { @@ -66,7 +66,7 @@ export abstract class EmmetEditorAction extends EditorAction { private static readonly emmetSupportedModes = ['html', 'css', 'xml', 'xsl', 'haml', 'jade', 'jsx', 'slim', 'scss', 'sass', 'less', 'stylus', 'styl', 'svg']; private _lastGrammarContributions: TPromise = null; - private _lastExtensionService: IExtensionService = null; + private _lastExtensionService: IExtensionService | null = null; private _withGrammarContributions(extensionService: IExtensionService): TPromise { if (this._lastExtensionService !== extensionService) { this._lastExtensionService = extensionService; diff --git a/src/vs/workbench/parts/execution/electron-browser/terminal.ts b/src/vs/workbench/parts/execution/electron-browser/terminal.ts index fa103a8e2e9..a1dd21b7260 100644 --- a/src/vs/workbench/parts/execution/electron-browser/terminal.ts +++ b/src/vs/workbench/parts/execution/electron-browser/terminal.ts @@ -37,7 +37,7 @@ export function getDefaultTerminalLinuxReady(): Promise { export const DEFAULT_TERMINAL_OSX = 'Terminal.app'; -let _DEFAULT_TERMINAL_WINDOWS: string = null; +let _DEFAULT_TERMINAL_WINDOWS: string | null = null; export function getDefaultTerminalWindows(): string { if (!_DEFAULT_TERMINAL_WINDOWS) { const isWoW64 = !!process.env.hasOwnProperty('PROCESSOR_ARCHITEW6432'); diff --git a/src/vs/workbench/parts/extensions/electron-browser/extensionEditor.ts b/src/vs/workbench/parts/extensions/electron-browser/extensionEditor.ts index 10dfe395d9b..13682840aa1 100644 --- a/src/vs/workbench/parts/extensions/electron-browser/extensionEditor.ts +++ b/src/vs/workbench/parts/extensions/electron-browser/extensionEditor.ts @@ -81,7 +81,7 @@ class NavBar { private _onChange = new Emitter<{ id: string, focus: boolean }>(); get onChange(): Event<{ id: string, focus: boolean }> { return this._onChange.event; } - private currentId: string = null; + private currentId: string | null = null; private actions: Action[]; private actionbar: ActionBar; diff --git a/src/vs/workbench/parts/extensions/electron-browser/runtimeExtensionsEditor.ts b/src/vs/workbench/parts/extensions/electron-browser/runtimeExtensionsEditor.ts index b01c89c21be..b55336a29d8 100644 --- a/src/vs/workbench/parts/extensions/electron-browser/runtimeExtensionsEditor.ts +++ b/src/vs/workbench/parts/extensions/electron-browser/runtimeExtensionsEditor.ts @@ -186,7 +186,7 @@ export class RuntimeExtensionsEditor extends BaseEditor { for (let i = 0, len = this._extensionsDescriptions.length; i < len; i++) { const extensionDescription = this._extensionsDescriptions[i]; - let profileInfo: IExtensionProfileInformation = null; + let profileInfo: IExtensionProfileInformation | null = null; if (this._profileInfo) { let extensionSegments = segments[extensionDescription.id] || []; let extensionTotalTime = 0; diff --git a/src/vs/workbench/parts/extensions/node/extensionsWorkbenchService.ts b/src/vs/workbench/parts/extensions/node/extensionsWorkbenchService.ts index d110ac2fafc..f193cab0c8d 100644 --- a/src/vs/workbench/parts/extensions/node/extensionsWorkbenchService.ts +++ b/src/vs/workbench/parts/extensions/node/extensionsWorkbenchService.ts @@ -313,9 +313,9 @@ ${this.description} class ExtensionDependencies implements IExtensionDependencies { - private _hasDependencies: boolean = null; + private _hasDependencies: boolean | null = null; - constructor(private _extension: IExtension, private _identifier: string, private _map: Map, private _dependent: IExtensionDependencies = null) { } + constructor(private _extension: IExtension, private _identifier: string, private _map: Map, private _dependent: IExtensionDependencies | null = null) { } get hasDependencies(): boolean { if (this._hasDependencies === null) { diff --git a/src/vs/workbench/parts/markers/electron-browser/markersModel.ts b/src/vs/workbench/parts/markers/electron-browser/markersModel.ts index 0ff5bbf3759..62ee4c1e7fc 100644 --- a/src/vs/workbench/parts/markers/electron-browser/markersModel.ts +++ b/src/vs/workbench/parts/markers/electron-browser/markersModel.ts @@ -35,8 +35,8 @@ export abstract class NodeWithId { export class ResourceMarkers extends NodeWithId { - private _name: string = null; - private _path: string = null; + private _name: string | null = null; + private _path: string | null = null; private _allFixesPromise: Promise; markers: Marker[] = []; diff --git a/src/vs/workbench/parts/markers/electron-browser/markersPanel.ts b/src/vs/workbench/parts/markers/electron-browser/markersPanel.ts index 0206943dcab..af06d7e88b5 100644 --- a/src/vs/workbench/parts/markers/electron-browser/markersPanel.ts +++ b/src/vs/workbench/parts/markers/electron-browser/markersPanel.ts @@ -40,7 +40,7 @@ export class MarkersPanel extends Panel { private delayedRefresh: Delayer; private lastSelectedRelativeTop: number = 0; - private currentActiveResource: URI = null; + private currentActiveResource: URI | null = null; private tree: WorkbenchTree; private rangeHighlightDecorations: RangeHighlightDecorations; @@ -403,7 +403,7 @@ export class MarkersPanel extends Panel { } private getResourceForCurrentActiveResource(): ResourceMarkers { - let res: ResourceMarkers = null; + let res: ResourceMarkers | null = null; if (this.currentActiveResource) { this.markersWorkbenchService.markersModel.forEachFilteredResource(resource => { if (!res && resource.uri.toString() === this.currentActiveResource.toString()) { diff --git a/src/vs/workbench/parts/output/electron-browser/outputServices.ts b/src/vs/workbench/parts/output/electron-browser/outputServices.ts index b80224bd040..5df181c452a 100644 --- a/src/vs/workbench/parts/output/electron-browser/outputServices.ts +++ b/src/vs/workbench/parts/output/electron-browser/outputServices.ts @@ -681,7 +681,7 @@ class BufferredOutputChannel extends Disposable implements OutputChannel { readonly id: string; readonly label: string; - readonly file: URI = null; + readonly file: URI | null = null; scrollLock: boolean = false; protected _onDidAppendedContent: Emitter = new Emitter(); diff --git a/src/vs/workbench/parts/preferences/browser/keybindingWidgets.ts b/src/vs/workbench/parts/preferences/browser/keybindingWidgets.ts index 3e56b8ec671..08ba1f42e27 100644 --- a/src/vs/workbench/parts/preferences/browser/keybindingWidgets.ts +++ b/src/vs/workbench/parts/preferences/browser/keybindingWidgets.ts @@ -150,8 +150,8 @@ export class DefineKeybindingWidget extends Widget { private _outputNode: HTMLElement; private _showExistingKeybindingsNode: HTMLElement; - private _firstPart: ResolvedKeybinding = null; - private _chordPart: ResolvedKeybinding = null; + private _firstPart: ResolvedKeybinding | null = null; + private _chordPart: ResolvedKeybinding | null = null; private _isVisible: boolean = false; private _onHide = this._register(new Emitter()); diff --git a/src/vs/workbench/parts/preferences/browser/keybindingsEditorContribution.ts b/src/vs/workbench/parts/preferences/browser/keybindingsEditorContribution.ts index c00c6b10b51..5e27756c8a8 100644 --- a/src/vs/workbench/parts/preferences/browser/keybindingsEditorContribution.ts +++ b/src/vs/workbench/parts/preferences/browser/keybindingsEditorContribution.ts @@ -233,7 +233,7 @@ export class KeybindingEditorDecorationsRenderer extends Disposable { return this._createDecoration(true, null, null, model, value); } const resolvedKeybinding = resolvedKeybindings[0]; - let usLabel: string = null; + let usLabel: string | null = null; if (resolvedKeybinding instanceof WindowsNativeResolvedKeybinding) { usLabel = resolvedKeybinding.getUSLabel(); } diff --git a/src/vs/workbench/parts/quickopen/browser/gotoLineHandler.ts b/src/vs/workbench/parts/quickopen/browser/gotoLineHandler.ts index 4a5c49617c3..a2e4eccb86a 100644 --- a/src/vs/workbench/parts/quickopen/browser/gotoLineHandler.ts +++ b/src/vs/workbench/parts/quickopen/browser/gotoLineHandler.ts @@ -44,7 +44,7 @@ export class GotoLineAction extends QuickOpenAction { if (isDiffEditor(activeTextEditorWidget)) { activeTextEditorWidget = activeTextEditorWidget.getModifiedEditor(); } - let restoreOptions: IEditorOptions = null; + let restoreOptions: IEditorOptions | null = null; if (isCodeEditor(activeTextEditorWidget)) { const config = activeTextEditorWidget.getConfiguration(); diff --git a/src/vs/workbench/parts/quickopen/browser/gotoSymbolHandler.ts b/src/vs/workbench/parts/quickopen/browser/gotoSymbolHandler.ts index edb54a680cf..eb66494ac57 100644 --- a/src/vs/workbench/parts/quickopen/browser/gotoSymbolHandler.ts +++ b/src/vs/workbench/parts/quickopen/browser/gotoSymbolHandler.ts @@ -117,8 +117,8 @@ class OutlineModel extends QuickOpenModel { // Mark all type groups const visibleResults = this.getEntries(true); if (visibleResults.length > 0 && searchValue.indexOf(SCOPE_PREFIX) === 0) { - let currentType: SymbolKind = null; - let currentResult: SymbolEntry = null; + let currentType: SymbolKind | null = null; + let currentResult: SymbolEntry | null = null; let typeCounter = 0; for (let i = 0; i < visibleResults.length; i++) { diff --git a/src/vs/workbench/parts/search/browser/openAnythingHandler.ts b/src/vs/workbench/parts/search/browser/openAnythingHandler.ts index cb8aae32fb5..a7c98574b4c 100644 --- a/src/vs/workbench/parts/search/browser/openAnythingHandler.ts +++ b/src/vs/workbench/parts/search/browser/openAnythingHandler.ts @@ -168,7 +168,7 @@ export class OpenAnythingHandler extends QuickOpenHandler { return null; } - let range: IRange = null; + let range: IRange | null = null; // Find Line/Column number from search value using RegExp const patternMatch = OpenAnythingHandler.LINE_COLON_PATTERN.exec(value); diff --git a/src/vs/workbench/parts/search/browser/replaceService.ts b/src/vs/workbench/parts/search/browser/replaceService.ts index 975d8f3f1e1..92aa7ab0116 100644 --- a/src/vs/workbench/parts/search/browser/replaceService.ts +++ b/src/vs/workbench/parts/search/browser/replaceService.ts @@ -104,7 +104,7 @@ export class ReplaceService implements IReplaceService { public replace(match: Match): TPromise; public replace(files: FileMatch[], progress?: IProgressRunner): TPromise; public replace(match: FileMatchOrMatch, progress?: IProgressRunner, resource?: URI): TPromise; - public replace(arg: any, progress: IProgressRunner = null, resource: URI = null): TPromise { + public replace(arg: any, progress: IProgressRunner | null = null, resource: URI | null = null): TPromise { const edits: ResourceTextEdit[] = this.createEdits(arg, resource); return this.bulkEditorService.apply({ edits }, { progress }).then(() => this.textFileService.saveAll(edits.map(e => e.resource))); @@ -174,7 +174,7 @@ export class ReplaceService implements IReplaceService { replaceModel.pushEditOperations([], mergeSort(modelEdits, (a, b) => Range.compareRangesUsingStarts(a.range, b.range)), () => []); } - private createEdits(arg: FileMatchOrMatch | FileMatch[], resource: URI = null): ResourceTextEdit[] { + private createEdits(arg: FileMatchOrMatch | FileMatch[], resource: URI | null = null): ResourceTextEdit[] { const edits: ResourceTextEdit[] = []; if (arg instanceof Match) { @@ -198,7 +198,7 @@ export class ReplaceService implements IReplaceService { return edits; } - private createEdit(match: Match, text: string, resource: URI = null): ResourceTextEdit { + private createEdit(match: Match, text: string, resource: URI | null = null): ResourceTextEdit { let fileMatch: FileMatch = match.parent(); let resourceEdit: ResourceTextEdit = { resource: resource !== null ? resource : fileMatch.resource(), diff --git a/src/vs/workbench/parts/search/browser/searchView.ts b/src/vs/workbench/parts/search/browser/searchView.ts index ff9a4ae1e7f..e5e56b1b987 100644 --- a/src/vs/workbench/parts/search/browser/searchView.ts +++ b/src/vs/workbench/parts/search/browser/searchView.ts @@ -1438,7 +1438,7 @@ export class SearchView extends Viewlet implements IViewlet, IPanel { } private getSelectionFrom(element: FileMatchOrMatch): any { - let match: Match = null; + let match: Match | null = null; if (element instanceof Match) { match = element; } diff --git a/src/vs/workbench/parts/search/browser/searchWidget.ts b/src/vs/workbench/parts/search/browser/searchWidget.ts index 031b0d44d2d..b56f1a72fae 100644 --- a/src/vs/workbench/parts/search/browser/searchWidget.ts +++ b/src/vs/workbench/parts/search/browser/searchWidget.ts @@ -47,7 +47,7 @@ export interface ISearchWidgetOptions { class ReplaceAllAction extends Action { - private static fgInstance: ReplaceAllAction = null; + private static fgInstance: ReplaceAllAction | null = null; public static readonly ID: string = 'search.action.replaceAll'; static get INSTANCE(): ReplaceAllAction { @@ -57,7 +57,7 @@ class ReplaceAllAction extends Action { return ReplaceAllAction.fgInstance; } - private _searchWidget: SearchWidget = null; + private _searchWidget: SearchWidget | null = null; constructor() { super(ReplaceAllAction.ID, '', 'action-replace-all', false); diff --git a/src/vs/workbench/parts/search/common/searchModel.ts b/src/vs/workbench/parts/search/common/searchModel.ts index 8e5fc8a4805..306759ab096 100644 --- a/src/vs/workbench/parts/search/common/searchModel.ts +++ b/src/vs/workbench/parts/search/common/searchModel.ts @@ -682,7 +682,7 @@ export class SearchResult extends Disposable { return; } this._showHighlights = value; - let selectedMatch: Match = null; + let selectedMatch: Match | null = null; this.matches().forEach((fileMatch: FileMatch) => { fileMatch.updateHighlights(); if (!selectedMatch) { @@ -736,10 +736,10 @@ export class SearchResult extends Disposable { export class SearchModel extends Disposable { private _searchResult: SearchResult; - private _searchQuery: ISearchQuery = null; + private _searchQuery: ISearchQuery | null = null; private _replaceActive: boolean = false; - private _replaceString: string = null; - private _replacePattern: ReplacePattern = null; + private _replaceString: string | null = null; + private _replacePattern: ReplacePattern | null = null; private readonly _onReplaceTermChanged: Emitter = this._register(new Emitter()); public readonly onReplaceTermChanged: Event = this._onReplaceTermChanged.event; @@ -925,8 +925,8 @@ export interface ISearchWorkbenchService { */ export class RangeHighlightDecorations implements IDisposable { - private _decorationId: string = null; - private _model: ITextModel = null; + private _decorationId: string | null = null; + private _model: ITextModel | null = null; private _modelDisposables: IDisposable[] = []; constructor( diff --git a/src/vs/workbench/parts/search/test/common/searchModel.test.ts b/src/vs/workbench/parts/search/test/common/searchModel.test.ts index 5edf921fd3a..c54dad1e84f 100644 --- a/src/vs/workbench/parts/search/test/common/searchModel.test.ts +++ b/src/vs/workbench/parts/search/test/common/searchModel.test.ts @@ -80,7 +80,7 @@ suite('SearchModel', () => { }); }); - function searchServiceWithResults(results: IFileMatch[], complete: ISearchComplete = null): ISearchService { + function searchServiceWithResults(results: IFileMatch[], complete: ISearchComplete | null = null): ISearchService { return { search(query: ISearchQuery, token?: CancellationToken, onProgress?: (result: ISearchProgressItem) => void): TPromise { return new TPromise(resolve => { diff --git a/src/vs/workbench/parts/tasks/common/problemCollectors.ts b/src/vs/workbench/parts/tasks/common/problemCollectors.ts index 1a65b43db20..98c2c309454 100644 --- a/src/vs/workbench/parts/tasks/common/problemCollectors.ts +++ b/src/vs/workbench/parts/tasks/common/problemCollectors.ts @@ -116,7 +116,7 @@ export class AbstractProblemCollector implements IDisposable { } protected tryFindMarker(line: string): ProblemMatch { - let result: ProblemMatch = null; + let result: ProblemMatch | null = null; if (this.activeMatcher) { result = this.activeMatcher.next(line); if (result) { diff --git a/src/vs/workbench/parts/tasks/common/problemMatcher.ts b/src/vs/workbench/parts/tasks/common/problemMatcher.ts index 1e4a347bbd7..7e2c1ef978a 100644 --- a/src/vs/workbench/parts/tasks/common/problemMatcher.ts +++ b/src/vs/workbench/parts/tasks/common/problemMatcher.ts @@ -349,7 +349,7 @@ abstract class AbstractLineMatcher implements ILineMatcher { } private getSeverity(data: ProblemData): MarkerSeverity { - let result: Severity = null; + let result: Severity | null = null; if (data.severity) { let value = data.severity; if (value) { @@ -893,7 +893,7 @@ export class ProblemPatternParser extends Parser { } private createRegularExpression(value: string): RegExp { - let result: RegExp = null; + let result: RegExp | null = null; if (!value) { return result; } @@ -1256,7 +1256,7 @@ export class ProblemMatcherParser extends Parser { } private createProblemMatcher(description: Config.ProblemMatcher): ProblemMatcher { - let result: ProblemMatcher = null; + let result: ProblemMatcher | null = null; let owner = description.owner ? description.owner : UUID.generateUuid(); let source = Types.isString(description.source) ? description.source : undefined; @@ -1428,7 +1428,7 @@ export class ProblemMatcherParser extends Parser { } private createRegularExpression(value: string): RegExp { - let result: RegExp = null; + let result: RegExp | null = null; if (!value) { return result; } diff --git a/src/vs/workbench/parts/terminal/node/terminal.ts b/src/vs/workbench/parts/terminal/node/terminal.ts index a45a93547b2..6b05bdc2b04 100644 --- a/src/vs/workbench/parts/terminal/node/terminal.ts +++ b/src/vs/workbench/parts/terminal/node/terminal.ts @@ -45,7 +45,7 @@ export function getDefaultShell(p: platform.Platform): string { return getTerminalDefaultShellUnixLike(); } -let _TERMINAL_DEFAULT_SHELL_UNIX_LIKE: string = null; +let _TERMINAL_DEFAULT_SHELL_UNIX_LIKE: string | null = null; function getTerminalDefaultShellUnixLike(): string { if (!_TERMINAL_DEFAULT_SHELL_UNIX_LIKE) { let unixLikeTerminal = 'sh'; @@ -61,7 +61,7 @@ function getTerminalDefaultShellUnixLike(): string { return _TERMINAL_DEFAULT_SHELL_UNIX_LIKE; } -let _TERMINAL_DEFAULT_SHELL_WINDOWS: string = null; +let _TERMINAL_DEFAULT_SHELL_WINDOWS: string | null = null; function getTerminalDefaultShellWindows(): string { if (!_TERMINAL_DEFAULT_SHELL_WINDOWS) { const isAtLeastWindows10 = platform.isWindows && parseFloat(os.release()) >= 10; diff --git a/src/vs/workbench/parts/themes/test/electron-browser/themes.test.contribution.ts b/src/vs/workbench/parts/themes/test/electron-browser/themes.test.contribution.ts index 80bd3118690..8ac211ef77d 100644 --- a/src/vs/workbench/parts/themes/test/electron-browser/themes.test.contribution.ts +++ b/src/vs/workbench/parts/themes/test/electron-browser/themes.test.contribution.ts @@ -95,7 +95,7 @@ class Snapper { private _themedTokenize(grammar: IGrammar, lines: string[]): IThemedToken[] { let colorMap = TokenizationRegistry.getColorMap(); - let state: StackElement = null; + let state: StackElement | null = null; let result: IThemedToken[] = [], resultLen = 0; for (let i = 0, len = lines.length; i < len; i++) { let line = lines[i]; @@ -123,13 +123,13 @@ class Snapper { } private _tokenize(grammar: IGrammar, lines: string[]): IToken[] { - let state: StackElement = null; + let state: StackElement | null = null; let result: IToken[] = [], resultLen = 0; for (let i = 0, len = lines.length; i < len; i++) { let line = lines[i]; let tokenizationResult = grammar.tokenizeLine(line, state); - let lastScopes: string = null; + let lastScopes: string | null = null; for (let j = 0, lenJ = tokenizationResult.tokens.length; j < lenJ; j++) { let token = tokenizationResult.tokens[j]; diff --git a/src/vs/workbench/parts/welcome/gettingStarted/test/common/gettingStarted.test.ts b/src/vs/workbench/parts/welcome/gettingStarted/test/common/gettingStarted.test.ts index 51502da8bf7..74aabc4cbaf 100644 --- a/src/vs/workbench/parts/welcome/gettingStarted/test/common/gettingStarted.test.ts +++ b/src/vs/workbench/parts/welcome/gettingStarted/test/common/gettingStarted.test.ts @@ -8,11 +8,11 @@ import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace import { IStorageService } from 'vs/platform/storage/common/storage'; suite('Workbench - GettingStarted', () => { - let instantiation: TestInstantiationService = null; - let welcomePageEnvConfig: string = null; - let hideWelcomeSettingsValue: string = null; - // let machineId: string = null; - let appName: string = null; + let instantiation: TestInstantiationService | null = null; + let welcomePageEnvConfig: string | null = null; + let hideWelcomeSettingsValue: string | null = null; + // let machineId: string | null = null; + let appName: string | null = null; suiteSetup(() => { instantiation = new TestInstantiationService(); diff --git a/src/vs/workbench/services/configuration/common/configurationModels.ts b/src/vs/workbench/services/configuration/common/configurationModels.ts index b6cc66f1dd4..f5fbcc43d26 100644 --- a/src/vs/workbench/services/configuration/common/configurationModels.ts +++ b/src/vs/workbench/services/configuration/common/configurationModels.ts @@ -225,7 +225,7 @@ export class Configuration extends BaseConfiguration { export class AllKeysConfigurationChangeEvent extends AbstractConfigurationChangeEvent implements IConfigurationChangeEvent { - private _changedConfiguration: ConfigurationModel = null; + private _changedConfiguration: ConfigurationModel | null = null; constructor(private _configuration: Configuration, readonly source: ConfigurationTarget, readonly sourceConfig: any) { super(); } diff --git a/src/vs/workbench/services/extensions/electron-browser/extensionService.ts b/src/vs/workbench/services/extensions/electron-browser/extensionService.ts index 5275ed71337..7811fe39444 100644 --- a/src/vs/workbench/services/extensions/electron-browser/extensionService.ts +++ b/src/vs/workbench/services/extensions/electron-browser/extensionService.ts @@ -51,14 +51,14 @@ import { RuntimeExtensionsInput } from 'vs/workbench/services/extensions/electro const LOG_EXTENSION_HOST_COMMUNICATION = false; const LOG_USE_COLORS = true; -let _SystemExtensionsRoot: string = null; +let _SystemExtensionsRoot: string | null = null; function getSystemExtensionsRoot(): string { if (!_SystemExtensionsRoot) { _SystemExtensionsRoot = path.normalize(path.join(getPathFromAmdModule(require, ''), '..', 'extensions')); } return _SystemExtensionsRoot; } -let _ExtraDevSystemExtensionsRoot: string = null; +let _ExtraDevSystemExtensionsRoot: string | null = null; function getExtraDevSystemExtensionsRoot(): string { if (!_ExtraDevSystemExtensionsRoot) { _ExtraDevSystemExtensionsRoot = path.normalize(path.join(getPathFromAmdModule(require, ''), '..', '.build', 'builtInExtensions')); @@ -185,7 +185,7 @@ export class ExtensionHostProcessManager extends Disposable { private _createExtensionHostCustomers(protocol: IMessagePassingProtocol): ExtHostExtensionServiceShape { - let logger: IRPCProtocolLogger = null; + let logger: IRPCProtocolLogger | null = null; if (LOG_EXTENSION_HOST_COMMUNICATION || this._environmentService.logExtensionHostCommunication) { logger = new RPCLogger(); } diff --git a/src/vs/workbench/services/extensions/node/extensionPoints.ts b/src/vs/workbench/services/extensions/node/extensionPoints.ts index 9a0f2d2e135..dba83c817aa 100644 --- a/src/vs/workbench/services/extensions/node/extensionPoints.ts +++ b/src/vs/workbench/services/extensions/node/extensionPoints.ts @@ -527,7 +527,7 @@ export class ExtensionScanner { /** * Scan a list of extensions defined in `absoluteFolderPath` */ - public static async scanExtensions(input: ExtensionScannerInput, log: ILog, resolver: IExtensionResolver = null): Promise { + public static async scanExtensions(input: ExtensionScannerInput, log: ILog, resolver: IExtensionResolver | null = null): Promise { const absoluteFolderPath = input.absoluteFolderPath; const isBuiltin = input.isBuiltin; const isUnderDevelopment = input.isUnderDevelopment; diff --git a/src/vs/workbench/services/extensions/node/rpcProtocol.ts b/src/vs/workbench/services/extensions/node/rpcProtocol.ts index 92d1e2889dd..b30a0c6d638 100644 --- a/src/vs/workbench/services/extensions/node/rpcProtocol.ts +++ b/src/vs/workbench/services/extensions/node/rpcProtocol.ts @@ -124,7 +124,7 @@ export class RPCProtocol extends Disposable implements IRPCProtocol { private _unresponsiveTime: number; private _asyncCheckUresponsive: RunOnceScheduler; - constructor(protocol: IMessagePassingProtocol, logger: IRPCProtocolLogger = null, transformer: IURITransformer = null) { + constructor(protocol: IMessagePassingProtocol, logger: IRPCProtocolLogger | null = null, transformer: IURITransformer | null = null) { super(); this._protocol = protocol; this._logger = logger; @@ -409,7 +409,7 @@ export class RPCProtocol extends Disposable implements IRPCProtocol { const pendingReply = this._pendingRPCReplies[callId]; delete this._pendingRPCReplies[callId]; - let err: Error = null; + let err: Error | null = null; if (value && value.$isError) { err = new Error(); err.name = value.name; @@ -443,7 +443,7 @@ export class RPCProtocol extends Disposable implements IRPCProtocol { if (this._isDisposed) { return TPromise.wrapError(errors.canceled()); } - let cancellationToken: CancellationToken = null; + let cancellationToken: CancellationToken | null = null; if (args.length > 0 && CancellationToken.isCancellationToken(args[args.length - 1])) { cancellationToken = args.pop(); } diff --git a/src/vs/workbench/services/files/node/watcher/unix/chokidarWatcherService.ts b/src/vs/workbench/services/files/node/watcher/unix/chokidarWatcherService.ts index 3b0d1ea6095..4e907ad9d5d 100644 --- a/src/vs/workbench/services/files/node/watcher/unix/chokidarWatcherService.ts +++ b/src/vs/workbench/services/files/node/watcher/unix/chokidarWatcherService.ts @@ -311,7 +311,7 @@ function isIgnored(path: string, requests: ExtendedWatcherRequest[]): boolean { */ export function normalizeRoots(requests: IWatcherRequest[]): { [basePath: string]: IWatcherRequest[] } { requests = requests.sort((r1, r2) => r1.basePath.localeCompare(r2.basePath)); - let prevRequest: IWatcherRequest = null; + let prevRequest: IWatcherRequest | null = null; let result: { [basePath: string]: IWatcherRequest[] } = Object.create(null); for (let request of requests) { let basePath = request.basePath; diff --git a/src/vs/workbench/services/keybinding/test/keyboardMapperTestUtils.ts b/src/vs/workbench/services/keybinding/test/keyboardMapperTestUtils.ts index 82f4de6f644..c1a812bf381 100644 --- a/src/vs/workbench/services/keybinding/test/keyboardMapperTestUtils.ts +++ b/src/vs/workbench/services/keybinding/test/keyboardMapperTestUtils.ts @@ -53,7 +53,7 @@ export function readRawMapping(file: string): TPromise { return readFile(getPathFromAmdModule(require, `vs/workbench/services/keybinding/test/${file}.js`)).then((buff) => { let contents = buff.toString(); let func = new Function('define', contents); - let rawMappings: T = null; + let rawMappings: T | null = null; func(function (value: T) { rawMappings = value; }); diff --git a/src/vs/workbench/services/preferences/browser/preferencesService.ts b/src/vs/workbench/services/preferences/browser/preferencesService.ts index fc708c03923..3cb58c9e65d 100644 --- a/src/vs/workbench/services/preferences/browser/preferencesService.ts +++ b/src/vs/workbench/services/preferences/browser/preferencesService.ts @@ -44,7 +44,7 @@ export class PreferencesService extends Disposable implements IPreferencesServic _serviceBrand: any; - private lastOpenedSettingsInput: PreferencesEditorInput = null; + private lastOpenedSettingsInput: PreferencesEditorInput | null = null; private readonly _onDispose: Emitter = new Emitter(); diff --git a/src/vs/workbench/services/preferences/common/keybindingsEditorModel.ts b/src/vs/workbench/services/preferences/common/keybindingsEditorModel.ts index 00026d6716e..0f587976104 100644 --- a/src/vs/workbench/services/preferences/common/keybindingsEditorModel.ts +++ b/src/vs/workbench/services/preferences/common/keybindingsEditorModel.ts @@ -259,7 +259,7 @@ class KeybindingItemMatches { public readonly commandDefaultLabelMatches: IMatch[] = null; public readonly sourceMatches: IMatch[] = null; public readonly whenMatches: IMatch[] = null; - public readonly keybindingMatches: KeybindingMatches = null; + public readonly keybindingMatches: KeybindingMatches | null = null; constructor(private modifierLabels: ModifierLabels, keybindingItem: IKeybindingItem, searchValue: string, words: string[], keybindingWords: string[], completeMatch: boolean) { if (!completeMatch) { diff --git a/src/vs/workbench/services/preferences/common/preferencesModels.ts b/src/vs/workbench/services/preferences/common/preferencesModels.ts index 5ebf357c101..950371a1a7d 100644 --- a/src/vs/workbench/services/preferences/common/preferencesModels.ts +++ b/src/vs/workbench/services/preferences/common/preferencesModels.ts @@ -247,9 +247,9 @@ export class Settings2EditorModel extends AbstractSettingsModel implements ISett function parse(model: ITextModel, isSettingsProperty: (currentProperty: string, previousParents: string[]) => boolean): ISettingsGroup[] { const settings: ISetting[] = []; - let overrideSetting: ISetting = null; + let overrideSetting: ISetting | null = null; - let currentProperty: string = null; + let currentProperty: string | null = null; let currentParent: any = []; let previousParents: any[] = []; let settingsPropertyIndex: number = -1; @@ -910,7 +910,7 @@ class SettingsContentBuilder { private _pushGroup(group: ISettingsGroup): ISetting { const indent = ' '; - let lastSetting: ISetting = null; + let lastSetting: ISetting | null = null; let groupStart = this.lineCountWithOffset + 1; for (const section of group.sections) { if (section.title) { diff --git a/src/vs/workbench/services/search/node/worker/searchWorker.ts b/src/vs/workbench/services/search/node/worker/searchWorker.ts index 26eef593908..de39d2f6453 100644 --- a/src/vs/workbench/services/search/node/worker/searchWorker.ts +++ b/src/vs/workbench/services/search/node/worker/searchWorker.ts @@ -124,7 +124,7 @@ export class SearchWorkerEngine { } private searchInFile(absolutePath: string, contentPattern: RegExp, fileEncoding: string, maxResults?: number, previewOptions?: ITextSearchPreviewOptions): TPromise { - let fileMatch: FileMatch = null; + let fileMatch: FileMatch | null = null; let limitReached = false; let numMatches = 0; diff --git a/src/vs/workbench/services/textMate/electron-browser/TMHelper.ts b/src/vs/workbench/services/textMate/electron-browser/TMHelper.ts index f4d8f3463aa..92fddea536b 100644 --- a/src/vs/workbench/services/textMate/electron-browser/TMHelper.ts +++ b/src/vs/workbench/services/textMate/electron-browser/TMHelper.ts @@ -18,7 +18,7 @@ export function findMatchingThemeRule(theme: IColorTheme, scopes: string[], only } function findMatchingThemeRule2(theme: IColorTheme, scope: string, parentScopes: string[], onlyColorRules: boolean): ThemeRule { - let result: ThemeRule = null; + let result: ThemeRule | null = null; // Loop backwards, to ensure the last most specific rule wins for (let i = theme.tokenColors.length - 1; i >= 0; i--) { diff --git a/src/vs/workbench/services/themes/electron-browser/fileIconThemeData.ts b/src/vs/workbench/services/themes/electron-browser/fileIconThemeData.ts index 8c2223842fb..71404c276f3 100644 --- a/src/vs/workbench/services/themes/electron-browser/fileIconThemeData.ts +++ b/src/vs/workbench/services/themes/electron-browser/fileIconThemeData.ts @@ -58,7 +58,7 @@ export class FileIconThemeData implements IFileIconTheme { return themeData; } - private static _noIconTheme: FileIconThemeData = null; + private static _noIconTheme: FileIconThemeData | null = null; static noIconTheme(): FileIconThemeData { let themeData = FileIconThemeData._noIconTheme; diff --git a/src/vs/workbench/services/themes/electron-browser/workbenchThemeService.ts b/src/vs/workbench/services/themes/electron-browser/workbenchThemeService.ts index 496cc5a5285..a2f7c35d755 100644 --- a/src/vs/workbench/services/themes/electron-browser/workbenchThemeService.ts +++ b/src/vs/workbench/services/themes/electron-browser/workbenchThemeService.ts @@ -119,7 +119,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { // In order to avoid paint flashing for tokens, because // themes are loaded asynchronously, we need to initialize // a color theme document with good defaults until the theme is loaded - let themeData: ColorThemeData = null; + let themeData: ColorThemeData | null = null; let persistedThemeData = this.storageService.get(PERSISTED_THEME_STORAGE_KEY); if (persistedThemeData) { themeData = ColorThemeData.fromStorageData(persistedThemeData); @@ -133,7 +133,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { this.updateDynamicCSSRules(themeData); this.applyTheme(themeData, null, true); - let iconData: FileIconThemeData = null; + let iconData: FileIconThemeData | null = null; let persistedIconThemeData = this.storageService.get(PERSISTED_ICON_THEME_STORAGE_KEY); if (persistedIconThemeData) { iconData = FileIconThemeData.fromStorageData(persistedIconThemeData);