Skip to content

Commit

Permalink
joh/passive barracuda (#180530)
Browse files Browse the repository at this point in the history
* tweak inline diff editor options, make sure livePreview and notebooks is pretty

* tweak logging
  • Loading branch information
jrieken authored Apr 21, 2023
1 parent 039fd89 commit d3af653
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
cursor: text;
}

.monaco-editor .interactive-editor .monaco-editor-background {
.monaco-editor .interactive-editor .body .content .input .monaco-editor-background {
background-color: var(--vscode-interactiveEditorInput-background);
}

Expand Down Expand Up @@ -217,3 +217,8 @@
.monaco-editor .interactive-editor-diff-widget {
padding: 6px 0;
}

.monaco-editor .interactive-editor-diff-widget .monaco-diff-editor .monaco-editor-background,
.monaco-editor .interactive-editor-diff-widget .monaco-diff-editor .monaco-editor .margin-view-overlays {
background-color: var(--vscode-interactiveEditor-regionHighlight);
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,19 @@ export class InteractiveEditorDiffWidget extends ZoneWidget {

this._diffEditor = instantiationService.createInstance(EmbeddedDiffEditorWidget, this._elements.domNode, {
scrollbar: { useShadows: false, alwaysConsumeMouseWheel: false },
renderMarginRevertIcon: false,
diffCodeLens: false,
scrollBeyondLastLine: false,
stickyScroll: { enabled: false },
renderMarginRevertIcon: false,
renderOverviewRuler: false,
rulers: undefined,
overviewRulerBorder: undefined,
overviewRulerLanes: 0,
diffAlgorithm: 'advanced',
splitViewDefaultRatio: 0.35
splitViewDefaultRatio: 0.35,
padding: { top: 0, bottom: 0 },
folding: false,
diffCodeLens: false,
stickyScroll: { enabled: false },
minimap: { enabled: false },
}, {
originalEditor: { contributions: diffContributions },
modifiedEditor: { contributions: diffContributions }
Expand Down Expand Up @@ -127,8 +133,8 @@ export class InteractiveEditorDiffWidget extends ZoneWidget {
}

this._hideEditorRanges(this.editor, [ranges.modifiedHidden]);
this._hideEditorRanges(this._diffEditor.getModifiedEditor(), ranges.modifiedDiffHidden);
this._hideEditorRanges(this._diffEditor.getOriginalEditor(), ranges.originalDiffHidden);
this._hideEditorRanges(this._diffEditor.getModifiedEditor(), ranges.modifiedDiffHidden);

this._diffEditor.revealLine(ranges.modifiedHidden.startLineNumber, ScrollType.Immediate);

Expand All @@ -137,9 +143,10 @@ export class InteractiveEditorDiffWidget extends ZoneWidget {

const lineHeightDiff = Math.max(lineCountModified, lineCountOriginal);
const lineHeightPadding = (this.editor.getOption(EditorOption.lineHeight) / 12) /* padding-top/bottom*/;
const heightInLines = lineHeightDiff + lineHeightPadding;

super.show(ranges.anchor, lineHeightDiff + lineHeightPadding);
this._logService.debug(`[IE] diff SHOWING at ${ranges.anchor}`);
super.show(ranges.anchor, heightInLines);
this._logService.debug(`[IE] diff SHOWING at ${ranges.anchor} with ${heightInLines} lines height`);
}

private _computeHiddenRanges(model: ITextModel, range: Range, changes: LineRangeMapping[]) {
Expand Down Expand Up @@ -186,7 +193,7 @@ export class InteractiveEditorDiffWidget extends ZoneWidget {
} else {
const ranges = lineRanges.map(r => new Range(r.startLineNumber, 1, r.endLineNumberExclusive - 1, 1));
editor.setHiddenAreas(ranges, InteractiveEditorDiffWidget._hideId);
this._logService.debug(`[IE] diff HIDING ${ranges} for ${String(editor.getModel()?.uri)}`);
this._logService.debug(`[IE] diff HIDING ${ranges} for ${editor.getId()} with ${String(editor.getModel()?.uri)}`);
}
}

Expand All @@ -211,11 +218,11 @@ export class InteractiveEditorDiffWidget extends ZoneWidget {

protected override _doLayout(heightInPixel: number, widthInPixel: number): void {
const newDim = new Dimension(widthInPixel, heightInPixel);
if (Dimension.equals(this._dim, newDim)) {
return;
if (!Dimension.equals(this._dim, newDim)) {
this._dim = newDim;
this._diffEditor.layout(this._dim.with(undefined, this._dim.height - 12 /* padding */));
this._logService.debug('[IE] diff LAYOUT', this._dim);
}
this._dim = newDim;
this._diffEditor.layout(this._dim.with(undefined, this._dim.height - 12 /* padding */));
}
}

Expand Down

0 comments on commit d3af653

Please sign in to comment.