This commit is contained in:
rebornix
2020-08-19 12:15:42 -07:00
parent 8b8370b8c3
commit fee4dcfb76
2 changed files with 3 additions and 86 deletions
@@ -28,10 +28,9 @@ import { DiffComputer } from 'vs/editor/common/diff/diffComputer';
import { createDecoration, DECORATIONS, isChangeOrDelete, isChangeOrInsert } from 'vs/editor/browser/widget/diffEditorWidget';
import * as editorCommon from 'vs/editor/common/editorCommon';
import { Color } from 'vs/base/common/color';
import { IModelDeltaDecoration, IReadonlyTextBuffer, ITextBuffer, ITextModel } from 'vs/editor/common/model';
import { IModelDeltaDecoration, IReadonlyTextBuffer } from 'vs/editor/common/model';
import { Range } from 'vs/editor/common/core/range';
import { Constants } from 'vs/base/common/uint';
import * as editorBrowser from 'vs/editor/browser/editorBrowser';
import { defaultInsertColor, defaultRemoveColor, diffInserted, diffRemoved } from 'vs/platform/theme/common/colorRegistry';
export class NotebookDiffEditor extends BaseEditor {
@@ -383,7 +382,7 @@ export class DiffEditorWidgetSideBySide extends Disposable {
}
protected _getOriginalEditorDecorations(lineChanges: editorCommon.ILineChange[], ignoreTrimWhitespace: boolean, renderIndicators: boolean, originalModel: IReadonlyTextBuffer): IEditorDiffDecorations {
const overviewZoneColor = String(this._removeColor);
// const overviewZoneColor = String(this._removeColor);
let result: IEditorDiffDecorations = {
decorations: [],
@@ -441,7 +440,7 @@ export class DiffEditorWidgetSideBySide extends Disposable {
}
protected _getModifiedEditorDecorations(lineChanges: editorCommon.ILineChange[], ignoreTrimWhitespace: boolean, renderIndicators: boolean, modifiedModel: IReadonlyTextBuffer): IEditorDiffDecorations {
const overviewZoneColor = String(this._insertColor);
// const overviewZoneColor = String(this._insertColor);
let result: IEditorDiffDecorations = {
decorations: [],
@@ -3,7 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as nls from 'vs/nls';
import * as DOM from 'vs/base/browser/dom';
import { IMouseWheelEvent } from 'vs/base/browser/mouseEvent';
import { IListRenderer, IListVirtualDelegate, ListError } from 'vs/base/browser/ui/list/list';
@@ -26,8 +25,6 @@ import { diff, IProcessedOutput, NOTEBOOK_EDITOR_CURSOR_BOUNDARY, CellKind } fro
import { clamp } from 'vs/base/common/numbers';
import { SCROLLABLE_ELEMENT_PADDING_TOP } from 'vs/workbench/contrib/notebook/browser/constants';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { editorBackground, foreground, focusBorder } from 'vs/platform/theme/common/colorRegistry';
import { NotebookGutter, NotebookGutterDelegate, GutterRenderer } from 'vs/workbench/contrib/notebook/browser/view/notebookGutter';
import { RangeMapWithWhitespace } from 'vs/workbench/contrib/notebook/browser/view/rangeMapWithWhitespace';
export interface IFocusNextPreviousDelegate {
@@ -67,7 +64,6 @@ export class NotebookCellList extends WorkbenchList<CellViewModel> implements ID
private readonly _focusNextPreviousDelegate: IFocusNextPreviousDelegate;
private _cellListGutter: WorkbenchList<CellViewModel>;
private _rangeMap: RangeMapWithWhitespace;
constructor(
@@ -168,75 +164,6 @@ export class NotebookCellList extends WorkbenchList<CellViewModel> implements ID
focus.focusMode = CellFocusMode.Editor;
}
}));
const gutterContainer = DOM.append(container, DOM.$('.notebook-gutter'));
this._cellListGutter = instantiationService.createInstance(
NotebookGutter,
'NotebookGutter',
gutterContainer,
instantiationService.createInstance(NotebookGutterDelegate),
[instantiationService.createInstance(GutterRenderer, (index, size) => {
DOM.scheduleAtNextAnimationFrame(() => {
this._cellListGutter?.updateElementHeight(index, size);
});
})],
this.contextKeyService,
{
setRowLineHeight: false,
setRowHeight: false,
supportDynamicHeights: true,
horizontalScrolling: false,
keyboardSupport: false,
mouseSupport: false,
multipleSelectionSupport: false,
enableKeyboardNavigation: false,
additionalScrollHeight: 0,
transformOptimization: false,
styleController: (_suffix: string) => { return this; },
overrideStyles: {
listBackground: editorBackground,
listActiveSelectionBackground: editorBackground,
listActiveSelectionForeground: foreground,
listFocusAndSelectionBackground: editorBackground,
listFocusAndSelectionForeground: foreground,
listFocusBackground: editorBackground,
listFocusForeground: foreground,
listHoverForeground: foreground,
listHoverBackground: editorBackground,
listHoverOutline: focusBorder,
listFocusOutline: focusBorder,
listInactiveSelectionBackground: editorBackground,
listInactiveSelectionForeground: foreground,
listInactiveFocusBackground: editorBackground,
listInactiveFocusOutline: editorBackground,
},
accessibilityProvider: {
getAriaLabel() { return null; },
getWidgetAriaLabel() {
return nls.localize('notebookTreeAriaLabel', "Notebook");
}
}
},
);
this._localDisposableStore.add(this.onDidScroll(() => {
if (this._cellListGutter.scrollTop !== this.scrollTop) {
this._cellListGutter.scrollTop = this.scrollTop;
}
}));
//TODO
// this._localDisposableStore.add(this._cellListGutter.onDidScroll(() => {
// if (scrolling) {
// return;
// }
// if (this._cellListGutter.scrollTop !== this.scrollTop) {
// this.scrollTop = this._cellListGutter.scrollTop;
// }
// }));
}
elementAt(position: number): ICellViewModel | undefined {
@@ -461,9 +388,6 @@ export class NotebookCellList extends WorkbenchList<CellViewModel> implements ID
}
super.splice(start, deleteCount, elements);
this._cellListGutter.splice(start, deleteCount, elements);
const selectionsLeft = [];
this._viewModel!.selectionHandles.forEach(handle => {
if (this._viewModel!.hasCell(handle)) {
@@ -671,7 +595,6 @@ export class NotebookCellList extends WorkbenchList<CellViewModel> implements ID
const focused = this.getFocus();
this.view.updateElementHeight(index, size, focused.length ? focused[0] : null);
this._cellListGutter.updateElementHeight(index, size);
}
// override
@@ -912,15 +835,10 @@ export class NotebookCellList extends WorkbenchList<CellViewModel> implements ID
updateOptions(options: IListOptions<ICellViewModel>) {
super.updateOptions(options);
if (options.additionalScrollHeight !== undefined) {
this._cellListGutter.updateOptions({ additionalScrollHeight: options.additionalScrollHeight });
}
}
layout(height?: number, width?: number): void {
super.layout(height, width);
this._cellListGutter.layout(height, width);
}