diff --git a/extensions/cpp/test/colorize-results/test_cc.json b/extensions/cpp/test/colorize-results/test_cc.json index 23f716798db..c96fc642474 100644 --- a/extensions/cpp/test/colorize-results/test_cc.json +++ b/extensions/cpp/test/colorize-results/test_cc.json @@ -37,7 +37,7 @@ "t": "source.cpp meta.conditional.preprocessor.cpp entity.name.function.preprocessor.cpp", "r": { "dark_plus": "entity.name.function: #DCDCAA", - "light_plus": "entity.name.function: #795codeE26", + "light_plus": "entity.name.function: #795E26", "dark_vs": "default: #D4D4D4", "light_vs": "default: #000000", "hc_black": "entity.name.function: #DCDCAA" diff --git a/src/vs/base/browser/ui/grid/gridview.ts b/src/vs/base/browser/ui/grid/gridview.ts index 497678cee41..1760b6f42a0 100644 --- a/src/vs/base/browser/ui/grid/gridview.ts +++ b/src/vs/base/browser/ui/grid/gridview.ts @@ -549,11 +549,11 @@ class LeafNode implements ISplitView, IDisposable { } } - setVisible(visible: boolean): void { + setVisible(visible: boolean, cachedVisibleSize?: number): void { if (visible) { this._cachedVisibleSize = undefined; } else { - this._cachedVisibleSize = this._size; + this._cachedVisibleSize = typeof cachedVisibleSize === 'number' ? cachedVisibleSize : this._size; } if (this.view.setVisible) { diff --git a/src/vs/base/browser/ui/splitview/splitview.ts b/src/vs/base/browser/ui/splitview/splitview.ts index 4baf9ff4023..179b888f95e 100644 --- a/src/vs/base/browser/ui/splitview/splitview.ts +++ b/src/vs/base/browser/ui/splitview/splitview.ts @@ -49,7 +49,7 @@ export interface IView { readonly priority?: LayoutPriority; readonly snap?: boolean; layout(size: number, orientation: Orientation): void; - setVisible?(visible: boolean): void; + setVisible?(visible: boolean, cachedVisibleSize?: number): void; } interface ISashEvent { @@ -79,7 +79,7 @@ abstract class ViewItem { return typeof this._cachedVisibleSize === 'undefined'; } - set visible(visible: boolean) { + setVisible(visible: boolean, size?: number): void { if (visible === this.visible) { return; } @@ -88,14 +88,14 @@ abstract class ViewItem { this.size = clamp(this._cachedVisibleSize!, this.viewMinimumSize, this.viewMaximumSize); this._cachedVisibleSize = undefined; } else { - this._cachedVisibleSize = this.size; + this._cachedVisibleSize = typeof size === 'number' ? size : this.size; this.size = 0; } dom.toggleClass(this.container, 'visible', visible); if (this.view.setVisible) { - this.view.setVisible(visible); + this.view.setVisible(visible, this._cachedVisibleSize); } } @@ -161,6 +161,7 @@ interface ISashItem { interface ISashDragSnapState { readonly index: number; readonly limitDelta: number; + readonly size: number; } interface ISashDragState { @@ -453,7 +454,7 @@ export class SplitView extends Disposable { } const viewItem = this.viewItems[index]; - viewItem.visible = visible; + viewItem.setVisible(visible); this.distributeEmptySpace(index); this.layoutViews(); @@ -552,7 +553,8 @@ export class SplitView extends Disposable { snapBefore = { index: snapBeforeIndex, - limitDelta: viewItem.visible ? minDelta - halfSize : minDelta + halfSize + limitDelta: viewItem.visible ? minDelta - halfSize : minDelta + halfSize, + size: viewItem.size }; } @@ -562,7 +564,8 @@ export class SplitView extends Disposable { snapAfter = { index: snapAfterIndex, - limitDelta: viewItem.visible ? maxDelta + halfSize : maxDelta - halfSize + limitDelta: viewItem.visible ? maxDelta + halfSize : maxDelta - halfSize, + size: viewItem.size }; } } @@ -740,14 +743,14 @@ export class SplitView extends Disposable { const snapView = this.viewItems[snapBefore.index]; const visible = delta >= snapBefore.limitDelta; snapped = visible !== snapView.visible; - snapView.visible = visible; + snapView.setVisible(visible, snapBefore.size); } if (!snapped && snapAfter) { const snapView = this.viewItems[snapAfter.index]; const visible = delta < snapAfter.limitDelta; snapped = visible !== snapView.visible; - snapView.visible = visible; + snapView.setVisible(visible, snapAfter.size); } if (snapped) { diff --git a/src/vs/editor/contrib/gotoError/gotoErrorWidget.ts b/src/vs/editor/contrib/gotoError/gotoErrorWidget.ts index 89f2f75d243..9da6b13042f 100644 --- a/src/vs/editor/contrib/gotoError/gotoErrorWidget.ts +++ b/src/vs/editor/contrib/gotoError/gotoErrorWidget.ts @@ -228,7 +228,7 @@ export class MarkerNavigationWidget extends PeekViewWidget { protected _fillHead(container: HTMLElement): void { super._fillHead(container); - this._actionbarWidget.push(this.actions, { label: false, icon: true }); + this._actionbarWidget!.push(this.actions, { label: false, icon: true }); } protected _fillTitleIcon(container: HTMLElement): void { diff --git a/src/vs/editor/contrib/referenceSearch/peekViewWidget.ts b/src/vs/editor/contrib/referenceSearch/peekViewWidget.ts index c40368e0311..4dd63cadd03 100644 --- a/src/vs/editor/contrib/referenceSearch/peekViewWidget.ts +++ b/src/vs/editor/contrib/referenceSearch/peekViewWidget.ts @@ -84,12 +84,12 @@ export abstract class PeekViewWidget extends ZoneWidget { private _onDidClose = new Emitter(); - protected _headElement: HTMLDivElement; - protected _primaryHeading: HTMLElement; - protected _secondaryHeading: HTMLElement; - protected _metaHeading: HTMLElement; - protected _actionbarWidget: ActionBar; - protected _bodyElement: HTMLDivElement; + protected _headElement?: HTMLDivElement; + protected _primaryHeading?: HTMLElement; + protected _secondaryHeading?: HTMLElement; + protected _metaHeading?: HTMLElement; + protected _actionbarWidget?: ActionBar; + protected _bodyElement?: HTMLDivElement; constructor(editor: ICodeEditor, options: IPeekViewOptions = {}) { super(editor, options); @@ -139,8 +139,8 @@ export abstract class PeekViewWidget extends ZoneWidget { protected _fillContainer(container: HTMLElement): void { this.setCssClass('peekview-widget'); - this._headElement = dom.$('.head'); - this._bodyElement = dom.$('.body'); + this._headElement = dom.$('.head'); + this._bodyElement = dom.$('.body'); this._fillHead(this._headElement); this._fillBody(this._bodyElement); @@ -151,7 +151,7 @@ export abstract class PeekViewWidget extends ZoneWidget { protected _fillHead(container: HTMLElement): void { const titleElement = dom.$('.peekview-title'); - dom.append(this._headElement, titleElement); + dom.append(this._headElement!, titleElement); dom.addStandardDisposableListener(titleElement, 'click', event => this._onTitleClick(event)); this._fillTitleIcon(titleElement); @@ -161,7 +161,7 @@ export abstract class PeekViewWidget extends ZoneWidget { dom.append(titleElement, this._primaryHeading, this._secondaryHeading, this._metaHeading); const actionsContainer = dom.$('.peekview-actions'); - dom.append(this._headElement, actionsContainer); + dom.append(this._headElement!, actionsContainer); const actionBarOptions = this._getActionBarOptions(); this._actionbarWidget = new ActionBar(actionsContainer, actionBarOptions); @@ -185,20 +185,24 @@ export abstract class PeekViewWidget extends ZoneWidget { } public setTitle(primaryHeading: string, secondaryHeading?: string): void { - this._primaryHeading.innerHTML = strings.escape(primaryHeading); - this._primaryHeading.setAttribute('aria-label', primaryHeading); - if (secondaryHeading) { - this._secondaryHeading.innerHTML = strings.escape(secondaryHeading); - } else { - dom.clearNode(this._secondaryHeading); + if (this._primaryHeading && this._secondaryHeading) { + this._primaryHeading.innerHTML = strings.escape(primaryHeading); + this._primaryHeading.setAttribute('aria-label', primaryHeading); + if (secondaryHeading) { + this._secondaryHeading.innerHTML = strings.escape(secondaryHeading); + } else { + dom.clearNode(this._secondaryHeading); + } } } public setMetaTitle(value: string): void { - if (value) { - this._metaHeading.innerHTML = strings.escape(value); - } else { - dom.clearNode(this._metaHeading); + if (this._metaHeading) { + if (value) { + this._metaHeading.innerHTML = strings.escape(value); + } else { + dom.clearNode(this._metaHeading); + } } } @@ -220,11 +224,15 @@ export abstract class PeekViewWidget extends ZoneWidget { } protected _doLayoutHead(heightInPixel: number, widthInPixel: number): void { - this._headElement.style.height = `${heightInPixel}px`; - this._headElement.style.lineHeight = this._headElement.style.height; + if (this._headElement) { + this._headElement.style.height = `${heightInPixel}px`; + this._headElement.style.lineHeight = this._headElement.style.height; + } } protected _doLayoutBody(heightInPixel: number, widthInPixel: number): void { - this._bodyElement.style.height = `${heightInPixel}px`; + if (this._bodyElement) { + this._bodyElement.style.height = `${heightInPixel}px`; + } } } diff --git a/src/vs/platform/progress/common/progress.ts b/src/vs/platform/progress/common/progress.ts index 117e1af70de..4308c72ce89 100644 --- a/src/vs/platform/progress/common/progress.ts +++ b/src/vs/platform/progress/common/progress.ts @@ -90,13 +90,13 @@ export interface IProgress { export class Progress implements IProgress { private _callback: (data: T) => void; - private _value: T; + private _value?: T; constructor(callback: (data: T) => void) { this._callback = callback; } - get value() { + get value(): T | undefined { return this._value; } diff --git a/src/vs/vscode.d.ts b/src/vs/vscode.d.ts index 25271cbcf99..38ff2ab34d1 100644 --- a/src/vs/vscode.d.ts +++ b/src/vs/vscode.d.ts @@ -2786,7 +2786,7 @@ declare module 'vscode' { * *Note* that the eol-sequence will be applied to the * whole document. */ - newEol: EndOfLine; + newEol?: EndOfLine; /** * Create a new TextEdit. diff --git a/src/vs/workbench/api/common/extHostDocumentSaveParticipant.ts b/src/vs/workbench/api/common/extHostDocumentSaveParticipant.ts index ae129051fe8..f55a89b3f30 100644 --- a/src/vs/workbench/api/common/extHostDocumentSaveParticipant.ts +++ b/src/vs/workbench/api/common/extHostDocumentSaveParticipant.ts @@ -153,7 +153,7 @@ export class ExtHostDocumentSaveParticipant implements ExtHostDocumentSavePartic resourceEdit.edits.push({ range: range && Range.from(range), text: newText, - eol: EndOfLine.from(newEol) + eol: newEol && EndOfLine.from(newEol) }); } } diff --git a/src/vs/workbench/api/common/extHostTextEditor.ts b/src/vs/workbench/api/common/extHostTextEditor.ts index fa10d30014b..1e5404bbf2b 100644 --- a/src/vs/workbench/api/common/extHostTextEditor.ts +++ b/src/vs/workbench/api/common/extHostTextEditor.ts @@ -151,11 +151,11 @@ export class ExtHostTextEditorOptions implements vscode.TextEditorOptions { private _proxy: MainThreadTextEditorsShape; private _id: string; - private _tabSize: number; - private _indentSize: number; - private _insertSpaces: boolean; - private _cursorStyle: TextEditorCursorStyle; - private _lineNumbers: TextEditorLineNumbersStyle; + private _tabSize!: number; + private _indentSize!: number; + private _insertSpaces!: boolean; + private _cursorStyle!: TextEditorCursorStyle; + private _lineNumbers!: TextEditorLineNumbersStyle; constructor(proxy: MainThreadTextEditorsShape, id: string, source: IResolvedTextEditorConfiguration) { this._proxy = proxy; diff --git a/src/vs/workbench/api/common/extHostTypeConverters.ts b/src/vs/workbench/api/common/extHostTypeConverters.ts index 5da072a265e..f7827afe487 100644 --- a/src/vs/workbench/api/common/extHostTypeConverters.ts +++ b/src/vs/workbench/api/common/extHostTypeConverters.ts @@ -442,7 +442,7 @@ export namespace TextEdit { export function from(edit: vscode.TextEdit): modes.TextEdit { return { text: edit.newText, - eol: EndOfLine.from(edit.newEol), + eol: edit.newEol && EndOfLine.from(edit.newEol), range: Range.from(edit.range) }; } diff --git a/src/vs/workbench/api/common/extHostTypes.ts b/src/vs/workbench/api/common/extHostTypes.ts index 9ad1d38f66e..9b0cd9c9cc8 100644 --- a/src/vs/workbench/api/common/extHostTypes.ts +++ b/src/vs/workbench/api/common/extHostTypes.ts @@ -514,7 +514,7 @@ export class TextEdit { protected _range: Range; protected _newText: string | null; - protected _newEol: EndOfLine; + protected _newEol?: EndOfLine; get range(): Range { return this._range; @@ -538,11 +538,11 @@ export class TextEdit { this._newText = value; } - get newEol(): EndOfLine { + get newEol(): EndOfLine | undefined { return this._newEol; } - set newEol(value: EndOfLine) { + set newEol(value: EndOfLine | undefined) { if (value && typeof value !== 'number') { throw illegalArgument('newEol'); } @@ -550,7 +550,7 @@ export class TextEdit { } constructor(range: Range, newText: string | null) { - this.range = range; + this._range = range; this._newText = newText; } @@ -798,7 +798,7 @@ export class Location { } uri: URI; - range: Range; + range!: Range; constructor(uri: URI, rangeOrPosition: Range | Position) { this.uri = uri; @@ -861,10 +861,10 @@ export class Diagnostic { range: Range; message: string; - source: string; - code: string | number; severity: DiagnosticSeverity; - relatedInformation: DiagnosticRelatedInformation[]; + source?: string; + code?: string | number; + relatedInformation?: DiagnosticRelatedInformation[]; tags?: DiagnosticTag[]; constructor(range: Range, message: string, severity: DiagnosticSeverity = DiagnosticSeverity.Error) { @@ -989,7 +989,7 @@ export class SymbolInformation { } name: string; - location: Location; + location!: Location; kind: SymbolKind; containerName: string | undefined; @@ -1253,8 +1253,8 @@ export class SignatureInformation { export class SignatureHelp { signatures: SignatureInformation[]; - activeSignature: number; - activeParameter: number; + activeSignature: number = 0; + activeParameter: number = 0; constructor() { this.signatures = []; @@ -1310,19 +1310,19 @@ export enum CompletionItemKind { export class CompletionItem implements vscode.CompletionItem { label: string; - kind: CompletionItemKind | undefined; + kind?: CompletionItemKind; detail?: string; documentation?: string | MarkdownString; sortText?: string; filterText?: string; preselect?: boolean; - insertText: string | SnippetString; + insertText?: string | SnippetString; keepWhitespace?: boolean; - range: Range; + range?: Range; commitCharacters?: string[]; - textEdit: TextEdit; - additionalTextEdits: TextEdit[]; - command: vscode.Command; + textEdit?: TextEdit; + additionalTextEdits?: TextEdit[]; + command?: vscode.Command; constructor(label: string, kind?: CompletionItemKind) { this.label = label; diff --git a/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.ts b/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.ts index 3679e656809..1166da97f9c 100644 --- a/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.ts +++ b/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.ts @@ -386,7 +386,7 @@ export class CallHierarchyTreePeekWidget extends PeekViewWidget { }; this._changeDirectionAction = new ChangeHierarchyDirectionAction(this._direction, changeDirection); this._disposables.add(this._changeDirectionAction); - this._actionbarWidget.push(this._changeDirectionAction, { icon: true, label: false }); + this._actionbarWidget!.push(this._changeDirectionAction, { icon: true, label: false }); } } diff --git a/src/vs/workbench/contrib/scm/browser/dirtydiffDecorator.ts b/src/vs/workbench/contrib/scm/browser/dirtydiffDecorator.ts index 97539eb481f..955579069d7 100644 --- a/src/vs/workbench/contrib/scm/browser/dirtydiffDecorator.ts +++ b/src/vs/workbench/contrib/scm/browser/dirtydiffDecorator.ts @@ -234,7 +234,7 @@ class DirtyDiffWidget extends PeekViewWidget { const changeTypeColor = getChangeTypeColor(this.themeService.getTheme(), changeType); this.style({ frameColor: changeTypeColor, arrowColor: changeTypeColor }); - this._actionbarWidget.context = [this.model.modified!.uri, this.model.changes, index]; + this._actionbarWidget!.context = [this.model.modified!.uri, this.model.changes, index]; this.show(position, height); this.editor.focus(); } @@ -255,11 +255,11 @@ class DirtyDiffWidget extends PeekViewWidget { this._disposables.add(previous); this._disposables.add(next); - this._actionbarWidget.push([previous, next], { label: false, icon: true }); + this._actionbarWidget!.push([previous, next], { label: false, icon: true }); const actions: IAction[] = []; this._disposables.add(createAndFillInActionBarActions(this.menu, { shouldForwardArgs: true }, actions)); - this._actionbarWidget.push(actions, { label: false, icon: true }); + this._actionbarWidget!.push(actions, { label: false, icon: true }); } protected _getActionBarOptions(): IActionBarOptions {