Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

joh/passive barracuda #180530

Merged
merged 3 commits into from
Apr 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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