Skip to content

Commit

Permalink
Update diff editor with new webview options
Browse files Browse the repository at this point in the history
  • Loading branch information
mjbvz committed Mar 3, 2021
1 parent e56182e commit 828f99e
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import { generateUuid } from 'vs/base/common/uuid';
import { IMouseWheelEvent, StandardMouseEvent } from 'vs/base/browser/mouseEvent';
import { DiffNestedCellViewModel } from 'vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel';
import { BackLayerWebView } from 'vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView';
import { CELL_OUTPUT_PADDING } from 'vs/workbench/contrib/notebook/browser/constants';
import { CELL_MARGIN, CELL_OUTPUT_PADDING, CELL_RUN_GUTTER, CODE_CELL_LEFT_MARGIN } from 'vs/workbench/contrib/notebook/browser/constants';
import { NotebookDiffEditorEventDispatcher, NotebookDiffLayoutChangedEvent } from 'vs/workbench/contrib/notebook/browser/diff/eventDispatcher';

const $ = DOM.$;
Expand Down Expand Up @@ -389,8 +389,16 @@ export class NotebookTextDiffEditor extends EditorPane implements INotebookTextD
}));
}

private readonly webviewOptions = {
outputNodePadding: CELL_OUTPUT_PADDING,
outputNodeLeftPadding: 32,
leftMargin: CODE_CELL_LEFT_MARGIN,
cellMargin: CELL_MARGIN,
runGutter: CELL_RUN_GUTTER
};

private async _createModifiedWebview(id: string, resource: URI): Promise<void> {
this._modifiedWebview = this.instantiationService.createInstance(BackLayerWebView, this, id, resource, { outputNodePadding: CELL_OUTPUT_PADDING, outputNodeLeftPadding: 32 }) as BackLayerWebView<IDiffCellInfo>;
this._modifiedWebview = this.instantiationService.createInstance(BackLayerWebView, this, id, resource, this.webviewOptions) as BackLayerWebView<IDiffCellInfo>;
// attach the webview container to the DOM tree first
this._list.rowsContainer.insertAdjacentElement('afterbegin', this._modifiedWebview.element);
await this._modifiedWebview.createWebview();
Expand All @@ -399,7 +407,7 @@ export class NotebookTextDiffEditor extends EditorPane implements INotebookTextD
}

private async _createOriginalWebview(id: string, resource: URI): Promise<void> {
this._originalWebview = this.instantiationService.createInstance(BackLayerWebView, this, id, resource, { outputNodePadding: CELL_OUTPUT_PADDING, outputNodeLeftPadding: 32 }) as BackLayerWebView<IDiffCellInfo>;
this._originalWebview = this.instantiationService.createInstance(BackLayerWebView, this, id, resource, this.webviewOptions) as BackLayerWebView<IDiffCellInfo>;
// attach the webview container to the DOM tree first
this._list.rowsContainer.insertAdjacentElement('afterbegin', this._originalWebview.element);
await this._originalWebview.createWebview();
Expand Down

0 comments on commit 828f99e

Please sign in to comment.