stream-monaco 0.0.20 → 0.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{index.base-Bt_RWV_F.d.ts → index.base-BB334pQY.d.ts} +1 -0
- package/dist/{index.base-DMJ2aLjO.d.cts → index.base-uTGkC8S0.d.cts} +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.legacy.cjs +1 -1
- package/dist/index.legacy.d.cts +1 -1
- package/dist/index.legacy.d.ts +1 -1
- package/dist/index.legacy.js +1 -1
- package/dist/{preloadMonacoWorkers.shared-C-OxtyGI.js → preloadMonacoWorkers.shared-B-P1keRz.js} +798 -213
- package/dist/{preloadMonacoWorkers.shared-B2kXtXTi.cjs → preloadMonacoWorkers.shared-D9riw4LN.cjs} +798 -213
- package/package.json +29 -27
package/dist/{preloadMonacoWorkers.shared-B2kXtXTi.cjs → preloadMonacoWorkers.shared-D9riw4LN.cjs}
RENAMED
|
@@ -553,9 +553,16 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
553
553
|
diffHunkFallbackVersions = null;
|
|
554
554
|
diffHunkActionInFlight = false;
|
|
555
555
|
diffComputedVersions = null;
|
|
556
|
+
preserveNativeDiffDecorationsOnStaleAppend = false;
|
|
556
557
|
diffPresentationDisposables = [];
|
|
558
|
+
diffPresentationObserver = null;
|
|
557
559
|
fallbackOriginalDecorationIds = [];
|
|
558
560
|
fallbackModifiedDecorationIds = [];
|
|
561
|
+
fallbackInlineDeletedZoneIds = [];
|
|
562
|
+
fallbackInlineDeletedZoneSignature = null;
|
|
563
|
+
inlineDiffStreamingPresentationActive = false;
|
|
564
|
+
inlineDiffStreamingPresentationIdleTimer = null;
|
|
565
|
+
inlineDiffStreamingHeightFloor = 0;
|
|
559
566
|
diffHunkHideTimer = null;
|
|
560
567
|
diffUnchangedRegionDisposables = [];
|
|
561
568
|
diffUnchangedRegionObserver = null;
|
|
@@ -568,7 +575,55 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
568
575
|
diffUnchangedOverlayScrollLeft = 0;
|
|
569
576
|
diffRootAppearanceSignature = null;
|
|
570
577
|
diffPersistedUnchangedModelState = null;
|
|
578
|
+
diffPreviousUnchangedModelState = null;
|
|
571
579
|
pendingPreparedDiffViewModel = null;
|
|
580
|
+
cancelRafs() {
|
|
581
|
+
this.rafScheduler.cancel("sync-diff-presentation");
|
|
582
|
+
this.rafScheduler.cancel("sync-diff-layout");
|
|
583
|
+
this.rafScheduler.cancel("capture-diff-unchanged-state");
|
|
584
|
+
this.rafScheduler.cancel("restore-diff-unchanged-state");
|
|
585
|
+
this.rafScheduler.cancel("patch-diff-unchanged-regions");
|
|
586
|
+
this.rafScheduler.cancel("maybe-scroll-diff");
|
|
587
|
+
this.rafScheduler.cancel("revealDiff");
|
|
588
|
+
this.rafScheduler.cancel("immediate-reveal-diff");
|
|
589
|
+
this.rafScheduler.cancel("maybe-resume-diff");
|
|
590
|
+
this.rafScheduler.cancel("content-size-change-diff");
|
|
591
|
+
this.rafScheduler.cancel("sync-last-known-modified");
|
|
592
|
+
this.rafScheduler.cancel("diff");
|
|
593
|
+
this.rafScheduler.cancel("appendDiff");
|
|
594
|
+
}
|
|
595
|
+
clearRevealTimers() {
|
|
596
|
+
if (this.revealDebounceIdDiff != null) {
|
|
597
|
+
clearTimeout(this.revealDebounceIdDiff);
|
|
598
|
+
this.revealDebounceIdDiff = null;
|
|
599
|
+
}
|
|
600
|
+
if (this.revealIdleTimerIdDiff != null) {
|
|
601
|
+
clearTimeout(this.revealIdleTimerIdDiff);
|
|
602
|
+
this.revealIdleTimerIdDiff = null;
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
resetAppendState() {
|
|
606
|
+
this.appendBufferDiffScheduled = false;
|
|
607
|
+
this.appendBufferOriginalDiff.length = 0;
|
|
608
|
+
this.appendBufferModifiedDiff.length = 0;
|
|
609
|
+
if (this.appendFlushThrottleTimerDiff != null) {
|
|
610
|
+
clearTimeout(this.appendFlushThrottleTimerDiff);
|
|
611
|
+
this.appendFlushThrottleTimerDiff = null;
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
clearAsyncWork() {
|
|
615
|
+
this.cancelRafs();
|
|
616
|
+
this.pendingDiffUpdate = null;
|
|
617
|
+
this.lastKnownModifiedDirty = false;
|
|
618
|
+
this.resetAppendState();
|
|
619
|
+
this.clearRevealTimers();
|
|
620
|
+
if (this.diffScrollWatcherSuppressionTimer != null) {
|
|
621
|
+
clearTimeout(this.diffScrollWatcherSuppressionTimer);
|
|
622
|
+
this.diffScrollWatcherSuppressionTimer = null;
|
|
623
|
+
}
|
|
624
|
+
this.cancelScheduledHideDiffHunkActions();
|
|
625
|
+
this.clearPendingDiffThemeSync();
|
|
626
|
+
}
|
|
572
627
|
diffModelTransitionRequestId = 0;
|
|
573
628
|
pendingDiffScrollRestorePosition = null;
|
|
574
629
|
pendingDiffScrollRestoreBudget = 0;
|
|
@@ -611,6 +666,9 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
611
666
|
revealLineCount: 5
|
|
612
667
|
};
|
|
613
668
|
}
|
|
669
|
+
resolveDiffGlyphMarginOption(hideUnchangedRegions = this.resolveDiffHideUnchangedRegionsOption()) {
|
|
670
|
+
return (hideUnchangedRegions === null || hideUnchangedRegions === void 0 ? void 0 : hideUnchangedRegions.enabled) ? true : this.options.glyphMargin;
|
|
671
|
+
}
|
|
614
672
|
resolveDiffLineStyleOption() {
|
|
615
673
|
return this.options.diffLineStyle === "bar" ? "bar" : "background";
|
|
616
674
|
}
|
|
@@ -940,6 +998,220 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
940
998
|
else this.fallbackOriginalDecorationIds = [];
|
|
941
999
|
if (modifiedEditor && this.fallbackModifiedDecorationIds.length > 0) this.fallbackModifiedDecorationIds = modifiedEditor.deltaDecorations(this.fallbackModifiedDecorationIds, []);
|
|
942
1000
|
else this.fallbackModifiedDecorationIds = [];
|
|
1001
|
+
this.clearFallbackInlineDeletedZones();
|
|
1002
|
+
}
|
|
1003
|
+
clearFallbackInlineDeletedZones() {
|
|
1004
|
+
var _this$diffEditorView13;
|
|
1005
|
+
const modifiedEditor = (_this$diffEditorView13 = this.diffEditorView) === null || _this$diffEditorView13 === void 0 ? void 0 : _this$diffEditorView13.getModifiedEditor();
|
|
1006
|
+
if (modifiedEditor && this.fallbackInlineDeletedZoneIds.length > 0) try {
|
|
1007
|
+
var _modifiedEditor$chang;
|
|
1008
|
+
(_modifiedEditor$chang = modifiedEditor.changeViewZones) === null || _modifiedEditor$chang === void 0 || _modifiedEditor$chang.call(modifiedEditor, (accessor) => {
|
|
1009
|
+
for (const id of this.fallbackInlineDeletedZoneIds) accessor.removeZone(id);
|
|
1010
|
+
});
|
|
1011
|
+
} catch {}
|
|
1012
|
+
this.fallbackInlineDeletedZoneIds = [];
|
|
1013
|
+
this.clearFallbackInlineDeletedZoneWrapperContent();
|
|
1014
|
+
this.fallbackInlineDeletedZoneSignature = null;
|
|
1015
|
+
}
|
|
1016
|
+
clearFallbackInlineDeletedZoneWrapperContent() {
|
|
1017
|
+
var _this$lastContainer, _this$lastContainer2, _node$parentElement;
|
|
1018
|
+
const querySelectorAll = typeof ((_this$lastContainer = this.lastContainer) === null || _this$lastContainer === void 0 ? void 0 : _this$lastContainer.querySelectorAll) === "function" ? (_this$lastContainer2 = this.lastContainer) === null || _this$lastContainer2 === void 0 ? void 0 : _this$lastContainer2.querySelectorAll.bind(this.lastContainer) : null;
|
|
1019
|
+
if (!querySelectorAll) return;
|
|
1020
|
+
const nodes = Array.from(querySelectorAll(".stream-monaco-fallback-inline-delete-zone[data-stream-monaco-native-wrapper=\"true\"], .stream-monaco-fallback-inline-delete-margin[data-stream-monaco-native-wrapper=\"true\"]") ?? []);
|
|
1021
|
+
for (const node of nodes) (_node$parentElement = node.parentElement) === null || _node$parentElement === void 0 || _node$parentElement.removeChild(node);
|
|
1022
|
+
}
|
|
1023
|
+
clearInlineDiffStreamingPresentationIdleTimer() {
|
|
1024
|
+
if (this.inlineDiffStreamingPresentationIdleTimer != null) {
|
|
1025
|
+
clearTimeout(this.inlineDiffStreamingPresentationIdleTimer);
|
|
1026
|
+
this.inlineDiffStreamingPresentationIdleTimer = null;
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
resetInlineDiffStreamingHeightFloor() {
|
|
1030
|
+
this.inlineDiffStreamingHeightFloor = 0;
|
|
1031
|
+
}
|
|
1032
|
+
syncDiffEditorLayoutToContainer() {
|
|
1033
|
+
if (!this.diffEditorView || !this.lastContainer) return;
|
|
1034
|
+
const width = this.lastContainer.clientWidth || this.lastContainer.getBoundingClientRect().width;
|
|
1035
|
+
const height = this.lastContainer.clientHeight || this.lastContainer.getBoundingClientRect().height;
|
|
1036
|
+
if (!(width > 0) || !(height > 0)) return;
|
|
1037
|
+
try {
|
|
1038
|
+
var _layout, _ref;
|
|
1039
|
+
(_layout = (_ref = this.diffEditorView).layout) === null || _layout === void 0 || _layout.call(_ref, {
|
|
1040
|
+
width: Math.round(width),
|
|
1041
|
+
height: Math.round(height)
|
|
1042
|
+
});
|
|
1043
|
+
} catch {
|
|
1044
|
+
try {
|
|
1045
|
+
var _layout2, _ref2;
|
|
1046
|
+
(_layout2 = (_ref2 = this.diffEditorView).layout) === null || _layout2 === void 0 || _layout2.call(_ref2);
|
|
1047
|
+
} catch {}
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
scheduleSyncDiffEditorLayoutToContainer() {
|
|
1051
|
+
this.rafScheduler.schedule("sync-diff-layout", () => {
|
|
1052
|
+
this.syncDiffEditorLayoutToContainer();
|
|
1053
|
+
});
|
|
1054
|
+
}
|
|
1055
|
+
readModelLineContent(model, lineNumber) {
|
|
1056
|
+
const direct = model.getLineContent;
|
|
1057
|
+
if (typeof direct === "function") return direct.call(model, lineNumber);
|
|
1058
|
+
return model.getValue().split(/\r?\n/)[lineNumber - 1] ?? "";
|
|
1059
|
+
}
|
|
1060
|
+
hasVisibleNativeInlineDeleteNodes() {
|
|
1061
|
+
if (!this.lastContainer) return false;
|
|
1062
|
+
const querySelectorAll = typeof this.lastContainer.querySelectorAll === "function" ? this.lastContainer.querySelectorAll.bind(this.lastContainer) : null;
|
|
1063
|
+
if (!querySelectorAll) return false;
|
|
1064
|
+
const nodes = Array.from(querySelectorAll(".editor.modified .view-zones .line-delete, .editor.modified .inline-deleted-text, .editor.modified .inline-deleted-margin-view-zone") ?? []);
|
|
1065
|
+
return nodes.some((node) => {
|
|
1066
|
+
var _node$getBoundingClie, _globalThis$getComput, _globalThis;
|
|
1067
|
+
if (!(node instanceof HTMLElement)) return false;
|
|
1068
|
+
const rect = (_node$getBoundingClie = node.getBoundingClientRect) === null || _node$getBoundingClie === void 0 ? void 0 : _node$getBoundingClie.call(node);
|
|
1069
|
+
const style = (_globalThis$getComput = (_globalThis = globalThis).getComputedStyle) === null || _globalThis$getComput === void 0 ? void 0 : _globalThis$getComput.call(_globalThis, node);
|
|
1070
|
+
return ((rect === null || rect === void 0 ? void 0 : rect.width) ?? 0) > 0 && ((rect === null || rect === void 0 ? void 0 : rect.height) ?? 0) > 0 && (style === null || style === void 0 ? void 0 : style.display) !== "none" && (style === null || style === void 0 ? void 0 : style.visibility) !== "hidden" && Number.parseFloat((style === null || style === void 0 ? void 0 : style.opacity) || "1") > .01;
|
|
1071
|
+
});
|
|
1072
|
+
}
|
|
1073
|
+
countNativeInlineDeleteZoneNodes() {
|
|
1074
|
+
if (!this.lastContainer) return 0;
|
|
1075
|
+
const querySelectorAll = typeof this.lastContainer.querySelectorAll === "function" ? this.lastContainer.querySelectorAll.bind(this.lastContainer) : null;
|
|
1076
|
+
if (!querySelectorAll) return 0;
|
|
1077
|
+
const nodes = Array.from(querySelectorAll(".editor.modified .view-zones [monaco-view-zone], .editor.modified .margin-view-zones [monaco-view-zone]") ?? []);
|
|
1078
|
+
return nodes.filter((node) => {
|
|
1079
|
+
if (!(node instanceof HTMLElement)) return false;
|
|
1080
|
+
return node.matches(".view-lines.line-delete") || !!node.querySelector(".view-lines.line-delete") || node.matches(".inline-deleted-margin-view-zone") || !!node.querySelector(".inline-deleted-margin-view-zone");
|
|
1081
|
+
}).length;
|
|
1082
|
+
}
|
|
1083
|
+
syncFallbackInlineDeletedZones(lineChanges) {
|
|
1084
|
+
var _modifiedEditor$getMo, _EditorOption, _modifiedEditor$getOp, _this$lastContainer3, _this$lastContainer3$, _this$lastContainer4, _this$lastContainer4$;
|
|
1085
|
+
if (typeof document === "undefined" || !this.diffEditorView || !this.originalModel || !this.isDiffInlineMode()) {
|
|
1086
|
+
this.clearFallbackInlineDeletedZones();
|
|
1087
|
+
return;
|
|
1088
|
+
}
|
|
1089
|
+
const modifiedEditor = this.diffEditorView.getModifiedEditor();
|
|
1090
|
+
const modifiedModel = modifiedEditor === null || modifiedEditor === void 0 || (_modifiedEditor$getMo = modifiedEditor.getModel) === null || _modifiedEditor$getMo === void 0 ? void 0 : _modifiedEditor$getMo.call(modifiedEditor);
|
|
1091
|
+
const originalModel = this.originalModel;
|
|
1092
|
+
if (!modifiedEditor || !modifiedModel || !originalModel) {
|
|
1093
|
+
this.fallbackInlineDeletedZoneIds = [];
|
|
1094
|
+
return;
|
|
1095
|
+
}
|
|
1096
|
+
const lineHeightOption = (_EditorOption = monaco_shim_exports.editor.EditorOption) === null || _EditorOption === void 0 ? void 0 : _EditorOption.lineHeight;
|
|
1097
|
+
const lineHeight = ((_modifiedEditor$getOp = modifiedEditor.getOption) === null || _modifiedEditor$getOp === void 0 ? void 0 : _modifiedEditor$getOp.call(modifiedEditor, lineHeightOption)) ?? 20;
|
|
1098
|
+
const relevantChanges = lineChanges.filter((change) => this.hasOriginalLines(change));
|
|
1099
|
+
const nativeViewWrappers = Array.from(((_this$lastContainer3 = this.lastContainer) === null || _this$lastContainer3 === void 0 || (_this$lastContainer3$ = _this$lastContainer3.querySelectorAll) === null || _this$lastContainer3$ === void 0 ? void 0 : _this$lastContainer3$.call(_this$lastContainer3, ".editor.modified .view-zones [monaco-view-zone]")) ?? []).filter((node) => {
|
|
1100
|
+
return node instanceof HTMLElement && !!node.querySelector(".view-lines.line-delete");
|
|
1101
|
+
});
|
|
1102
|
+
const nativeMarginWrappers = Array.from(((_this$lastContainer4 = this.lastContainer) === null || _this$lastContainer4 === void 0 || (_this$lastContainer4$ = _this$lastContainer4.querySelectorAll) === null || _this$lastContainer4$ === void 0 ? void 0 : _this$lastContainer4$.call(_this$lastContainer4, ".editor.modified .margin-view-zones [monaco-view-zone]")) ?? []).filter((node) => {
|
|
1103
|
+
return node instanceof HTMLElement && !!node.querySelector(".inline-deleted-margin-view-zone");
|
|
1104
|
+
});
|
|
1105
|
+
const nativePairs = nativeViewWrappers.map((viewWrapper) => {
|
|
1106
|
+
const id = viewWrapper.getAttribute("monaco-view-zone");
|
|
1107
|
+
if (!id) return null;
|
|
1108
|
+
const marginWrapper = nativeMarginWrappers.find((candidate) => candidate.getAttribute("monaco-view-zone") === id);
|
|
1109
|
+
return {
|
|
1110
|
+
id,
|
|
1111
|
+
top: Number.parseFloat(viewWrapper.style.top || "NaN"),
|
|
1112
|
+
viewWrapper,
|
|
1113
|
+
marginWrapper: marginWrapper ?? null
|
|
1114
|
+
};
|
|
1115
|
+
}).filter((entry) => !!entry && Number.isFinite(entry.top)).sort((left, right) => left.top - right.top);
|
|
1116
|
+
if (nativePairs.length >= relevantChanges.length && relevantChanges.length > 0) {
|
|
1117
|
+
const nextSignature$1 = nativePairs.slice(0, relevantChanges.length).map((pair, index) => {
|
|
1118
|
+
const change = relevantChanges[index];
|
|
1119
|
+
const text = Array.from({ length: change.originalEndLineNumber - change.originalStartLineNumber + 1 }, (_, offset) => this.readModelLineContent(originalModel, change.originalStartLineNumber + offset)).join("\n");
|
|
1120
|
+
return `${pair.id}:${text}`;
|
|
1121
|
+
}).join("|");
|
|
1122
|
+
if (nextSignature$1 && this.fallbackInlineDeletedZoneSignature === nextSignature$1 && this.fallbackInlineDeletedZoneIds.length === 0) return;
|
|
1123
|
+
if (this.fallbackInlineDeletedZoneIds.length > 0) {
|
|
1124
|
+
try {
|
|
1125
|
+
var _modifiedEditor$chang2;
|
|
1126
|
+
(_modifiedEditor$chang2 = modifiedEditor.changeViewZones) === null || _modifiedEditor$chang2 === void 0 || _modifiedEditor$chang2.call(modifiedEditor, (accessor) => {
|
|
1127
|
+
for (const id of this.fallbackInlineDeletedZoneIds) accessor.removeZone(id);
|
|
1128
|
+
});
|
|
1129
|
+
} catch {}
|
|
1130
|
+
this.fallbackInlineDeletedZoneIds = [];
|
|
1131
|
+
}
|
|
1132
|
+
this.clearFallbackInlineDeletedZoneWrapperContent();
|
|
1133
|
+
relevantChanges.forEach((change, index) => {
|
|
1134
|
+
var _modifiedEditor$apply;
|
|
1135
|
+
const pair = nativePairs[index];
|
|
1136
|
+
const domNode = document.createElement("div");
|
|
1137
|
+
domNode.className = "stream-monaco-fallback-inline-delete-zone";
|
|
1138
|
+
domNode.setAttribute("aria-hidden", "true");
|
|
1139
|
+
domNode.setAttribute("data-stream-monaco-native-wrapper", "true");
|
|
1140
|
+
(_modifiedEditor$apply = modifiedEditor.applyFontInfo) === null || _modifiedEditor$apply === void 0 || _modifiedEditor$apply.call(modifiedEditor, domNode);
|
|
1141
|
+
for (let line = change.originalStartLineNumber; line <= change.originalEndLineNumber; line++) {
|
|
1142
|
+
const lineNode = document.createElement("div");
|
|
1143
|
+
lineNode.className = "stream-monaco-fallback-inline-delete-line";
|
|
1144
|
+
lineNode.textContent = this.readModelLineContent(originalModel, line);
|
|
1145
|
+
lineNode.style.height = `${lineHeight}px`;
|
|
1146
|
+
lineNode.style.lineHeight = `${lineHeight}px`;
|
|
1147
|
+
domNode.append(lineNode);
|
|
1148
|
+
}
|
|
1149
|
+
pair.viewWrapper.append(domNode);
|
|
1150
|
+
if (pair.marginWrapper) {
|
|
1151
|
+
var _modifiedEditor$apply2;
|
|
1152
|
+
const marginDomNode = document.createElement("div");
|
|
1153
|
+
marginDomNode.className = "stream-monaco-fallback-inline-delete-margin";
|
|
1154
|
+
marginDomNode.setAttribute("aria-hidden", "true");
|
|
1155
|
+
marginDomNode.setAttribute("data-stream-monaco-native-wrapper", "true");
|
|
1156
|
+
marginDomNode.style.height = "100%";
|
|
1157
|
+
(_modifiedEditor$apply2 = modifiedEditor.applyFontInfo) === null || _modifiedEditor$apply2 === void 0 || _modifiedEditor$apply2.call(modifiedEditor, marginDomNode);
|
|
1158
|
+
pair.marginWrapper.append(marginDomNode);
|
|
1159
|
+
}
|
|
1160
|
+
});
|
|
1161
|
+
this.fallbackInlineDeletedZoneSignature = nextSignature$1 || null;
|
|
1162
|
+
return;
|
|
1163
|
+
}
|
|
1164
|
+
this.clearFallbackInlineDeletedZoneWrapperContent();
|
|
1165
|
+
const nextZones = relevantChanges.map((change) => {
|
|
1166
|
+
var _modifiedEditor$apply3, _modifiedEditor$apply4;
|
|
1167
|
+
const lineCount = change.originalEndLineNumber - change.originalStartLineNumber + 1;
|
|
1168
|
+
if (lineCount < 1) return null;
|
|
1169
|
+
const domNode = document.createElement("div");
|
|
1170
|
+
domNode.className = "stream-monaco-fallback-inline-delete-zone";
|
|
1171
|
+
domNode.setAttribute("aria-hidden", "true");
|
|
1172
|
+
(_modifiedEditor$apply3 = modifiedEditor.applyFontInfo) === null || _modifiedEditor$apply3 === void 0 || _modifiedEditor$apply3.call(modifiedEditor, domNode);
|
|
1173
|
+
for (let line = change.originalStartLineNumber; line <= change.originalEndLineNumber; line++) {
|
|
1174
|
+
const lineNode = document.createElement("div");
|
|
1175
|
+
lineNode.className = "stream-monaco-fallback-inline-delete-line";
|
|
1176
|
+
lineNode.textContent = this.readModelLineContent(originalModel, line);
|
|
1177
|
+
lineNode.style.height = `${lineHeight}px`;
|
|
1178
|
+
lineNode.style.lineHeight = `${lineHeight}px`;
|
|
1179
|
+
domNode.append(lineNode);
|
|
1180
|
+
}
|
|
1181
|
+
const marginDomNode = document.createElement("div");
|
|
1182
|
+
marginDomNode.className = "stream-monaco-fallback-inline-delete-margin";
|
|
1183
|
+
marginDomNode.setAttribute("aria-hidden", "true");
|
|
1184
|
+
(_modifiedEditor$apply4 = modifiedEditor.applyFontInfo) === null || _modifiedEditor$apply4 === void 0 || _modifiedEditor$apply4.call(modifiedEditor, marginDomNode);
|
|
1185
|
+
const anchorLine = Math.max(0, Math.min(modifiedModel.getLineCount(), (change.modifiedStartLineNumber || 1) - 1));
|
|
1186
|
+
return {
|
|
1187
|
+
afterLineNumber: anchorLine,
|
|
1188
|
+
heightInLines: lineCount,
|
|
1189
|
+
domNode,
|
|
1190
|
+
marginDomNode
|
|
1191
|
+
};
|
|
1192
|
+
}).filter(Boolean);
|
|
1193
|
+
const nextSignature = nextZones.map((zone) => {
|
|
1194
|
+
var _zone$domNode;
|
|
1195
|
+
const text = typeof ((_zone$domNode = zone.domNode) === null || _zone$domNode === void 0 ? void 0 : _zone$domNode.textContent) === "string" ? zone.domNode.textContent : "";
|
|
1196
|
+
return `${zone.afterLineNumber}:${zone.heightInLines}:${text}`;
|
|
1197
|
+
}).join("|");
|
|
1198
|
+
if (nextSignature && this.fallbackInlineDeletedZoneSignature === nextSignature && this.fallbackInlineDeletedZoneIds.length === nextZones.length) return;
|
|
1199
|
+
try {
|
|
1200
|
+
var _modifiedEditor$chang3;
|
|
1201
|
+
(_modifiedEditor$chang3 = modifiedEditor.changeViewZones) === null || _modifiedEditor$chang3 === void 0 || _modifiedEditor$chang3.call(modifiedEditor, (accessor) => {
|
|
1202
|
+
for (const id of this.fallbackInlineDeletedZoneIds) accessor.removeZone(id);
|
|
1203
|
+
this.fallbackInlineDeletedZoneIds = nextZones.map((zone) => accessor.addZone(zone));
|
|
1204
|
+
});
|
|
1205
|
+
this.fallbackInlineDeletedZoneSignature = nextSignature || null;
|
|
1206
|
+
} catch {
|
|
1207
|
+
this.fallbackInlineDeletedZoneIds = [];
|
|
1208
|
+
this.fallbackInlineDeletedZoneSignature = null;
|
|
1209
|
+
}
|
|
1210
|
+
try {
|
|
1211
|
+
var _modifiedEditor$layou, _render;
|
|
1212
|
+
(_modifiedEditor$layou = modifiedEditor.layout) === null || _modifiedEditor$layou === void 0 || _modifiedEditor$layou.call(modifiedEditor);
|
|
1213
|
+
(_render = modifiedEditor.render) === null || _render === void 0 || _render.call(modifiedEditor, true);
|
|
1214
|
+
} catch {}
|
|
943
1215
|
}
|
|
944
1216
|
toWholeLineDecoration(side, startLineNumber, endLineNumber) {
|
|
945
1217
|
if (endLineNumber < startLineNumber || startLineNumber < 1) return null;
|
|
@@ -952,30 +1224,50 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
952
1224
|
marginClassName: removed ? "stream-monaco-fallback-gutter-delete" : "stream-monaco-fallback-gutter-insert",
|
|
953
1225
|
linesDecorationsClassName: removed ? "stream-monaco-fallback-lines-delete" : "stream-monaco-fallback-lines-insert",
|
|
954
1226
|
lineNumberClassName: removed ? "stream-monaco-fallback-line-number-delete" : "stream-monaco-fallback-line-number-insert",
|
|
955
|
-
description: removed ? "stream-monaco-fallback-line-delete" : "stream-monaco-fallback-line-insert",
|
|
956
1227
|
zIndex: 5
|
|
957
1228
|
}
|
|
958
1229
|
};
|
|
959
1230
|
}
|
|
960
1231
|
syncDiffPresentationDecorations() {
|
|
1232
|
+
var _this$diffEditorView$3, _this$lastContainer$q, _this$lastContainer5;
|
|
961
1233
|
if (!this.diffEditorView || !this.lastContainer) return;
|
|
962
1234
|
const nativeFresh = this.hasFreshNativeDiffResult();
|
|
963
|
-
this.
|
|
964
|
-
|
|
1235
|
+
const useInlineMode = this.isDiffInlineMode();
|
|
1236
|
+
const lineChanges = this.getEffectiveLineChanges();
|
|
1237
|
+
const nativeInlineDeleteZoneCount = useInlineMode ? this.countNativeInlineDeleteZoneNodes() : 0;
|
|
1238
|
+
const hasNativeInlineDeleteZoneNodes = nativeInlineDeleteZoneCount > 0;
|
|
1239
|
+
const hasNativeInlineDeleteNodes = useInlineMode && this.hasVisibleNativeInlineDeleteNodes();
|
|
1240
|
+
const shouldKeepInlineFallback = useInlineMode && lineChanges.some((change) => this.hasOriginalLines(change)) && !hasNativeInlineDeleteZoneNodes;
|
|
1241
|
+
const useInlineStaleFallback = shouldKeepInlineFallback;
|
|
1242
|
+
this.lastContainer.classList.toggle("stream-monaco-diff-inline-native-ready", useInlineMode && !shouldKeepInlineFallback && (nativeFresh || hasNativeInlineDeleteNodes || hasNativeInlineDeleteZoneNodes));
|
|
1243
|
+
const keepNativeDecorationsWhileStale = !useInlineStaleFallback && !nativeFresh && this.preserveNativeDiffDecorationsOnStaleAppend && ((((_this$diffEditorView$3 = this.diffEditorView.getLineChanges()) === null || _this$diffEditorView$3 === void 0 ? void 0 : _this$diffEditorView$3.length) ?? 0) > 0 || !!((_this$lastContainer$q = (_this$lastContainer5 = this.lastContainer).querySelector) === null || _this$lastContainer$q === void 0 ? void 0 : _this$lastContainer$q.call(_this$lastContainer5, ".line-insert, .line-delete, .gutter-insert, .gutter-delete")));
|
|
1244
|
+
this.lastContainer.classList.toggle("stream-monaco-diff-native-stale", !nativeFresh && !keepNativeDecorationsWhileStale);
|
|
1245
|
+
if (nativeFresh && !shouldKeepInlineFallback) {
|
|
965
1246
|
this.clearFallbackDiffDecorations();
|
|
966
1247
|
return;
|
|
967
1248
|
}
|
|
968
1249
|
const originalEditor = this.diffEditorView.getOriginalEditor();
|
|
969
1250
|
const modifiedEditor = this.diffEditorView.getModifiedEditor();
|
|
970
|
-
const lineChanges = this.getEffectiveLineChanges();
|
|
971
1251
|
const originalDecorations = lineChanges.map((change) => this.toWholeLineDecoration("original", change.originalStartLineNumber, change.originalEndLineNumber)).filter(Boolean);
|
|
972
1252
|
const modifiedDecorations = lineChanges.map((change) => this.toWholeLineDecoration("modified", change.modifiedStartLineNumber, change.modifiedEndLineNumber)).filter(Boolean);
|
|
973
1253
|
this.fallbackOriginalDecorationIds = originalEditor.deltaDecorations(this.fallbackOriginalDecorationIds, originalDecorations);
|
|
974
1254
|
this.fallbackModifiedDecorationIds = modifiedEditor.deltaDecorations(this.fallbackModifiedDecorationIds, modifiedDecorations);
|
|
1255
|
+
if (useInlineStaleFallback) this.syncFallbackInlineDeletedZones(lineChanges);
|
|
1256
|
+
else this.clearFallbackInlineDeletedZones();
|
|
975
1257
|
}
|
|
976
1258
|
disposeDiffPresentationTracking() {
|
|
977
1259
|
this.clearFallbackDiffDecorations();
|
|
978
|
-
if (this.
|
|
1260
|
+
if (this.diffPresentationObserver) {
|
|
1261
|
+
this.diffPresentationObserver.disconnect();
|
|
1262
|
+
this.diffPresentationObserver = null;
|
|
1263
|
+
}
|
|
1264
|
+
this.clearInlineDiffStreamingPresentationIdleTimer();
|
|
1265
|
+
this.inlineDiffStreamingPresentationActive = false;
|
|
1266
|
+
this.resetInlineDiffStreamingHeightFloor();
|
|
1267
|
+
if (this.lastContainer) {
|
|
1268
|
+
this.lastContainer.classList.remove("stream-monaco-diff-native-stale");
|
|
1269
|
+
this.lastContainer.classList.remove("stream-monaco-diff-inline-native-ready");
|
|
1270
|
+
}
|
|
979
1271
|
this.diffComputedVersions = null;
|
|
980
1272
|
this.diffPresentationDisposables.forEach((disposable) => disposable.dispose());
|
|
981
1273
|
this.diffPresentationDisposables = [];
|
|
@@ -1326,6 +1618,31 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
1326
1618
|
border: 0 !important;
|
|
1327
1619
|
box-shadow: var(--stream-monaco-removed-line-shadow);
|
|
1328
1620
|
}
|
|
1621
|
+
.stream-monaco-diff-root .monaco-editor .stream-monaco-fallback-inline-delete-zone {
|
|
1622
|
+
box-sizing: border-box;
|
|
1623
|
+
width: 100%;
|
|
1624
|
+
pointer-events: none;
|
|
1625
|
+
}
|
|
1626
|
+
.stream-monaco-diff-root .monaco-editor .stream-monaco-fallback-inline-delete-line {
|
|
1627
|
+
box-sizing: border-box;
|
|
1628
|
+
width: 100%;
|
|
1629
|
+
overflow: hidden;
|
|
1630
|
+
white-space: pre;
|
|
1631
|
+
color: inherit;
|
|
1632
|
+
background: var(--stream-monaco-removed-line-fill);
|
|
1633
|
+
box-shadow: var(--stream-monaco-removed-line-shadow);
|
|
1634
|
+
}
|
|
1635
|
+
.stream-monaco-diff-root .monaco-editor .stream-monaco-fallback-inline-delete-margin {
|
|
1636
|
+
box-sizing: border-box;
|
|
1637
|
+
width: 100%;
|
|
1638
|
+
background: var(--stream-monaco-removed-gutter);
|
|
1639
|
+
pointer-events: none;
|
|
1640
|
+
}
|
|
1641
|
+
.stream-monaco-diff-root.stream-monaco-diff-inline-native-ready .stream-monaco-fallback-inline-delete-zone,
|
|
1642
|
+
.stream-monaco-diff-root.stream-monaco-diff-inline-native-ready .stream-monaco-fallback-inline-delete-line,
|
|
1643
|
+
.stream-monaco-diff-root.stream-monaco-diff-inline-native-ready .stream-monaco-fallback-inline-delete-margin {
|
|
1644
|
+
display: none !important;
|
|
1645
|
+
}
|
|
1329
1646
|
.stream-monaco-diff-root .monaco-editor .stream-monaco-fallback-gutter-insert,
|
|
1330
1647
|
.stream-monaco-diff-root .monaco-diff-editor .stream-monaco-fallback-gutter-insert {
|
|
1331
1648
|
background: var(--stream-monaco-added-gutter) !important;
|
|
@@ -1455,6 +1772,9 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
1455
1772
|
}
|
|
1456
1773
|
.stream-monaco-diff-root .monaco-diff-editor .editor.original .current-line {
|
|
1457
1774
|
width: var(--stream-monaco-original-margin-width, auto) !important;
|
|
1775
|
+
display: none !important;
|
|
1776
|
+
opacity: 0 !important;
|
|
1777
|
+
pointer-events: none !important;
|
|
1458
1778
|
}
|
|
1459
1779
|
.stream-monaco-diff-root .monaco-diff-editor .editor.original .monaco-scrollable-element.editor-scrollable {
|
|
1460
1780
|
left: var(--stream-monaco-original-scrollable-left, auto) !important;
|
|
@@ -1467,6 +1787,9 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
1467
1787
|
}
|
|
1468
1788
|
.stream-monaco-diff-root .monaco-diff-editor .editor.modified .current-line {
|
|
1469
1789
|
width: var(--stream-monaco-modified-margin-width) !important;
|
|
1790
|
+
display: none !important;
|
|
1791
|
+
opacity: 0 !important;
|
|
1792
|
+
pointer-events: none !important;
|
|
1470
1793
|
}
|
|
1471
1794
|
.stream-monaco-diff-root .monaco-diff-editor .editor.modified .monaco-scrollable-element.editor-scrollable {
|
|
1472
1795
|
left: var(--stream-monaco-modified-scrollable-left, var(--stream-monaco-modified-margin-width)) !important;
|
|
@@ -1497,15 +1820,39 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
1497
1820
|
border: 0 !important;
|
|
1498
1821
|
overflow: hidden !important;
|
|
1499
1822
|
}
|
|
1823
|
+
.stream-monaco-diff-root.stream-monaco-diff-inline .monaco-diff-editor .editor.original .monaco-editor,
|
|
1824
|
+
.stream-monaco-diff-root.stream-monaco-diff-inline .monaco-diff-editor .editor.original .monaco-editor-background,
|
|
1825
|
+
.stream-monaco-diff-root.stream-monaco-diff-inline .monaco-diff-editor .editor.original .lines-content {
|
|
1826
|
+
width: 0 !important;
|
|
1827
|
+
min-width: 0 !important;
|
|
1828
|
+
background: transparent !important;
|
|
1829
|
+
opacity: 0 !important;
|
|
1830
|
+
pointer-events: none !important;
|
|
1831
|
+
}
|
|
1500
1832
|
.stream-monaco-diff-root.stream-monaco-diff-inline .monaco-diff-editor .editor.original .monaco-scrollable-element.editor-scrollable {
|
|
1501
1833
|
left: 0 !important;
|
|
1502
1834
|
width: 0 !important;
|
|
1503
1835
|
}
|
|
1836
|
+
.stream-monaco-diff-root.stream-monaco-diff-inline .monaco-diff-editor .editor.original .margin,
|
|
1837
|
+
.stream-monaco-diff-root.stream-monaco-diff-inline .monaco-diff-editor .editor.original .margin-view-overlays,
|
|
1838
|
+
.stream-monaco-diff-root.stream-monaco-diff-inline .monaco-diff-editor .editor.original .margin-view-zones,
|
|
1839
|
+
.stream-monaco-diff-root.stream-monaco-diff-inline .monaco-diff-editor .editor.original .overflow-guard {
|
|
1840
|
+
display: none !important;
|
|
1841
|
+
width: 0 !important;
|
|
1842
|
+
min-width: 0 !important;
|
|
1843
|
+
}
|
|
1504
1844
|
.stream-monaco-diff-root.stream-monaco-diff-inline .monaco-diff-editor .editor.modified {
|
|
1505
1845
|
left: 0 !important;
|
|
1506
1846
|
width: 100% !important;
|
|
1507
1847
|
border-left: 0 !important;
|
|
1508
1848
|
}
|
|
1849
|
+
.stream-monaco-diff-root.stream-monaco-diff-inline.stream-monaco-diff-native-stale .monaco-diff-editor .editor.modified .view-lines.line-delete,
|
|
1850
|
+
.stream-monaco-diff-root.stream-monaco-diff-inline.stream-monaco-diff-native-stale .monaco-diff-editor .editor.modified .inline-deleted-margin-view-zone {
|
|
1851
|
+
display: none !important;
|
|
1852
|
+
height: 0 !important;
|
|
1853
|
+
min-height: 0 !important;
|
|
1854
|
+
overflow: hidden !important;
|
|
1855
|
+
}
|
|
1509
1856
|
.stream-monaco-diff-root.stream-monaco-diff-inline .monaco-diff-editor .editor.original .gutter-delete,
|
|
1510
1857
|
.stream-monaco-diff-root.stream-monaco-diff-inline .monaco-diff-editor .editor.original .gutter-insert,
|
|
1511
1858
|
.stream-monaco-diff-root.stream-monaco-diff-inline .monaco-diff-editor .editor.original .line-delete,
|
|
@@ -2095,6 +2442,9 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
2095
2442
|
opacity: 0.92 !important;
|
|
2096
2443
|
transition: background-color 0.14s ease, border-color 0.14s ease, transform 0.14s ease, opacity 0.14s ease, box-shadow 0.14s ease;
|
|
2097
2444
|
}
|
|
2445
|
+
.stream-monaco-diff-root .monaco-editor .fold-unchanged.stream-monaco-fold-unchanged-hidden {
|
|
2446
|
+
display: none !important;
|
|
2447
|
+
}
|
|
2098
2448
|
.stream-monaco-diff-root .monaco-editor .fold-unchanged:hover,
|
|
2099
2449
|
.stream-monaco-diff-root .monaco-editor .fold-unchanged.stream-monaco-focus-visible {
|
|
2100
2450
|
opacity: 1 !important;
|
|
@@ -2192,6 +2542,8 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
2192
2542
|
}
|
|
2193
2543
|
capturePersistedDiffUnchangedState() {
|
|
2194
2544
|
if (!this.diffEditorView) return;
|
|
2545
|
+
const hideUnchangedRegions = this.diffHideUnchangedRegionsResolved ?? this.resolveDiffHideUnchangedRegionsOption();
|
|
2546
|
+
if (!(hideUnchangedRegions === null || hideUnchangedRegions === void 0 ? void 0 : hideUnchangedRegions.enabled) || this.diffHideUnchangedRegionsDeferred) return;
|
|
2195
2547
|
const state = this.diffEditorView.saveViewState();
|
|
2196
2548
|
if (!(state === null || state === void 0 ? void 0 : state.modelState)) {
|
|
2197
2549
|
this.diffPersistedUnchangedModelState = null;
|
|
@@ -2199,6 +2551,14 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
2199
2551
|
}
|
|
2200
2552
|
this.diffPersistedUnchangedModelState = this.cloneSerializableValue(state.modelState);
|
|
2201
2553
|
}
|
|
2554
|
+
capturePreviousDiffUnchangedState() {
|
|
2555
|
+
if (!this.diffEditorView) return;
|
|
2556
|
+
const hideUnchangedRegions = this.diffHideUnchangedRegionsResolved ?? this.resolveDiffHideUnchangedRegionsOption();
|
|
2557
|
+
if (!(hideUnchangedRegions === null || hideUnchangedRegions === void 0 ? void 0 : hideUnchangedRegions.enabled) || this.diffHideUnchangedRegionsDeferred) return;
|
|
2558
|
+
const state = this.diffEditorView.saveViewState();
|
|
2559
|
+
if (!(state === null || state === void 0 ? void 0 : state.modelState)) return;
|
|
2560
|
+
this.diffPreviousUnchangedModelState = this.cloneSerializableValue(state.modelState);
|
|
2561
|
+
}
|
|
2202
2562
|
scheduleCapturePersistedDiffUnchangedState(frames = 1) {
|
|
2203
2563
|
this.rafScheduler.schedule("capture-diff-unchanged-state", () => {
|
|
2204
2564
|
let remaining = Math.max(0, frames);
|
|
@@ -2224,6 +2584,20 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
2224
2584
|
});
|
|
2225
2585
|
this.applyPendingDiffScrollRestore();
|
|
2226
2586
|
}
|
|
2587
|
+
restorePreviousDiffUnchangedState() {
|
|
2588
|
+
if (!this.diffEditorView || !this.diffPreviousUnchangedModelState) return false;
|
|
2589
|
+
const current = this.diffEditorView.saveViewState();
|
|
2590
|
+
if (!current) return false;
|
|
2591
|
+
const previous = this.cloneSerializableValue(this.diffPreviousUnchangedModelState);
|
|
2592
|
+
this.diffEditorView.restoreViewState({
|
|
2593
|
+
original: current.original,
|
|
2594
|
+
modified: current.modified,
|
|
2595
|
+
modelState: previous
|
|
2596
|
+
});
|
|
2597
|
+
this.diffPersistedUnchangedModelState = this.cloneSerializableValue(previous);
|
|
2598
|
+
this.applyPendingDiffScrollRestore();
|
|
2599
|
+
return true;
|
|
2600
|
+
}
|
|
2227
2601
|
scheduleRestorePersistedDiffUnchangedState() {
|
|
2228
2602
|
if (this.diffHideUnchangedRegionsDeferred) return;
|
|
2229
2603
|
if (!this.diffPersistedUnchangedModelState) return;
|
|
@@ -2387,7 +2761,7 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
2387
2761
|
readOnly: this.options.readOnly ?? true,
|
|
2388
2762
|
lineDecorationsWidth: this.options.lineDecorationsWidth,
|
|
2389
2763
|
lineNumbersMinChars: this.options.lineNumbersMinChars,
|
|
2390
|
-
glyphMargin: this.
|
|
2764
|
+
glyphMargin: this.resolveDiffGlyphMarginOption(hideUnchangedRegions),
|
|
2391
2765
|
fontFamily: this.options.fontFamily,
|
|
2392
2766
|
fontSize: this.options.fontSize,
|
|
2393
2767
|
lineHeight: this.options.lineHeight,
|
|
@@ -2407,9 +2781,10 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
2407
2781
|
};
|
|
2408
2782
|
}
|
|
2409
2783
|
refreshDiffPresentation() {
|
|
2410
|
-
var _this$diffHeightManag;
|
|
2784
|
+
var _this$diffHideUnchang, _this$diffHeightManag;
|
|
2411
2785
|
if (!this.diffEditorView) return;
|
|
2412
2786
|
const hideUnchangedRegions = this.resolveDiffHideUnchangedRegionsOption();
|
|
2787
|
+
const shouldRecomputeDiffViewModelForUnchangedRegions = !this.diffHideUnchangedRegionsDeferred && (hideUnchangedRegions === null || hideUnchangedRegions === void 0 ? void 0 : hideUnchangedRegions.enabled) === true && ((_this$diffHideUnchang = this.diffHideUnchangedRegionsResolved) === null || _this$diffHideUnchang === void 0 ? void 0 : _this$diffHideUnchang.enabled) === false && !!this.originalModel && !!this.modifiedModel;
|
|
2413
2788
|
const presentationOptions = this.resolveDiffPresentationEditorOptions(hideUnchangedRegions);
|
|
2414
2789
|
this.diffHideUnchangedRegionsResolved = hideUnchangedRegions;
|
|
2415
2790
|
this.diffUpdateThrottleMs = this.resolveDiffStreamingThrottleMs();
|
|
@@ -2419,13 +2794,20 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
2419
2794
|
this.lastContainer.style.removeProperty("--stream-monaco-editor-fg");
|
|
2420
2795
|
}
|
|
2421
2796
|
this.withLockedDiffScrollPosition(() => {
|
|
2422
|
-
var _this$
|
|
2423
|
-
(_this$
|
|
2797
|
+
var _this$diffEditorView14;
|
|
2798
|
+
(_this$diffEditorView14 = this.diffEditorView) === null || _this$diffEditorView14 === void 0 || _this$diffEditorView14.updateOptions(presentationOptions);
|
|
2424
2799
|
});
|
|
2425
2800
|
(_this$diffHeightManag = this.diffHeightManager) === null || _this$diffHeightManag === void 0 || _this$diffHeightManag.update();
|
|
2426
2801
|
this.applyDiffRootAppearanceClass();
|
|
2427
2802
|
this.schedulePatchDiffUnchangedRegionsAfterInteraction(1);
|
|
2428
2803
|
this.repositionDiffHunkNodes();
|
|
2804
|
+
if (shouldRecomputeDiffViewModelForUnchangedRegions) this.setDiffModels({
|
|
2805
|
+
original: this.originalModel,
|
|
2806
|
+
modified: this.modifiedModel
|
|
2807
|
+
}, {
|
|
2808
|
+
preserveViewState: true,
|
|
2809
|
+
preserveModelState: false
|
|
2810
|
+
});
|
|
2429
2811
|
}
|
|
2430
2812
|
restoreDeferredDiffUnchangedRegions() {
|
|
2431
2813
|
this.clearDeferredDiffUnchangedRegionsIdleTimer();
|
|
@@ -2435,8 +2817,8 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
2435
2817
|
if (!this.diffHideUnchangedRegionsDeferred) return;
|
|
2436
2818
|
this.diffHideUnchangedRegionsDeferred = false;
|
|
2437
2819
|
this.withLockedDiffScrollPosition(() => {
|
|
2438
|
-
var _this$
|
|
2439
|
-
(_this$
|
|
2820
|
+
var _this$diffEditorView15;
|
|
2821
|
+
(_this$diffEditorView15 = this.diffEditorView) === null || _this$diffEditorView15 === void 0 || _this$diffEditorView15.updateOptions({ hideUnchangedRegions });
|
|
2440
2822
|
});
|
|
2441
2823
|
this.schedulePatchDiffUnchangedRegionsAfterInteraction(1);
|
|
2442
2824
|
if (this.shouldAutoScrollDiff) {
|
|
@@ -2445,6 +2827,22 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
2445
2827
|
}
|
|
2446
2828
|
}
|
|
2447
2829
|
markDiffStreamingActivity() {
|
|
2830
|
+
var _this$lastContainer6;
|
|
2831
|
+
(_this$lastContainer6 = this.lastContainer) === null || _this$lastContainer6 === void 0 || _this$lastContainer6.classList.remove("stream-monaco-diff-inline-native-ready");
|
|
2832
|
+
if (this.isDiffInlineMode()) {
|
|
2833
|
+
var _this$diffHeightManag2, _this$lastContainer7, _this$lastContainer7$;
|
|
2834
|
+
this.inlineDiffStreamingPresentationActive = true;
|
|
2835
|
+
this.inlineDiffStreamingHeightFloor = Math.max(this.inlineDiffStreamingHeightFloor, ((_this$diffHeightManag2 = this.diffHeightManager) === null || _this$diffHeightManag2 === void 0 ? void 0 : _this$diffHeightManag2.getLastApplied()) ?? 0, ((_this$lastContainer7 = this.lastContainer) === null || _this$lastContainer7 === void 0 || (_this$lastContainer7$ = _this$lastContainer7.getBoundingClientRect) === null || _this$lastContainer7$ === void 0 ? void 0 : _this$lastContainer7$.call(_this$lastContainer7).height) ?? 0);
|
|
2836
|
+
this.clearInlineDiffStreamingPresentationIdleTimer();
|
|
2837
|
+
this.inlineDiffStreamingPresentationIdleTimer = setTimeout(() => {
|
|
2838
|
+
var _this$diffHeightManag3;
|
|
2839
|
+
this.inlineDiffStreamingPresentationIdleTimer = null;
|
|
2840
|
+
this.inlineDiffStreamingPresentationActive = false;
|
|
2841
|
+
this.resetInlineDiffStreamingHeightFloor();
|
|
2842
|
+
this.scheduleSyncDiffPresentationDecorations();
|
|
2843
|
+
(_this$diffHeightManag3 = this.diffHeightManager) === null || _this$diffHeightManag3 === void 0 || _this$diffHeightManag3.update();
|
|
2844
|
+
}, 3e3);
|
|
2845
|
+
}
|
|
2448
2846
|
const hideUnchangedRegions = this.diffHideUnchangedRegionsResolved;
|
|
2449
2847
|
if (!this.diffEditorView || !(hideUnchangedRegions === null || hideUnchangedRegions === void 0 ? void 0 : hideUnchangedRegions.enabled)) return;
|
|
2450
2848
|
this.clearDeferredDiffUnchangedRegionsIdleTimer();
|
|
@@ -2456,8 +2854,8 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
2456
2854
|
this.diffHideUnchangedRegionsDeferred = true;
|
|
2457
2855
|
this.hideAllDiffUnchangedBridgeEntries();
|
|
2458
2856
|
this.withLockedDiffScrollPosition(() => {
|
|
2459
|
-
var _this$
|
|
2460
|
-
(_this$
|
|
2857
|
+
var _this$diffEditorView16;
|
|
2858
|
+
(_this$diffEditorView16 = this.diffEditorView) === null || _this$diffEditorView16 === void 0 || _this$diffEditorView16.updateOptions({ hideUnchangedRegions: {
|
|
2461
2859
|
...hideUnchangedRegions,
|
|
2462
2860
|
enabled: false
|
|
2463
2861
|
} });
|
|
@@ -2555,8 +2953,8 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
2555
2953
|
return this.diffUnchangedBridgeOverlay;
|
|
2556
2954
|
}
|
|
2557
2955
|
readDiffUnchangedOverlayScrollState() {
|
|
2558
|
-
var _this$
|
|
2559
|
-
const modifiedEditor = (_this$
|
|
2956
|
+
var _this$diffEditorView17, _modifiedEditor$getSc6, _modifiedEditor$getSc7;
|
|
2957
|
+
const modifiedEditor = (_this$diffEditorView17 = this.diffEditorView) === null || _this$diffEditorView17 === void 0 ? void 0 : _this$diffEditorView17.getModifiedEditor();
|
|
2560
2958
|
return {
|
|
2561
2959
|
top: (modifiedEditor === null || modifiedEditor === void 0 || (_modifiedEditor$getSc6 = modifiedEditor.getScrollTop) === null || _modifiedEditor$getSc6 === void 0 ? void 0 : _modifiedEditor$getSc6.call(modifiedEditor)) ?? 0,
|
|
2562
2960
|
left: (modifiedEditor === null || modifiedEditor === void 0 || (_modifiedEditor$getSc7 = modifiedEditor.getScrollLeft) === null || _modifiedEditor$getSc7 === void 0 ? void 0 : _modifiedEditor$getSc7.call(modifiedEditor)) ?? 0
|
|
@@ -2913,7 +3311,7 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
2913
3311
|
this.scheduleCapturePersistedDiffUnchangedState(1);
|
|
2914
3312
|
}
|
|
2915
3313
|
resolveDiffUnchangedRevealLayout(primaryNode, countText, pairIndex, pairCount) {
|
|
2916
|
-
var _this$
|
|
3314
|
+
var _this$diffEditorView18, _this$diffEditorView19;
|
|
2917
3315
|
let showTopHandle = pairCount === 1 || pairIndex > 0;
|
|
2918
3316
|
let showBottomHandle = pairCount === 1 || pairIndex < pairCount - 1;
|
|
2919
3317
|
const countMatch = countText.match(/\d+/);
|
|
@@ -2943,7 +3341,7 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
2943
3341
|
showTopHandle = false;
|
|
2944
3342
|
showBottomHandle = true;
|
|
2945
3343
|
}
|
|
2946
|
-
const modelLineCount = ((_this$
|
|
3344
|
+
const modelLineCount = ((_this$diffEditorView18 = this.diffEditorView) === null || _this$diffEditorView18 === void 0 || (_this$diffEditorView18 = _this$diffEditorView18.getModifiedEditor().getModel()) === null || _this$diffEditorView18 === void 0 || (_this$diffEditorView19 = _this$diffEditorView18.getLineCount) === null || _this$diffEditorView19 === void 0 ? void 0 : _this$diffEditorView19.call(_this$diffEditorView18)) ?? null;
|
|
2947
3345
|
if (previousVisibleLine != null && modelLineCount != null && previousVisibleLine + hiddenCount === modelLineCount) {
|
|
2948
3346
|
showTopHandle = true;
|
|
2949
3347
|
showBottomHandle = false;
|
|
@@ -2954,13 +3352,13 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
2954
3352
|
};
|
|
2955
3353
|
}
|
|
2956
3354
|
resolveDiffUnchangedMergeRole(node) {
|
|
2957
|
-
var _this$
|
|
3355
|
+
var _this$diffEditorView20, _this$diffEditorView21, _this$diffEditorView22, _this$diffEditorView23, _this$diffEditorView24, _this$diffEditorView25;
|
|
2958
3356
|
const diffRoot = node.closest(".monaco-diff-editor.side-by-side");
|
|
2959
3357
|
if (!(diffRoot instanceof HTMLElement)) return "none";
|
|
2960
3358
|
const nodeRect = node.getBoundingClientRect();
|
|
2961
3359
|
const nodeCenter = nodeRect.left + nodeRect.width / 2;
|
|
2962
|
-
const originalHost = (_this$
|
|
2963
|
-
const modifiedHost = (_this$
|
|
3360
|
+
const originalHost = (_this$diffEditorView20 = this.diffEditorView) === null || _this$diffEditorView20 === void 0 || (_this$diffEditorView22 = (_this$diffEditorView21 = _this$diffEditorView20.getOriginalEditor()).getContainerDomNode) === null || _this$diffEditorView22 === void 0 ? void 0 : _this$diffEditorView22.call(_this$diffEditorView21);
|
|
3361
|
+
const modifiedHost = (_this$diffEditorView23 = this.diffEditorView) === null || _this$diffEditorView23 === void 0 || (_this$diffEditorView25 = (_this$diffEditorView24 = _this$diffEditorView23.getModifiedEditor()).getContainerDomNode) === null || _this$diffEditorView25 === void 0 ? void 0 : _this$diffEditorView25.call(_this$diffEditorView24);
|
|
2964
3362
|
if (originalHost instanceof HTMLElement && modifiedHost instanceof HTMLElement) {
|
|
2965
3363
|
const originalRect = originalHost.getBoundingClientRect();
|
|
2966
3364
|
const modifiedRect = modifiedHost.getBoundingClientRect();
|
|
@@ -3000,6 +3398,11 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
3000
3398
|
action.tabIndex = shouldUseMergedSecondary ? -1 : 0;
|
|
3001
3399
|
if (action.dataset.streamMonacoExpandPatched !== "true") {
|
|
3002
3400
|
action.dataset.streamMonacoExpandPatched = "true";
|
|
3401
|
+
const handleCaptureExpand = () => {
|
|
3402
|
+
this.capturePreviousDiffUnchangedState();
|
|
3403
|
+
};
|
|
3404
|
+
action.addEventListener("click", handleCaptureExpand, { capture: true });
|
|
3405
|
+
this.diffUnchangedRegionDisposables.push({ dispose: () => action.removeEventListener("click", handleCaptureExpand, true) });
|
|
3003
3406
|
this.createDomDisposable(this.diffUnchangedRegionDisposables, action, "click", () => {
|
|
3004
3407
|
this.hideAllDiffUnchangedBridgeEntries();
|
|
3005
3408
|
this.scheduleCapturePersistedDiffUnchangedState(1);
|
|
@@ -3012,7 +3415,10 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
3012
3415
|
this.bindFocusWithinClass(this.diffUnchangedRegionDisposables, node, "stream-monaco-focus-within");
|
|
3013
3416
|
const activate = () => {
|
|
3014
3417
|
const action$1 = node.querySelector("a");
|
|
3015
|
-
if (action$1 instanceof HTMLElement)
|
|
3418
|
+
if (action$1 instanceof HTMLElement) {
|
|
3419
|
+
this.capturePreviousDiffUnchangedState();
|
|
3420
|
+
action$1.click();
|
|
3421
|
+
}
|
|
3016
3422
|
};
|
|
3017
3423
|
this.createDomDisposable(this.diffUnchangedRegionDisposables, node, "click", (event) => {
|
|
3018
3424
|
const mouseEvent = event;
|
|
@@ -3106,6 +3512,7 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
3106
3512
|
entry.activate = () => {
|
|
3107
3513
|
const action = primaryNode.querySelector("a, button") ?? secondaryNode.querySelector("a, button");
|
|
3108
3514
|
if (action instanceof HTMLElement) {
|
|
3515
|
+
this.capturePreviousDiffUnchangedState();
|
|
3109
3516
|
action.click();
|
|
3110
3517
|
this.scheduleCapturePersistedDiffUnchangedState(1);
|
|
3111
3518
|
}
|
|
@@ -3124,10 +3531,22 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
3124
3531
|
node.title = node.title || "Collapse unchanged lines";
|
|
3125
3532
|
this.bindFocusVisibleClass(this.diffUnchangedRegionDisposables, node);
|
|
3126
3533
|
this.bindPersistOnMouseRelease(this.diffUnchangedRegionDisposables, node);
|
|
3534
|
+
this.createDomDisposable(this.diffUnchangedRegionDisposables, node, "mouseup", (event) => {
|
|
3535
|
+
const mouseEvent = event;
|
|
3536
|
+
if (mouseEvent.button !== 0) return;
|
|
3537
|
+
if (!this.restorePreviousDiffUnchangedState()) return;
|
|
3538
|
+
event.preventDefault();
|
|
3539
|
+
event.stopPropagation();
|
|
3540
|
+
this.schedulePatchDiffUnchangedRegionsAfterInteraction();
|
|
3541
|
+
});
|
|
3127
3542
|
this.createDomDisposable(this.diffUnchangedRegionDisposables, node, "keydown", (event) => {
|
|
3128
3543
|
const keyboardEvent = event;
|
|
3129
3544
|
if (keyboardEvent.key !== "Enter" && keyboardEvent.key !== " ") return;
|
|
3130
3545
|
keyboardEvent.preventDefault();
|
|
3546
|
+
if (this.restorePreviousDiffUnchangedState()) {
|
|
3547
|
+
this.schedulePatchDiffUnchangedRegionsAfterInteraction();
|
|
3548
|
+
return;
|
|
3549
|
+
}
|
|
3131
3550
|
this.dispatchSyntheticMouseDown(node);
|
|
3132
3551
|
this.scheduleCapturePersistedDiffUnchangedState(1);
|
|
3133
3552
|
});
|
|
@@ -3137,6 +3556,11 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
3137
3556
|
this.applyDiffRootAppearanceClass();
|
|
3138
3557
|
const viewZoneHeightsChanged = this.syncDiffUnchangedViewZoneHeights();
|
|
3139
3558
|
const centers = this.lastContainer.querySelectorAll(".diff-hidden-lines .center");
|
|
3559
|
+
const modifiedHiddenSummaryMidpoints = Array.from(this.lastContainer.querySelectorAll(".editor.modified .diff-hidden-lines .center")).map((node) => {
|
|
3560
|
+
const rect = node.getBoundingClientRect();
|
|
3561
|
+
if (rect.width <= 0 || rect.height <= 0) return null;
|
|
3562
|
+
return rect.top + rect.height / 2;
|
|
3563
|
+
}).filter((value) => value !== null);
|
|
3140
3564
|
Array.from(centers).sort((a, b) => a.getBoundingClientRect().top - b.getBoundingClientRect().top).forEach((node, index) => this.patchDiffUnchangedCenter(node, index));
|
|
3141
3565
|
const partialRevealHandles = this.lastContainer.querySelectorAll(".diff-hidden-lines .top, .diff-hidden-lines .bottom");
|
|
3142
3566
|
partialRevealHandles.forEach((node) => {
|
|
@@ -3161,7 +3585,13 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
3161
3585
|
this.pruneDiffUnchangedBridgeEntries(visibleKeys);
|
|
3162
3586
|
this.syncDiffUnchangedOverlayScrollBaseline();
|
|
3163
3587
|
const foldGlyphs = this.lastContainer.querySelectorAll(".fold-unchanged");
|
|
3164
|
-
foldGlyphs.forEach((node) =>
|
|
3588
|
+
foldGlyphs.forEach((node) => {
|
|
3589
|
+
const rect = node.getBoundingClientRect();
|
|
3590
|
+
const midpoint = rect.top + rect.height / 2;
|
|
3591
|
+
const overlapsHiddenSummary = modifiedHiddenSummaryMidpoints.some((summaryMidpoint) => Math.abs(summaryMidpoint - midpoint) <= 8);
|
|
3592
|
+
node.classList.toggle("stream-monaco-fold-unchanged-hidden", overlapsHiddenSummary);
|
|
3593
|
+
this.patchDiffUnchangedFoldGlyph(node);
|
|
3594
|
+
});
|
|
3165
3595
|
if (viewZoneHeightsChanged) this.schedulePatchDiffUnchangedRegions();
|
|
3166
3596
|
}
|
|
3167
3597
|
schedulePatchDiffUnchangedRegions() {
|
|
@@ -3174,12 +3604,12 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
3174
3604
|
this.schedulePatchDiffUnchangedRegions();
|
|
3175
3605
|
}
|
|
3176
3606
|
setupDiffUnchangedRegionEnhancements() {
|
|
3177
|
-
var _globalThis$
|
|
3607
|
+
var _globalThis$getComput2, _globalThis2;
|
|
3178
3608
|
this.disposeDiffUnchangedRegionEnhancements();
|
|
3179
3609
|
if (!this.diffEditorView || !this.lastContainer) return;
|
|
3180
3610
|
if (typeof document === "undefined") return;
|
|
3181
3611
|
this.ensureDiffUiStyle();
|
|
3182
|
-
const containerStyle = (_globalThis$
|
|
3612
|
+
const containerStyle = (_globalThis$getComput2 = (_globalThis2 = globalThis).getComputedStyle) === null || _globalThis$getComput2 === void 0 ? void 0 : _globalThis$getComput2.call(_globalThis2, this.lastContainer);
|
|
3183
3613
|
if (!containerStyle || containerStyle.position === "static") this.lastContainer.style.position = "relative";
|
|
3184
3614
|
this.applyDiffRootAppearanceClass();
|
|
3185
3615
|
this.schedulePatchDiffUnchangedRegions();
|
|
@@ -3207,6 +3637,20 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
3207
3637
|
this.applyDiffRootAppearanceClass();
|
|
3208
3638
|
this.schedulePatchDiffUnchangedRegions();
|
|
3209
3639
|
};
|
|
3640
|
+
const handleFoldMouseUp = (event) => {
|
|
3641
|
+
var _event$event, _event$target, _event$event2, _event$event2$prevent, _event$event3, _event$event3$stopPro;
|
|
3642
|
+
if (event === null || event === void 0 || (_event$event = event.event) === null || _event$event === void 0 ? void 0 : _event$event.rightButton) return;
|
|
3643
|
+
const targetElement = event === null || event === void 0 || (_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.element;
|
|
3644
|
+
const className = typeof (targetElement === null || targetElement === void 0 ? void 0 : targetElement.className) === "string" ? targetElement.className : "";
|
|
3645
|
+
if (!className.includes("fold-unchanged")) return;
|
|
3646
|
+
if (!this.diffPreviousUnchangedModelState) return;
|
|
3647
|
+
event === null || event === void 0 || (_event$event2 = event.event) === null || _event$event2 === void 0 || (_event$event2$prevent = _event$event2.preventDefault) === null || _event$event2$prevent === void 0 || _event$event2$prevent.call(_event$event2);
|
|
3648
|
+
event === null || event === void 0 || (_event$event3 = event.event) === null || _event$event3 === void 0 || (_event$event3$stopPro = _event$event3.stopPropagation) === null || _event$event3$stopPro === void 0 || _event$event3$stopPro.call(_event$event3);
|
|
3649
|
+
requestAnimationFrame(() => {
|
|
3650
|
+
if (!this.restorePreviousDiffUnchangedState()) return;
|
|
3651
|
+
this.schedulePatchDiffUnchangedRegionsAfterInteraction();
|
|
3652
|
+
});
|
|
3653
|
+
};
|
|
3210
3654
|
this.diffUnchangedRegionDisposables.push(this.diffEditorView.onDidUpdateDiff(() => {
|
|
3211
3655
|
repatch();
|
|
3212
3656
|
this.scheduleRestorePersistedDiffUnchangedState();
|
|
@@ -3215,16 +3659,18 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
3215
3659
|
this.diffUnchangedRegionDisposables.push(modifiedEditor.onDidLayoutChange(repatch));
|
|
3216
3660
|
this.diffUnchangedRegionDisposables.push(originalEditor.onDidScrollChange(() => this.schedulePatchDiffUnchangedRegionsAfterScroll()));
|
|
3217
3661
|
this.diffUnchangedRegionDisposables.push(modifiedEditor.onDidScrollChange(() => this.schedulePatchDiffUnchangedRegionsAfterScroll()));
|
|
3662
|
+
this.diffUnchangedRegionDisposables.push(originalEditor.onMouseUp(handleFoldMouseUp));
|
|
3663
|
+
this.diffUnchangedRegionDisposables.push(modifiedEditor.onMouseUp(handleFoldMouseUp));
|
|
3218
3664
|
this.createDomDisposable(this.diffUnchangedRegionDisposables, this.lastContainer, "scroll", () => this.schedulePatchDiffUnchangedRegionsAfterScroll());
|
|
3219
3665
|
}
|
|
3220
3666
|
setupDiffHunkInteractions() {
|
|
3221
|
-
var _globalThis$
|
|
3667
|
+
var _globalThis$getComput3, _globalThis3;
|
|
3222
3668
|
this.disposeDiffHunkInteractions();
|
|
3223
3669
|
if (!this.diffEditorView || !this.lastContainer) return;
|
|
3224
3670
|
if (this.options.diffHunkActionsOnHover !== true) return;
|
|
3225
3671
|
if (typeof document === "undefined") return;
|
|
3226
3672
|
this.ensureDiffUiStyle();
|
|
3227
|
-
const containerStyle = (_globalThis$
|
|
3673
|
+
const containerStyle = (_globalThis$getComput3 = (_globalThis3 = globalThis).getComputedStyle) === null || _globalThis$getComput3 === void 0 ? void 0 : _globalThis$getComput3.call(_globalThis3, this.lastContainer);
|
|
3228
3674
|
if (!containerStyle || containerStyle.position === "static") this.lastContainer.style.position = "relative";
|
|
3229
3675
|
const overlay = document.createElement("div");
|
|
3230
3676
|
overlay.className = "stream-monaco-diff-hunk-overlay";
|
|
@@ -3336,15 +3782,15 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
3336
3782
|
this.repositionDiffHunkNodes();
|
|
3337
3783
|
}
|
|
3338
3784
|
isOriginalEditorCollapsed() {
|
|
3339
|
-
var _this$diffEditorView$
|
|
3785
|
+
var _this$diffEditorView$4, _this$diffEditorView$5;
|
|
3340
3786
|
if (!this.diffEditorView) return true;
|
|
3341
|
-
const info = (_this$diffEditorView$
|
|
3787
|
+
const info = (_this$diffEditorView$4 = (_this$diffEditorView$5 = this.diffEditorView.getOriginalEditor()).getLayoutInfo) === null || _this$diffEditorView$4 === void 0 ? void 0 : _this$diffEditorView$4.call(_this$diffEditorView$5);
|
|
3342
3788
|
return !info || info.width < 24;
|
|
3343
3789
|
}
|
|
3344
3790
|
isDiffInlineMode() {
|
|
3345
|
-
var _this$
|
|
3346
|
-
const diffRoot = (_this$
|
|
3347
|
-
if (diffRoot instanceof HTMLElement) return !diffRoot.classList.contains("side-by-side");
|
|
3791
|
+
var _this$lastContainer8, _this$lastContainer9;
|
|
3792
|
+
const diffRoot = typeof ((_this$lastContainer8 = this.lastContainer) === null || _this$lastContainer8 === void 0 ? void 0 : _this$lastContainer8.querySelector) === "function" ? (_this$lastContainer9 = this.lastContainer) === null || _this$lastContainer9 === void 0 ? void 0 : _this$lastContainer9.querySelector(".monaco-diff-editor") : null;
|
|
3793
|
+
if (typeof HTMLElement !== "undefined" && diffRoot instanceof HTMLElement) return !diffRoot.classList.contains("side-by-side");
|
|
3348
3794
|
return this.isOriginalEditorCollapsed();
|
|
3349
3795
|
}
|
|
3350
3796
|
getEditorBySide(side) {
|
|
@@ -3392,8 +3838,8 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
3392
3838
|
if (!this.diffEditorView || !viewState) return;
|
|
3393
3839
|
const restore = () => {
|
|
3394
3840
|
try {
|
|
3395
|
-
var _this$
|
|
3396
|
-
(_this$
|
|
3841
|
+
var _this$diffEditorView26;
|
|
3842
|
+
(_this$diffEditorView26 = this.diffEditorView) === null || _this$diffEditorView26 === void 0 || _this$diffEditorView26.restoreViewState(viewState);
|
|
3397
3843
|
} catch {}
|
|
3398
3844
|
};
|
|
3399
3845
|
restore();
|
|
@@ -3411,7 +3857,7 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
3411
3857
|
this.pendingPreparedDiffViewModel = null;
|
|
3412
3858
|
}
|
|
3413
3859
|
syncDiffKnownValues() {
|
|
3414
|
-
var _this$
|
|
3860
|
+
var _this$diffEditorView27, _this$diffEditorView28, _this$diffEditorView29, _this$diffHeightManag4;
|
|
3415
3861
|
if (this.originalModel) this.lastKnownOriginalCode = this.originalModel.getValue();
|
|
3416
3862
|
if (this.modifiedModel) {
|
|
3417
3863
|
this.lastKnownModifiedCode = this.modifiedModel.getValue();
|
|
@@ -3420,8 +3866,8 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
3420
3866
|
this.lastKnownModifiedDirty = false;
|
|
3421
3867
|
this._hasScrollBar = false;
|
|
3422
3868
|
this.cachedComputedHeightDiff = this.computedHeight();
|
|
3423
|
-
this.cachedScrollHeightDiff = ((_this$
|
|
3424
|
-
(_this$
|
|
3869
|
+
this.cachedScrollHeightDiff = ((_this$diffEditorView27 = this.diffEditorView) === null || _this$diffEditorView27 === void 0 || (_this$diffEditorView29 = (_this$diffEditorView28 = _this$diffEditorView27.getModifiedEditor()).getScrollHeight) === null || _this$diffEditorView29 === void 0 ? void 0 : _this$diffEditorView29.call(_this$diffEditorView28)) ?? this.cachedScrollHeightDiff;
|
|
3870
|
+
(_this$diffHeightManag4 = this.diffHeightManager) === null || _this$diffHeightManag4 === void 0 || _this$diffHeightManag4.update();
|
|
3425
3871
|
}
|
|
3426
3872
|
applyDefaultDiffHunkAction(context) {
|
|
3427
3873
|
const { action, side, lineChange } = context;
|
|
@@ -3602,26 +4048,52 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
3602
4048
|
const text = this.appendBufferOriginalDiff.join("");
|
|
3603
4049
|
this.appendBufferOriginalDiff.length = 0;
|
|
3604
4050
|
if (!text) return;
|
|
4051
|
+
this.preserveNativeDiffDecorationsOnStaleAppend = true;
|
|
3605
4052
|
this.appendToModel(this.originalModel, text);
|
|
3606
4053
|
}
|
|
3607
|
-
|
|
3608
|
-
var _originalEditor$getMo, _modifiedEditor$
|
|
4054
|
+
computeRawHeight() {
|
|
4055
|
+
var _originalEditor$getMo, _modifiedEditor$getMo2, _originalEditor$getSc5, _modifiedEditor$getSc10;
|
|
3609
4056
|
if (!this.diffEditorView) return Math.min(1 * 18 + padding, this.maxHeightValue);
|
|
3610
4057
|
const modifiedEditor = this.diffEditorView.getModifiedEditor();
|
|
3611
4058
|
const originalEditor = this.diffEditorView.getOriginalEditor();
|
|
3612
4059
|
const lineHeight = modifiedEditor.getOption(monaco_shim_exports.editor.EditorOption.lineHeight);
|
|
3613
4060
|
const oCount = ((_originalEditor$getMo = originalEditor.getModel()) === null || _originalEditor$getMo === void 0 ? void 0 : _originalEditor$getMo.getLineCount()) ?? 1;
|
|
3614
|
-
const mCount = ((_modifiedEditor$
|
|
4061
|
+
const mCount = ((_modifiedEditor$getMo2 = modifiedEditor.getModel()) === null || _modifiedEditor$getMo2 === void 0 ? void 0 : _modifiedEditor$getMo2.getLineCount()) ?? 1;
|
|
3615
4062
|
const lineCount = Math.max(oCount, mCount);
|
|
3616
4063
|
const fromLines = lineCount * lineHeight + padding;
|
|
3617
4064
|
const scrollH = Math.max(((_originalEditor$getSc5 = originalEditor.getScrollHeight) === null || _originalEditor$getSc5 === void 0 ? void 0 : _originalEditor$getSc5.call(originalEditor)) ?? 0, ((_modifiedEditor$getSc10 = modifiedEditor.getScrollHeight) === null || _modifiedEditor$getSc10 === void 0 ? void 0 : _modifiedEditor$getSc10.call(modifiedEditor)) ?? 0);
|
|
3618
4065
|
const desired = Math.max(fromLines, scrollH);
|
|
3619
4066
|
return Math.min(desired, this.maxHeightValue);
|
|
3620
4067
|
}
|
|
4068
|
+
computedHeight() {
|
|
4069
|
+
const rawHeight = this.computeRawHeight();
|
|
4070
|
+
if (!this.isDiffInlineMode()) return rawHeight;
|
|
4071
|
+
if (!this.inlineDiffStreamingPresentationActive && this.inlineDiffStreamingHeightFloor <= 0) return rawHeight;
|
|
4072
|
+
const lockedHeight = Math.max(rawHeight, this.inlineDiffStreamingHeightFloor);
|
|
4073
|
+
this.inlineDiffStreamingHeightFloor = lockedHeight;
|
|
4074
|
+
return lockedHeight;
|
|
4075
|
+
}
|
|
4076
|
+
eagerlyGrowDiffContainerHeight() {
|
|
4077
|
+
var _this$lastContainer$g, _this$lastContainer10;
|
|
4078
|
+
if (!this.lastContainer) return;
|
|
4079
|
+
const next = this.computedHeight();
|
|
4080
|
+
if (!Number.isFinite(next) || next <= 0) return;
|
|
4081
|
+
const applied = Number.parseFloat(this.lastContainer.style.height || "0") || 0;
|
|
4082
|
+
const measured = ((_this$lastContainer$g = (_this$lastContainer10 = this.lastContainer).getBoundingClientRect) === null || _this$lastContainer$g === void 0 ? void 0 : _this$lastContainer$g.call(_this$lastContainer10).height) ?? this.lastContainer.clientHeight ?? 0;
|
|
4083
|
+
const baseline = Math.max(applied, measured);
|
|
4084
|
+
if (next <= baseline + 1) return;
|
|
4085
|
+
this.lastContainer.style.height = `${next}px`;
|
|
4086
|
+
this.cachedComputedHeightDiff = next;
|
|
4087
|
+
this.scheduleSyncDiffEditorLayoutToContainer();
|
|
4088
|
+
}
|
|
3621
4089
|
isOverflowAutoDiff() {
|
|
3622
4090
|
if (!this.lastContainer) return false;
|
|
3623
4091
|
return this.computedHeight() >= this.maxHeightValue - 1;
|
|
3624
4092
|
}
|
|
4093
|
+
shouldAvoidOptimisticMaxHeightWriteDiff() {
|
|
4094
|
+
const hideUnchangedRegions = this.diffHideUnchangedRegionsResolved;
|
|
4095
|
+
return this.isDiffInlineMode() && (hideUnchangedRegions === null || hideUnchangedRegions === void 0 ? void 0 : hideUnchangedRegions.enabled) === true && !this.diffHideUnchangedRegionsDeferred;
|
|
4096
|
+
}
|
|
3625
4097
|
shouldPerformImmediateRevealDiff() {
|
|
3626
4098
|
return this.autoScrollOnUpdate && this.shouldAutoScrollDiff && !this.diffHideUnchangedRegionsDeferred && this.hasVerticalScrollbarModified() && this.isOverflowAutoDiff();
|
|
3627
4099
|
}
|
|
@@ -3766,9 +4238,8 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
3766
4238
|
lastRevealLineDiff: this.lastRevealLineDiff
|
|
3767
4239
|
});
|
|
3768
4240
|
try {
|
|
3769
|
-
var _this$
|
|
3770
|
-
this.
|
|
3771
|
-
this.lastScrollTopDiff = ((_this$diffEditorView29 = this.diffEditorView) === null || _this$diffEditorView29 === void 0 || (_this$diffEditorView31 = (_this$diffEditorView30 = _this$diffEditorView29.getModifiedEditor()).getScrollTop) === null || _this$diffEditorView31 === void 0 ? void 0 : _this$diffEditorView31.call(_this$diffEditorView30)) ?? this.lastScrollTopDiff;
|
|
4241
|
+
var _this$diffEditorView30, _this$diffEditorView31, _this$diffEditorView32;
|
|
4242
|
+
this.lastScrollTopDiff = ((_this$diffEditorView30 = this.diffEditorView) === null || _this$diffEditorView30 === void 0 || (_this$diffEditorView32 = (_this$diffEditorView31 = _this$diffEditorView30.getModifiedEditor()).getScrollTop) === null || _this$diffEditorView32 === void 0 ? void 0 : _this$diffEditorView32.call(_this$diffEditorView31)) ?? this.lastScrollTopDiff;
|
|
3772
4243
|
} catch {}
|
|
3773
4244
|
});
|
|
3774
4245
|
}
|
|
@@ -3786,11 +4257,6 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
3786
4257
|
line,
|
|
3787
4258
|
ticket
|
|
3788
4259
|
});
|
|
3789
|
-
try {
|
|
3790
|
-
var _this$diffEditorView32, _this$diffEditorView33, _this$diffEditorView34;
|
|
3791
|
-
this.shouldAutoScrollDiff = true;
|
|
3792
|
-
this.lastScrollTopDiff = ((_this$diffEditorView32 = this.diffEditorView) === null || _this$diffEditorView32 === void 0 || (_this$diffEditorView34 = (_this$diffEditorView33 = _this$diffEditorView32.getModifiedEditor()).getScrollTop) === null || _this$diffEditorView34 === void 0 ? void 0 : _this$diffEditorView34.call(_this$diffEditorView33)) ?? this.lastScrollTopDiff;
|
|
3793
|
-
} catch {}
|
|
3794
4260
|
}
|
|
3795
4261
|
scheduleImmediateRevealAfterLayoutDiff(line) {
|
|
3796
4262
|
const ticket = ++this.revealTicketDiff;
|
|
@@ -3799,6 +4265,7 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
3799
4265
|
if (target !== -1 && this.diffHeightManager) {
|
|
3800
4266
|
if (this.lastContainer) this.lastContainer.style.height = `${target}px`;
|
|
3801
4267
|
await this.waitForHeightAppliedDiff(target);
|
|
4268
|
+
this.syncDiffEditorLayoutToContainer();
|
|
3802
4269
|
}
|
|
3803
4270
|
this.performImmediateRevealDiff(line, ticket);
|
|
3804
4271
|
});
|
|
@@ -3822,11 +4289,19 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
3822
4289
|
});
|
|
3823
4290
|
}
|
|
3824
4291
|
async createDiffEditor(container, originalCode, modifiedCode, language, currentTheme) {
|
|
3825
|
-
var _me$getScrollHeight2, _me$getOption, _oEditor$onDidContent, _mEditor$onDidContent;
|
|
4292
|
+
var _me$getScrollHeight2, _me$getOption, _oEditor$onDidLayoutC, _mEditor$onDidLayoutC, _oEditor$onDidContent, _mEditor$onDidContent;
|
|
3826
4293
|
this.cleanup();
|
|
3827
4294
|
this.lastContainer = container;
|
|
3828
4295
|
container.style.overflow = "hidden";
|
|
3829
4296
|
container.style.maxHeight = this.maxHeightCSS;
|
|
4297
|
+
container.innerHTML = "";
|
|
4298
|
+
const editorMount = typeof document !== "undefined" ? document.createElement("div") : container;
|
|
4299
|
+
if (editorMount !== container) {
|
|
4300
|
+
editorMount.style.width = "100%";
|
|
4301
|
+
editorMount.style.height = "100%";
|
|
4302
|
+
editorMount.style.overflow = "hidden";
|
|
4303
|
+
container.append(editorMount);
|
|
4304
|
+
}
|
|
3830
4305
|
const lang = processedLanguage(language) || language;
|
|
3831
4306
|
this.originalModel = monaco_shim_exports.editor.createModel(originalCode, lang);
|
|
3832
4307
|
this.modifiedModel = monaco_shim_exports.editor.createModel(modifiedCode, lang);
|
|
@@ -3835,7 +4310,7 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
3835
4310
|
const hideUnchangedRegions = this.resolveDiffHideUnchangedRegionsOption();
|
|
3836
4311
|
this.diffHideUnchangedRegionsResolved = hideUnchangedRegions;
|
|
3837
4312
|
this.diffHideUnchangedRegionsDeferred = false;
|
|
3838
|
-
this.diffEditorView = monaco_shim_exports.editor.createDiffEditor(
|
|
4313
|
+
this.diffEditorView = monaco_shim_exports.editor.createDiffEditor(editorMount, {
|
|
3839
4314
|
automaticLayout: true,
|
|
3840
4315
|
scrollBeyondLastLine: false,
|
|
3841
4316
|
renderSideBySide: true,
|
|
@@ -3849,6 +4324,7 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
3849
4324
|
...this.options.scrollbar || {}
|
|
3850
4325
|
},
|
|
3851
4326
|
...this.options,
|
|
4327
|
+
glyphMargin: this.resolveDiffGlyphMarginOption(hideUnchangedRegions),
|
|
3852
4328
|
hideUnchangedRegions
|
|
3853
4329
|
});
|
|
3854
4330
|
monaco_shim_exports.editor.setTheme(currentTheme);
|
|
@@ -3885,8 +4361,10 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
3885
4361
|
autoScrollInitial: this.autoScrollInitial,
|
|
3886
4362
|
diffAutoScroll: this.diffAutoScroll
|
|
3887
4363
|
});
|
|
3888
|
-
const
|
|
3889
|
-
container.style.minHeight = `${
|
|
4364
|
+
const minVisibleHeight = this.shouldDeferTailAppendForInlineStreaming() ? 0 : Math.min(120, this.maxHeightValue);
|
|
4365
|
+
if (minVisibleHeight > 0) container.style.minHeight = `${minVisibleHeight}px`;
|
|
4366
|
+
else if (typeof container.style.removeProperty === "function") container.style.removeProperty("min-height");
|
|
4367
|
+
else delete container.style.minHeight;
|
|
3890
4368
|
if (this.diffHeightManager) {
|
|
3891
4369
|
this.diffHeightManager.dispose();
|
|
3892
4370
|
this.diffHeightManager = null;
|
|
@@ -3905,6 +4383,7 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
3905
4383
|
this.diffComputedVersions = null;
|
|
3906
4384
|
this.diffPresentationDisposables.push(this.diffEditorView.onDidUpdateDiff(() => {
|
|
3907
4385
|
this.diffComputedVersions = this.captureCurrentDiffVersions();
|
|
4386
|
+
this.syncDiffEditorLayoutToContainer();
|
|
3908
4387
|
this.scheduleSyncDiffPresentationDecorations();
|
|
3909
4388
|
}));
|
|
3910
4389
|
this.diffPresentationDisposables.push(oEditor.onDidChangeModelContent(() => {
|
|
@@ -3913,16 +4392,46 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
3913
4392
|
this.diffPresentationDisposables.push(mEditor.onDidChangeModelContent(() => {
|
|
3914
4393
|
this.scheduleSyncDiffPresentationDecorations();
|
|
3915
4394
|
}));
|
|
4395
|
+
const originalLayoutDisposable = (_oEditor$onDidLayoutC = oEditor.onDidLayoutChange) === null || _oEditor$onDidLayoutC === void 0 ? void 0 : _oEditor$onDidLayoutC.call(oEditor, () => {
|
|
4396
|
+
this.scheduleSyncDiffPresentationDecorations();
|
|
4397
|
+
});
|
|
4398
|
+
if (originalLayoutDisposable) this.diffPresentationDisposables.push(originalLayoutDisposable);
|
|
4399
|
+
const modifiedLayoutDisposable = (_mEditor$onDidLayoutC = mEditor.onDidLayoutChange) === null || _mEditor$onDidLayoutC === void 0 ? void 0 : _mEditor$onDidLayoutC.call(mEditor, () => {
|
|
4400
|
+
this.scheduleSyncDiffPresentationDecorations();
|
|
4401
|
+
});
|
|
4402
|
+
if (modifiedLayoutDisposable) this.diffPresentationDisposables.push(modifiedLayoutDisposable);
|
|
4403
|
+
if (typeof MutationObserver !== "undefined" && this.lastContainer) {
|
|
4404
|
+
this.diffPresentationObserver = new MutationObserver((mutations) => {
|
|
4405
|
+
const shouldSync = mutations.some((mutation) => {
|
|
4406
|
+
if (mutation.type !== "childList") return false;
|
|
4407
|
+
const nodes = Array.from(mutation.addedNodes).concat(Array.from(mutation.removedNodes));
|
|
4408
|
+
return nodes.some((node) => {
|
|
4409
|
+
if (!(node instanceof HTMLElement)) return false;
|
|
4410
|
+
return node.matches(".line-delete, .inline-deleted-text, .inline-deleted-margin-view-zone") || !!node.querySelector(".line-delete, .inline-deleted-text, .inline-deleted-margin-view-zone") || !!node.closest(".editor.modified .view-zones, .editor.modified .margin-view-zones");
|
|
4411
|
+
});
|
|
4412
|
+
});
|
|
4413
|
+
if (shouldSync) this.scheduleSyncDiffPresentationDecorations();
|
|
4414
|
+
});
|
|
4415
|
+
this.diffPresentationObserver.observe(this.lastContainer, {
|
|
4416
|
+
childList: true,
|
|
4417
|
+
subtree: true
|
|
4418
|
+
});
|
|
4419
|
+
}
|
|
3916
4420
|
(_oEditor$onDidContent = oEditor.onDidContentSizeChange) === null || _oEditor$onDidContent === void 0 || _oEditor$onDidContent.call(oEditor, () => {
|
|
3917
4421
|
this._hasScrollBar = false;
|
|
3918
4422
|
this.rafScheduler.schedule("content-size-change-diff", () => {
|
|
3919
|
-
var _oEditor$getScrollHei, _oEditor$getOption, _this$
|
|
4423
|
+
var _oEditor$getScrollHei, _oEditor$getOption, _this$diffHeightManag5, _this$diffHeightManag6;
|
|
3920
4424
|
this.cachedScrollHeightDiff = ((_oEditor$getScrollHei = oEditor.getScrollHeight) === null || _oEditor$getScrollHei === void 0 ? void 0 : _oEditor$getScrollHei.call(oEditor)) ?? this.cachedScrollHeightDiff;
|
|
3921
4425
|
this.cachedLineHeightDiff = ((_oEditor$getOption = oEditor.getOption) === null || _oEditor$getOption === void 0 ? void 0 : _oEditor$getOption.call(oEditor, monaco_shim_exports.editor.EditorOption.lineHeight)) ?? this.cachedLineHeightDiff;
|
|
3922
4426
|
this.cachedComputedHeightDiff = this.computedHeight();
|
|
3923
|
-
if (
|
|
3924
|
-
|
|
3925
|
-
|
|
4427
|
+
if (this.lastContainer) {
|
|
4428
|
+
const applied = Number.parseFloat(this.lastContainer.style.height || "0") || 0;
|
|
4429
|
+
if (this.cachedComputedHeightDiff > applied + 1 && (this.cachedComputedHeightDiff < this.maxHeightValue - 1 || !this.shouldAvoidOptimisticMaxHeightWriteDiff())) this.lastContainer.style.height = `${this.cachedComputedHeightDiff}px`;
|
|
4430
|
+
}
|
|
4431
|
+
if ((_this$diffHeightManag5 = this.diffHeightManager) === null || _this$diffHeightManag5 === void 0 ? void 0 : _this$diffHeightManag5.isSuppressed()) return;
|
|
4432
|
+
(_this$diffHeightManag6 = this.diffHeightManager) === null || _this$diffHeightManag6 === void 0 || _this$diffHeightManag6.update();
|
|
4433
|
+
this.scheduleSyncDiffEditorLayoutToContainer();
|
|
4434
|
+
const computed$1 = this.cachedComputedHeightDiff;
|
|
3926
4435
|
if (this.lastContainer) {
|
|
3927
4436
|
this.lastContainer.style.overflow = "hidden";
|
|
3928
4437
|
if (computed$1 >= this.maxHeightValue - 1 && this.shouldAutoScrollDiff && !this.diffHideUnchangedRegionsDeferred) {
|
|
@@ -3935,13 +4444,18 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
3935
4444
|
(_mEditor$onDidContent = mEditor.onDidContentSizeChange) === null || _mEditor$onDidContent === void 0 || _mEditor$onDidContent.call(mEditor, () => {
|
|
3936
4445
|
this._hasScrollBar = false;
|
|
3937
4446
|
this.rafScheduler.schedule("content-size-change-diff", () => {
|
|
3938
|
-
var _mEditor$getScrollHei, _mEditor$getOption, _this$
|
|
4447
|
+
var _mEditor$getScrollHei, _mEditor$getOption, _this$diffHeightManag7, _this$diffHeightManag8;
|
|
3939
4448
|
this.cachedScrollHeightDiff = ((_mEditor$getScrollHei = mEditor.getScrollHeight) === null || _mEditor$getScrollHei === void 0 ? void 0 : _mEditor$getScrollHei.call(mEditor)) ?? this.cachedScrollHeightDiff;
|
|
3940
4449
|
this.cachedLineHeightDiff = ((_mEditor$getOption = mEditor.getOption) === null || _mEditor$getOption === void 0 ? void 0 : _mEditor$getOption.call(mEditor, monaco_shim_exports.editor.EditorOption.lineHeight)) ?? this.cachedLineHeightDiff;
|
|
3941
4450
|
this.cachedComputedHeightDiff = this.computedHeight();
|
|
3942
|
-
if (
|
|
3943
|
-
|
|
3944
|
-
|
|
4451
|
+
if (this.lastContainer) {
|
|
4452
|
+
const applied = Number.parseFloat(this.lastContainer.style.height || "0") || 0;
|
|
4453
|
+
if (this.cachedComputedHeightDiff > applied + 1 && (this.cachedComputedHeightDiff < this.maxHeightValue - 1 || !this.shouldAvoidOptimisticMaxHeightWriteDiff())) this.lastContainer.style.height = `${this.cachedComputedHeightDiff}px`;
|
|
4454
|
+
}
|
|
4455
|
+
if ((_this$diffHeightManag7 = this.diffHeightManager) === null || _this$diffHeightManag7 === void 0 ? void 0 : _this$diffHeightManag7.isSuppressed()) return;
|
|
4456
|
+
(_this$diffHeightManag8 = this.diffHeightManager) === null || _this$diffHeightManag8 === void 0 || _this$diffHeightManag8.update();
|
|
4457
|
+
this.scheduleSyncDiffEditorLayoutToContainer();
|
|
4458
|
+
const computed$1 = this.cachedComputedHeightDiff;
|
|
3945
4459
|
if (this.lastContainer) {
|
|
3946
4460
|
this.lastContainer.style.overflow = "hidden";
|
|
3947
4461
|
if (computed$1 >= this.maxHeightValue - 1 && this.shouldAutoScrollDiff && !this.diffHideUnchangedRegionsDeferred) {
|
|
@@ -3978,18 +4492,23 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
3978
4492
|
if (this.lastKnownModifiedCode == null) this.lastKnownModifiedCode = this.modifiedModel.getValue();
|
|
3979
4493
|
const prevO = this.lastKnownOriginalCode;
|
|
3980
4494
|
const prevM = this.lastKnownModifiedCode;
|
|
4495
|
+
const originalTailAppend = originalCode !== prevO && originalCode.startsWith(prevO) && prevO.length < originalCode.length;
|
|
4496
|
+
const modifiedTailAppend = modifiedCode !== prevM && modifiedCode.startsWith(prevM) && prevM.length < modifiedCode.length;
|
|
4497
|
+
const hasContentChange = originalCode !== prevO || modifiedCode !== prevM;
|
|
3981
4498
|
if (originalCode !== prevO || modifiedCode !== prevM) this.markDiffStreamingActivity();
|
|
4499
|
+
const deferTailAppendForInline = this.shouldDeferTailAppendForInlineStreaming();
|
|
3982
4500
|
let didImmediate = false;
|
|
3983
|
-
if (
|
|
4501
|
+
if (originalTailAppend && !deferTailAppendForInline) {
|
|
3984
4502
|
this.appendOriginal(originalCode.slice(prevO.length));
|
|
3985
4503
|
this.lastKnownOriginalCode = originalCode;
|
|
3986
4504
|
didImmediate = true;
|
|
3987
4505
|
}
|
|
3988
|
-
if (
|
|
4506
|
+
if (modifiedTailAppend && !deferTailAppendForInline) {
|
|
3989
4507
|
this.appendModified(modifiedCode.slice(prevM.length));
|
|
3990
4508
|
this.lastKnownModifiedCode = modifiedCode;
|
|
3991
4509
|
didImmediate = true;
|
|
3992
4510
|
}
|
|
4511
|
+
if (hasContentChange) this.preserveNativeDiffDecorationsOnStaleAppend = (originalCode === prevO || originalTailAppend) && (modifiedCode === prevM || modifiedTailAppend);
|
|
3993
4512
|
if (originalCode !== this.lastKnownOriginalCode || modifiedCode !== this.lastKnownModifiedCode) {
|
|
3994
4513
|
this.pendingDiffUpdate = {
|
|
3995
4514
|
original: originalCode,
|
|
@@ -3998,6 +4517,16 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
3998
4517
|
this.rafScheduler.schedule("diff", () => this.flushPendingDiffUpdate());
|
|
3999
4518
|
} else if (didImmediate) {}
|
|
4000
4519
|
}
|
|
4520
|
+
shouldDeferTailAppendForInlineStreaming() {
|
|
4521
|
+
var _this$lastContainer11, _this$lastContainer12, _this$lastContainer13;
|
|
4522
|
+
const renderSideBySide = this.options.renderSideBySide ?? true;
|
|
4523
|
+
if (renderSideBySide === false) return true;
|
|
4524
|
+
const useInlineViewWhenSpaceIsLimited = this.options.useInlineViewWhenSpaceIsLimited ?? true;
|
|
4525
|
+
if (!useInlineViewWhenSpaceIsLimited) return false;
|
|
4526
|
+
const breakpoint = this.options.renderSideBySideInlineBreakpoint ?? 900;
|
|
4527
|
+
const width = ((_this$lastContainer11 = this.lastContainer) === null || _this$lastContainer11 === void 0 || (_this$lastContainer12 = _this$lastContainer11.getBoundingClientRect) === null || _this$lastContainer12 === void 0 ? void 0 : _this$lastContainer12.call(_this$lastContainer11).width) ?? ((_this$lastContainer13 = this.lastContainer) === null || _this$lastContainer13 === void 0 ? void 0 : _this$lastContainer13.clientWidth) ?? 0;
|
|
4528
|
+
return width > 0 && width <= breakpoint;
|
|
4529
|
+
}
|
|
4001
4530
|
updateOriginal(newCode, codeLanguage) {
|
|
4002
4531
|
if (!this.diffEditorView || !this.originalModel) return;
|
|
4003
4532
|
if (codeLanguage) {
|
|
@@ -4006,8 +4535,10 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
4006
4535
|
}
|
|
4007
4536
|
const prev = this.lastKnownOriginalCode ?? this.originalModel.getValue();
|
|
4008
4537
|
if (prev === newCode) return;
|
|
4538
|
+
const tailAppend = newCode.startsWith(prev) && prev.length < newCode.length;
|
|
4009
4539
|
this.markDiffStreamingActivity();
|
|
4010
|
-
|
|
4540
|
+
this.preserveNativeDiffDecorationsOnStaleAppend = tailAppend;
|
|
4541
|
+
if (tailAppend) this.appendOriginal(newCode.slice(prev.length), codeLanguage);
|
|
4011
4542
|
else {
|
|
4012
4543
|
this.flushOriginalAppendBufferSync();
|
|
4013
4544
|
this.applyMinimalEditToModel(this.originalModel, prev, newCode);
|
|
@@ -4022,8 +4553,10 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
4022
4553
|
}
|
|
4023
4554
|
const prev = this.lastKnownModifiedCode ?? this.modifiedModel.getValue();
|
|
4024
4555
|
if (prev === newCode) return;
|
|
4556
|
+
const tailAppend = newCode.startsWith(prev) && prev.length < newCode.length;
|
|
4025
4557
|
this.markDiffStreamingActivity();
|
|
4026
|
-
|
|
4558
|
+
this.preserveNativeDiffDecorationsOnStaleAppend = tailAppend;
|
|
4559
|
+
if (tailAppend) this.appendModified(newCode.slice(prev.length), codeLanguage);
|
|
4027
4560
|
else {
|
|
4028
4561
|
this.flushModifiedAppendBufferSync();
|
|
4029
4562
|
const prevAfterFlush = this.modifiedModel.getValue();
|
|
@@ -4031,10 +4564,11 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
4031
4564
|
this.applyMinimalEditToModel(this.modifiedModel, prevAfterFlush, newCode);
|
|
4032
4565
|
const newLine = this.modifiedModel.getLineCount();
|
|
4033
4566
|
if (newLine !== prevLine) {
|
|
4567
|
+
this.eagerlyGrowDiffContainerHeight();
|
|
4034
4568
|
const shouldImmediate = this.shouldPerformImmediateRevealDiff();
|
|
4035
4569
|
if (shouldImmediate) this.suppressScrollWatcherDiff(this.scrollWatcherSuppressionMs + 800);
|
|
4036
4570
|
const computed$1 = this.computedHeight();
|
|
4037
|
-
if (computed$1 >= this.maxHeightValue - 1 && this.lastContainer) {
|
|
4571
|
+
if (computed$1 >= this.maxHeightValue - 1 && this.lastContainer && !this.shouldAvoidOptimisticMaxHeightWriteDiff()) {
|
|
4038
4572
|
this.lastContainer.style.height = `${this.maxHeightValue}px`;
|
|
4039
4573
|
this.lastContainer.style.overflow = "hidden";
|
|
4040
4574
|
}
|
|
@@ -4047,6 +4581,7 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
4047
4581
|
appendOriginal(appendText, codeLanguage) {
|
|
4048
4582
|
if (!this.diffEditorView || !this.originalModel || !appendText) return;
|
|
4049
4583
|
this.markDiffStreamingActivity();
|
|
4584
|
+
this.preserveNativeDiffDecorationsOnStaleAppend = true;
|
|
4050
4585
|
if (codeLanguage) {
|
|
4051
4586
|
const lang = processedLanguage(codeLanguage);
|
|
4052
4587
|
if (lang && this.originalModel.getLanguageId() !== lang) monaco_shim_exports.editor.setModelLanguage(this.originalModel, lang);
|
|
@@ -4057,6 +4592,7 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
4057
4592
|
appendModified(appendText, codeLanguage) {
|
|
4058
4593
|
if (!this.diffEditorView || !this.modifiedModel || !appendText) return;
|
|
4059
4594
|
this.markDiffStreamingActivity();
|
|
4595
|
+
this.preserveNativeDiffDecorationsOnStaleAppend = true;
|
|
4060
4596
|
if (codeLanguage) {
|
|
4061
4597
|
const lang = processedLanguage(codeLanguage);
|
|
4062
4598
|
if (lang && this.modifiedModel.getLanguageId() !== lang) monaco_shim_exports.editor.setModelLanguage(this.modifiedModel, lang);
|
|
@@ -4073,9 +4609,10 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
4073
4609
|
if (this.modifiedModel && this.modifiedModel.getLanguageId() !== language) monaco_shim_exports.editor.setModelLanguage(this.modifiedModel, language);
|
|
4074
4610
|
}
|
|
4075
4611
|
async setDiffModels(models, options = {}) {
|
|
4076
|
-
var _this$originalModel2, _this$modifiedModel5, _this$diffEditorView$
|
|
4612
|
+
var _this$originalModel2, _this$modifiedModel5, _this$diffEditorView$6, _this$diffEditorView$7, _this$diffEditorView$8, _this$diffEditorView$9;
|
|
4077
4613
|
if (!this.diffEditorView) return;
|
|
4078
4614
|
const transitionRequestId = ++this.diffModelTransitionRequestId;
|
|
4615
|
+
this.preserveNativeDiffDecorationsOnStaleAppend = false;
|
|
4079
4616
|
this.disposePendingPreparedDiffViewModel();
|
|
4080
4617
|
const nextOriginal = models.original;
|
|
4081
4618
|
const nextModified = models.modified;
|
|
@@ -4126,17 +4663,19 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
4126
4663
|
this.pendingDiffUpdate = null;
|
|
4127
4664
|
this.flushOriginalAppendBufferSync();
|
|
4128
4665
|
this.flushModifiedAppendBufferSync();
|
|
4666
|
+
this.preserveNativeDiffDecorationsOnStaleAppend = false;
|
|
4129
4667
|
const currentOriginal = this.originalModel;
|
|
4130
4668
|
const currentModified = this.modifiedModel;
|
|
4131
4669
|
const shouldRestorePersistedUnchangedState = preserveViewState && !sameContent;
|
|
4670
|
+
const shouldRestoreSavedModelState = options.preserveModelState ?? true;
|
|
4132
4671
|
const preservedScrollPosition = preserveViewState ? this.captureDiffScrollPosition() : null;
|
|
4133
4672
|
const preservedViewportAnchor = preserveViewState && sameContent ? this.captureModifiedViewportAnchor() : null;
|
|
4134
|
-
const viewState = preserveViewState ? this.diffEditorView.saveViewState() : null;
|
|
4673
|
+
const viewState = preserveViewState && shouldRestoreSavedModelState ? this.diffEditorView.saveViewState() : null;
|
|
4135
4674
|
this.queuePendingDiffScrollRestore(preservedScrollPosition, shouldRestorePersistedUnchangedState ? 2 : 0);
|
|
4136
4675
|
if (shouldRestorePersistedUnchangedState) this.capturePersistedDiffUnchangedState();
|
|
4137
4676
|
const applyModelSwap = () => {
|
|
4138
|
-
var _this$
|
|
4139
|
-
(_this$
|
|
4677
|
+
var _this$diffEditorView33;
|
|
4678
|
+
(_this$diffEditorView33 = this.diffEditorView) === null || _this$diffEditorView33 === void 0 || _this$diffEditorView33.setModel(nextModelTarget);
|
|
4140
4679
|
};
|
|
4141
4680
|
if (preserveViewState) this.withLockedDiffScrollPosition(applyModelSwap);
|
|
4142
4681
|
else applyModelSwap();
|
|
@@ -4151,8 +4690,8 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
4151
4690
|
this.lastKnownModifiedLineCount = nextModified.getLineCount();
|
|
4152
4691
|
this.lastKnownModifiedDirty = false;
|
|
4153
4692
|
this._hasScrollBar = false;
|
|
4154
|
-
this.cachedScrollHeightDiff = ((_this$diffEditorView$
|
|
4155
|
-
this.cachedLineHeightDiff = ((_this$diffEditorView$
|
|
4693
|
+
this.cachedScrollHeightDiff = ((_this$diffEditorView$6 = (_this$diffEditorView$7 = this.diffEditorView.getModifiedEditor()).getScrollHeight) === null || _this$diffEditorView$6 === void 0 ? void 0 : _this$diffEditorView$6.call(_this$diffEditorView$7)) ?? null;
|
|
4694
|
+
this.cachedLineHeightDiff = ((_this$diffEditorView$8 = (_this$diffEditorView$9 = this.diffEditorView.getModifiedEditor()).getOption) === null || _this$diffEditorView$8 === void 0 ? void 0 : _this$diffEditorView$8.call(_this$diffEditorView$9, monaco_shim_exports.editor.EditorOption.lineHeight)) ?? null;
|
|
4156
4695
|
this.cachedComputedHeightDiff = this.computedHeight();
|
|
4157
4696
|
this.diffHunkLineChanges = this.getEffectiveLineChanges();
|
|
4158
4697
|
this.hideDiffHunkActions();
|
|
@@ -4179,19 +4718,9 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
4179
4718
|
}
|
|
4180
4719
|
cleanup() {
|
|
4181
4720
|
this.diffModelTransitionRequestId += 1;
|
|
4721
|
+
this.preserveNativeDiffDecorationsOnStaleAppend = false;
|
|
4182
4722
|
this.disposePendingPreparedDiffViewModel();
|
|
4183
|
-
this.
|
|
4184
|
-
this.pendingDiffUpdate = null;
|
|
4185
|
-
this.rafScheduler.cancel("appendDiff");
|
|
4186
|
-
this.appendBufferDiffScheduled = false;
|
|
4187
|
-
this.appendBufferOriginalDiff.length = 0;
|
|
4188
|
-
this.appendBufferModifiedDiff.length = 0;
|
|
4189
|
-
if (this.appendFlushThrottleTimerDiff != null) {
|
|
4190
|
-
clearTimeout(this.appendFlushThrottleTimerDiff);
|
|
4191
|
-
this.appendFlushThrottleTimerDiff = null;
|
|
4192
|
-
}
|
|
4193
|
-
this.rafScheduler.cancel("content-size-change-diff");
|
|
4194
|
-
this.rafScheduler.cancel("sync-last-known-modified");
|
|
4723
|
+
this.clearAsyncWork();
|
|
4195
4724
|
this.disposeDiffHunkInteractions();
|
|
4196
4725
|
this.disposeDiffUnchangedRegionEnhancements();
|
|
4197
4726
|
this.disposeDiffPresentationTracking();
|
|
@@ -4222,42 +4751,21 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
4222
4751
|
this.lastContainer.innerHTML = "";
|
|
4223
4752
|
this.lastContainer = null;
|
|
4224
4753
|
}
|
|
4225
|
-
if (this.revealDebounceIdDiff != null) {
|
|
4226
|
-
clearTimeout(this.revealDebounceIdDiff);
|
|
4227
|
-
this.revealDebounceIdDiff = null;
|
|
4228
|
-
}
|
|
4229
|
-
if (this.revealIdleTimerIdDiff != null) {
|
|
4230
|
-
clearTimeout(this.revealIdleTimerIdDiff);
|
|
4231
|
-
this.revealIdleTimerIdDiff = null;
|
|
4232
|
-
}
|
|
4233
|
-
if (this.diffScrollWatcherSuppressionTimer != null) {
|
|
4234
|
-
clearTimeout(this.diffScrollWatcherSuppressionTimer);
|
|
4235
|
-
this.diffScrollWatcherSuppressionTimer = null;
|
|
4236
|
-
}
|
|
4237
4754
|
this.revealTicketDiff = 0;
|
|
4238
4755
|
this.lastRevealLineDiff = null;
|
|
4239
4756
|
this.diffPersistedUnchangedModelState = null;
|
|
4757
|
+
this.diffPreviousUnchangedModelState = null;
|
|
4240
4758
|
this.pendingDiffScrollRestorePosition = null;
|
|
4241
4759
|
this.pendingDiffScrollRestoreBudget = 0;
|
|
4242
4760
|
this.diffHideUnchangedRegionsResolved = null;
|
|
4243
4761
|
this.diffHideUnchangedRegionsDeferred = false;
|
|
4244
|
-
this.clearPendingDiffThemeSync();
|
|
4245
4762
|
}
|
|
4246
4763
|
safeClean() {
|
|
4247
4764
|
this.diffModelTransitionRequestId += 1;
|
|
4765
|
+
this.preserveNativeDiffDecorationsOnStaleAppend = false;
|
|
4248
4766
|
this.disposePendingPreparedDiffViewModel();
|
|
4249
|
-
this.
|
|
4250
|
-
this.pendingDiffUpdate = null;
|
|
4251
|
-
this.rafScheduler.cancel("appendDiff");
|
|
4252
|
-
this.appendBufferDiffScheduled = false;
|
|
4253
|
-
this.appendBufferOriginalDiff.length = 0;
|
|
4254
|
-
this.appendBufferModifiedDiff.length = 0;
|
|
4255
|
-
if (this.appendFlushThrottleTimerDiff != null) {
|
|
4256
|
-
clearTimeout(this.appendFlushThrottleTimerDiff);
|
|
4257
|
-
this.appendFlushThrottleTimerDiff = null;
|
|
4258
|
-
}
|
|
4767
|
+
this.clearAsyncWork();
|
|
4259
4768
|
this.hideDiffHunkActions();
|
|
4260
|
-
this.cancelScheduledHideDiffHunkActions();
|
|
4261
4769
|
this.disposeDiffUnchangedRegionEnhancements();
|
|
4262
4770
|
this.disposeDiffPresentationTracking();
|
|
4263
4771
|
if (this.diffScrollWatcher) {
|
|
@@ -4271,25 +4779,14 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
4271
4779
|
this.diffHeightManager.dispose();
|
|
4272
4780
|
this.diffHeightManager = null;
|
|
4273
4781
|
}
|
|
4274
|
-
if (this.revealDebounceIdDiff != null) {
|
|
4275
|
-
clearTimeout(this.revealDebounceIdDiff);
|
|
4276
|
-
this.revealDebounceIdDiff = null;
|
|
4277
|
-
}
|
|
4278
|
-
if (this.revealIdleTimerIdDiff != null) {
|
|
4279
|
-
clearTimeout(this.revealIdleTimerIdDiff);
|
|
4280
|
-
this.revealIdleTimerIdDiff = null;
|
|
4281
|
-
}
|
|
4282
|
-
if (this.diffScrollWatcherSuppressionTimer != null) {
|
|
4283
|
-
clearTimeout(this.diffScrollWatcherSuppressionTimer);
|
|
4284
|
-
this.diffScrollWatcherSuppressionTimer = null;
|
|
4285
|
-
}
|
|
4286
4782
|
this.revealTicketDiff = 0;
|
|
4287
4783
|
this.lastRevealLineDiff = null;
|
|
4288
4784
|
this.diffPersistedUnchangedModelState = null;
|
|
4785
|
+
this.diffPreviousUnchangedModelState = null;
|
|
4289
4786
|
this.diffHideUnchangedRegionsDeferred = false;
|
|
4290
|
-
this.
|
|
4291
|
-
this.
|
|
4292
|
-
this.
|
|
4787
|
+
this.clearInlineDiffStreamingPresentationIdleTimer();
|
|
4788
|
+
this.inlineDiffStreamingPresentationActive = false;
|
|
4789
|
+
this.resetInlineDiffStreamingHeightFloor();
|
|
4293
4790
|
}
|
|
4294
4791
|
syncLastKnownModified() {
|
|
4295
4792
|
if (!this.diffEditorView || !this.lastKnownModifiedDirty) return;
|
|
@@ -4328,23 +4825,28 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
4328
4825
|
if (this.lastKnownOriginalCode == null) this.lastKnownOriginalCode = o.getValue();
|
|
4329
4826
|
if (this.lastKnownModifiedCode == null) this.lastKnownModifiedCode = m.getValue();
|
|
4330
4827
|
const prevO = this.lastKnownOriginalCode;
|
|
4828
|
+
const originalTailAppend = prevO !== original && original.startsWith(prevO) && prevO.length < original.length;
|
|
4331
4829
|
if (prevO !== original) {
|
|
4332
|
-
if (
|
|
4830
|
+
if (originalTailAppend) this.appendToModel(o, original.slice(prevO.length));
|
|
4333
4831
|
else this.applyMinimalEditToModel(o, prevO, original);
|
|
4334
4832
|
this.lastKnownOriginalCode = original;
|
|
4335
4833
|
}
|
|
4336
4834
|
const prevM = m.getValue();
|
|
4337
4835
|
const prevMLineCount = m.getLineCount();
|
|
4836
|
+
const modifiedTailAppend = prevM !== modified && modified.startsWith(prevM) && prevM.length < modified.length;
|
|
4837
|
+
const hasContentChange = prevO !== original || prevM !== modified;
|
|
4838
|
+
if (hasContentChange) this.preserveNativeDiffDecorationsOnStaleAppend = (prevO === original || originalTailAppend) && (prevM === modified || modifiedTailAppend);
|
|
4338
4839
|
if (prevM !== modified) {
|
|
4339
|
-
if (
|
|
4840
|
+
if (modifiedTailAppend) this.appendToModel(m, modified.slice(prevM.length));
|
|
4340
4841
|
else this.applyMinimalEditToModel(m, prevM, modified);
|
|
4341
4842
|
this.lastKnownModifiedCode = modified;
|
|
4342
4843
|
const newMLineCount = m.getLineCount();
|
|
4343
4844
|
if (newMLineCount !== prevMLineCount) {
|
|
4845
|
+
this.eagerlyGrowDiffContainerHeight();
|
|
4344
4846
|
const shouldImmediate = this.shouldPerformImmediateRevealDiff();
|
|
4345
4847
|
if (shouldImmediate) this.suppressScrollWatcherDiff(this.scrollWatcherSuppressionMs + 800);
|
|
4346
4848
|
const computed$1 = this.computedHeight();
|
|
4347
|
-
if (computed$1 >= this.maxHeightValue - 1 && this.lastContainer) {
|
|
4849
|
+
if (computed$1 >= this.maxHeightValue - 1 && this.lastContainer && !this.shouldAvoidOptimisticMaxHeightWriteDiff()) {
|
|
4348
4850
|
this.lastContainer.style.height = `${this.maxHeightValue}px`;
|
|
4349
4851
|
this.lastContainer.style.overflow = "hidden";
|
|
4350
4852
|
}
|
|
@@ -4361,6 +4863,7 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
4361
4863
|
const text = this.appendBufferModifiedDiff.join("");
|
|
4362
4864
|
this.appendBufferModifiedDiff.length = 0;
|
|
4363
4865
|
if (!text) return;
|
|
4866
|
+
this.preserveNativeDiffDecorationsOnStaleAppend = true;
|
|
4364
4867
|
this.appendToModel(this.modifiedModel, text);
|
|
4365
4868
|
}
|
|
4366
4869
|
async flushAppendBufferDiff() {
|
|
@@ -4371,7 +4874,10 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
4371
4874
|
if (this.originalModel && this.appendBufferOriginalDiff.length > 0) {
|
|
4372
4875
|
const oText = this.appendBufferOriginalDiff.join("");
|
|
4373
4876
|
this.appendBufferOriginalDiff.length = 0;
|
|
4374
|
-
if (oText)
|
|
4877
|
+
if (oText) {
|
|
4878
|
+
this.preserveNativeDiffDecorationsOnStaleAppend = true;
|
|
4879
|
+
this.appendToModel(this.originalModel, oText);
|
|
4880
|
+
}
|
|
4375
4881
|
}
|
|
4376
4882
|
const me = this.diffEditorView.getModifiedEditor();
|
|
4377
4883
|
const model = me.getModel();
|
|
@@ -4420,6 +4926,7 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
4420
4926
|
});
|
|
4421
4927
|
const lastColumn$1 = model.getLineMaxColumn(prevLine);
|
|
4422
4928
|
const range$1 = new monaco_shim_exports.Range(prevLine, lastColumn$1, prevLine, lastColumn$1);
|
|
4929
|
+
this.preserveNativeDiffDecorationsOnStaleAppend = true;
|
|
4423
4930
|
model.applyEdits([{
|
|
4424
4931
|
range: range$1,
|
|
4425
4932
|
text: part,
|
|
@@ -4429,6 +4936,7 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
4429
4936
|
const newLine$1 = model.getLineCount();
|
|
4430
4937
|
this.lastKnownModifiedLineCount = newLine$1;
|
|
4431
4938
|
await new Promise((resolve) => typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame(resolve) : setTimeout(resolve, 0));
|
|
4939
|
+
this.eagerlyGrowDiffContainerHeight();
|
|
4432
4940
|
const shouldImmediate$1 = this.shouldPerformImmediateRevealDiff();
|
|
4433
4941
|
log("diff", "flushAppendBufferDiff chunk metrics", {
|
|
4434
4942
|
idx,
|
|
@@ -4438,7 +4946,7 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
4438
4946
|
});
|
|
4439
4947
|
if (shouldImmediate$1) this.suppressScrollWatcherDiff(this.scrollWatcherSuppressionMs + 800);
|
|
4440
4948
|
const computed$2 = this.computedHeight();
|
|
4441
|
-
if (computed$2 >= this.maxHeightValue - 1 && this.lastContainer) {
|
|
4949
|
+
if (computed$2 >= this.maxHeightValue - 1 && this.lastContainer && !this.shouldAvoidOptimisticMaxHeightWriteDiff()) {
|
|
4442
4950
|
this.lastContainer.style.height = `${this.maxHeightValue}px`;
|
|
4443
4951
|
this.lastContainer.style.overflow = "hidden";
|
|
4444
4952
|
}
|
|
@@ -4458,6 +4966,7 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
4458
4966
|
prevLine = model.getLineCount();
|
|
4459
4967
|
const lastColumn = model.getLineMaxColumn(prevLine);
|
|
4460
4968
|
const range = new monaco_shim_exports.Range(prevLine, lastColumn, prevLine, lastColumn);
|
|
4969
|
+
this.preserveNativeDiffDecorationsOnStaleAppend = true;
|
|
4461
4970
|
model.applyEdits([{
|
|
4462
4971
|
range,
|
|
4463
4972
|
text,
|
|
@@ -4466,17 +4975,17 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
4466
4975
|
this.lastKnownModifiedCode = model.getValue();
|
|
4467
4976
|
const newLine = model.getLineCount();
|
|
4468
4977
|
this.lastKnownModifiedLineCount = newLine;
|
|
4978
|
+
this.eagerlyGrowDiffContainerHeight();
|
|
4469
4979
|
const shouldImmediate = this.shouldPerformImmediateRevealDiff();
|
|
4470
4980
|
if (shouldImmediate) this.suppressScrollWatcherDiff(this.scrollWatcherSuppressionMs + 800);
|
|
4471
4981
|
const computed$1 = this.computedHeight();
|
|
4472
|
-
if (computed$1 >= this.maxHeightValue - 1 && this.lastContainer) this.lastContainer.style.height = `${this.maxHeightValue}px`;
|
|
4982
|
+
if (computed$1 >= this.maxHeightValue - 1 && this.lastContainer && !this.shouldAvoidOptimisticMaxHeightWriteDiff()) this.lastContainer.style.height = `${this.maxHeightValue}px`;
|
|
4473
4983
|
if (shouldImmediate) this.scheduleImmediateRevealAfterLayoutDiff(newLine);
|
|
4474
4984
|
else this.maybeScrollDiffToBottom(newLine, prevLine);
|
|
4475
4985
|
if (suppressedByFlush) watcherApi.setSuppressed(false);
|
|
4476
4986
|
try {
|
|
4477
|
-
var _this$
|
|
4478
|
-
this.
|
|
4479
|
-
this.lastScrollTopDiff = ((_this$diffEditorView36 = this.diffEditorView) === null || _this$diffEditorView36 === void 0 || (_this$diffEditorView38 = (_this$diffEditorView37 = _this$diffEditorView36.getModifiedEditor()).getScrollTop) === null || _this$diffEditorView38 === void 0 ? void 0 : _this$diffEditorView38.call(_this$diffEditorView37)) ?? this.lastScrollTopDiff;
|
|
4987
|
+
var _this$diffEditorView34, _this$diffEditorView35, _this$diffEditorView36;
|
|
4988
|
+
this.lastScrollTopDiff = ((_this$diffEditorView34 = this.diffEditorView) === null || _this$diffEditorView34 === void 0 || (_this$diffEditorView36 = (_this$diffEditorView35 = _this$diffEditorView34.getModifiedEditor()).getScrollTop) === null || _this$diffEditorView36 === void 0 ? void 0 : _this$diffEditorView36.call(_this$diffEditorView35)) ?? this.lastScrollTopDiff;
|
|
4480
4989
|
} catch {}
|
|
4481
4990
|
}
|
|
4482
4991
|
applyMinimalEditToModel(model, prev, next) {
|
|
@@ -4524,6 +5033,9 @@ var EditorManager = class {
|
|
|
4524
5033
|
lastKnownCode = null;
|
|
4525
5034
|
pendingUpdate = null;
|
|
4526
5035
|
_hasScrollBar = false;
|
|
5036
|
+
updateThrottleMs = 50;
|
|
5037
|
+
lastUpdateFlushTime = 0;
|
|
5038
|
+
updateThrottleTimer = null;
|
|
4527
5039
|
shouldAutoScroll = true;
|
|
4528
5040
|
scrollWatcher = null;
|
|
4529
5041
|
scrollWatcherSuppressionTimer = null;
|
|
@@ -4533,6 +5045,7 @@ var EditorManager = class {
|
|
|
4533
5045
|
cachedComputedHeight = null;
|
|
4534
5046
|
cachedLineCount = null;
|
|
4535
5047
|
lastKnownCodeDirty = false;
|
|
5048
|
+
programmaticContentChangeDepth = 0;
|
|
4536
5049
|
debug = false;
|
|
4537
5050
|
measureViewport() {
|
|
4538
5051
|
var _this$editorView$getL, _this$editorView, _this$editorView$getS, _this$editorView2, _this$editorView$getS2, _this$editorView3;
|
|
@@ -4565,7 +5078,7 @@ var EditorManager = class {
|
|
|
4565
5078
|
revealStrategyOption;
|
|
4566
5079
|
revealBatchOnIdleMsOption;
|
|
4567
5080
|
scrollWatcherSuppressionMs = 500;
|
|
4568
|
-
constructor(options, maxHeightValue, maxHeightCSS, autoScrollOnUpdate, autoScrollInitial, autoScrollThresholdPx, autoScrollThresholdLines, revealDebounceMsOption) {
|
|
5081
|
+
constructor(options, maxHeightValue, maxHeightCSS, autoScrollOnUpdate, autoScrollInitial, autoScrollThresholdPx, autoScrollThresholdLines, revealDebounceMsOption, updateThrottleMsOption) {
|
|
4569
5082
|
this.options = options;
|
|
4570
5083
|
this.maxHeightValue = maxHeightValue;
|
|
4571
5084
|
this.maxHeightCSS = maxHeightCSS;
|
|
@@ -4574,6 +5087,47 @@ var EditorManager = class {
|
|
|
4574
5087
|
this.autoScrollThresholdPx = autoScrollThresholdPx;
|
|
4575
5088
|
this.autoScrollThresholdLines = autoScrollThresholdLines;
|
|
4576
5089
|
this.revealDebounceMsOption = revealDebounceMsOption;
|
|
5090
|
+
this.updateThrottleMsOption = updateThrottleMsOption;
|
|
5091
|
+
this.updateThrottleMs = this.updateThrottleMsOption ?? this.options.updateThrottleMs ?? 50;
|
|
5092
|
+
}
|
|
5093
|
+
cancelRafs() {
|
|
5094
|
+
this.rafScheduler.cancel("update");
|
|
5095
|
+
this.rafScheduler.cancel("sync-last-known");
|
|
5096
|
+
this.rafScheduler.cancel("content-size-change");
|
|
5097
|
+
this.rafScheduler.cancel("maybe-scroll");
|
|
5098
|
+
this.rafScheduler.cancel("reveal");
|
|
5099
|
+
this.rafScheduler.cancel("immediate-reveal");
|
|
5100
|
+
this.rafScheduler.cancel("maybe-resume");
|
|
5101
|
+
this.rafScheduler.cancel("append");
|
|
5102
|
+
}
|
|
5103
|
+
clearRevealTimers() {
|
|
5104
|
+
if (this.revealDebounceId != null) {
|
|
5105
|
+
clearTimeout(this.revealDebounceId);
|
|
5106
|
+
this.revealDebounceId = null;
|
|
5107
|
+
}
|
|
5108
|
+
if (this.revealIdleTimerId != null) {
|
|
5109
|
+
clearTimeout(this.revealIdleTimerId);
|
|
5110
|
+
this.revealIdleTimerId = null;
|
|
5111
|
+
}
|
|
5112
|
+
}
|
|
5113
|
+
resetAppendState() {
|
|
5114
|
+
this.appendBufferScheduled = false;
|
|
5115
|
+
this.appendBuffer.length = 0;
|
|
5116
|
+
}
|
|
5117
|
+
clearAsyncWork() {
|
|
5118
|
+
this.cancelRafs();
|
|
5119
|
+
this.pendingUpdate = null;
|
|
5120
|
+
this.lastKnownCodeDirty = false;
|
|
5121
|
+
this.resetAppendState();
|
|
5122
|
+
this.clearRevealTimers();
|
|
5123
|
+
if (this.scrollWatcherSuppressionTimer != null) {
|
|
5124
|
+
clearTimeout(this.scrollWatcherSuppressionTimer);
|
|
5125
|
+
this.scrollWatcherSuppressionTimer = null;
|
|
5126
|
+
}
|
|
5127
|
+
if (this.updateThrottleTimer != null) {
|
|
5128
|
+
clearTimeout(this.updateThrottleTimer);
|
|
5129
|
+
this.updateThrottleTimer = null;
|
|
5130
|
+
}
|
|
4577
5131
|
}
|
|
4578
5132
|
initDebugFlag() {
|
|
4579
5133
|
if (typeof window !== "undefined" && window.__STREAM_MONACO_DEBUG__ !== void 0) {
|
|
@@ -4590,6 +5144,14 @@ var EditorManager = class {
|
|
|
4590
5144
|
if (!this.debug) return;
|
|
4591
5145
|
log("EditorManager", ...args);
|
|
4592
5146
|
}
|
|
5147
|
+
runAsProgrammaticContentChange(fn) {
|
|
5148
|
+
this.programmaticContentChangeDepth += 1;
|
|
5149
|
+
try {
|
|
5150
|
+
return fn();
|
|
5151
|
+
} finally {
|
|
5152
|
+
this.programmaticContentChangeDepth -= 1;
|
|
5153
|
+
}
|
|
5154
|
+
}
|
|
4593
5155
|
hasVerticalScrollbar() {
|
|
4594
5156
|
if (!this.editorView) return false;
|
|
4595
5157
|
if (this._hasScrollBar) return true;
|
|
@@ -4816,6 +5378,7 @@ var EditorManager = class {
|
|
|
4816
5378
|
});
|
|
4817
5379
|
});
|
|
4818
5380
|
this.editorView.onDidChangeModelContent(() => {
|
|
5381
|
+
if (this.programmaticContentChangeDepth > 0) return;
|
|
4819
5382
|
this.lastKnownCodeDirty = true;
|
|
4820
5383
|
this.rafScheduler.schedule("sync-last-known", () => this.syncLastKnownCode());
|
|
4821
5384
|
});
|
|
@@ -4910,7 +5473,24 @@ var EditorManager = class {
|
|
|
4910
5473
|
code: newCode,
|
|
4911
5474
|
lang: codeLanguage
|
|
4912
5475
|
};
|
|
4913
|
-
this.rafScheduler.schedule("update", () =>
|
|
5476
|
+
this.rafScheduler.schedule("update", () => {
|
|
5477
|
+
if (!this.updateThrottleMs) {
|
|
5478
|
+
this.flushPendingUpdate();
|
|
5479
|
+
return;
|
|
5480
|
+
}
|
|
5481
|
+
const now = Date.now();
|
|
5482
|
+
const since = now - this.lastUpdateFlushTime;
|
|
5483
|
+
if (since >= this.updateThrottleMs) {
|
|
5484
|
+
this.flushPendingUpdate();
|
|
5485
|
+
return;
|
|
5486
|
+
}
|
|
5487
|
+
if (this.updateThrottleTimer != null) return;
|
|
5488
|
+
const wait = this.updateThrottleMs - since;
|
|
5489
|
+
this.updateThrottleTimer = setTimeout(() => {
|
|
5490
|
+
this.updateThrottleTimer = null;
|
|
5491
|
+
this.rafScheduler.schedule("update", () => this.flushPendingUpdate());
|
|
5492
|
+
}, wait);
|
|
5493
|
+
});
|
|
4914
5494
|
}
|
|
4915
5495
|
flushPendingUpdate() {
|
|
4916
5496
|
if (!this.pendingUpdate || !this.editorView) return;
|
|
@@ -4918,12 +5498,15 @@ var EditorManager = class {
|
|
|
4918
5498
|
if (!model) return;
|
|
4919
5499
|
const { code: newCode, lang: codeLanguage } = this.pendingUpdate;
|
|
4920
5500
|
this.pendingUpdate = null;
|
|
5501
|
+
this.lastUpdateFlushTime = Date.now();
|
|
4921
5502
|
const processedCodeLanguage = processedLanguage(codeLanguage);
|
|
4922
5503
|
const languageId = model.getLanguageId();
|
|
4923
5504
|
if (languageId !== processedCodeLanguage) {
|
|
4924
5505
|
if (processedCodeLanguage) monaco_shim_exports.editor.setModelLanguage(model, processedCodeLanguage);
|
|
4925
5506
|
const prevLineCount$1 = model.getLineCount();
|
|
4926
|
-
|
|
5507
|
+
this.runAsProgrammaticContentChange(() => {
|
|
5508
|
+
model.setValue(newCode);
|
|
5509
|
+
});
|
|
4927
5510
|
this.lastKnownCode = newCode;
|
|
4928
5511
|
const newLineCount$1 = model.getLineCount();
|
|
4929
5512
|
this.cachedLineCount = newLineCount$1;
|
|
@@ -4936,8 +5519,21 @@ var EditorManager = class {
|
|
|
4936
5519
|
}
|
|
4937
5520
|
return;
|
|
4938
5521
|
}
|
|
4939
|
-
|
|
4940
|
-
|
|
5522
|
+
let prevCode;
|
|
5523
|
+
if (this.appendBuffer.length > 0) {
|
|
5524
|
+
this.resetAppendState();
|
|
5525
|
+
this.rafScheduler.cancel("append");
|
|
5526
|
+
try {
|
|
5527
|
+
prevCode = model.getValue();
|
|
5528
|
+
this.lastKnownCode = prevCode;
|
|
5529
|
+
} catch {
|
|
5530
|
+
prevCode = this.lastKnownCode ?? "";
|
|
5531
|
+
}
|
|
5532
|
+
} else if (this.lastKnownCode != null) prevCode = this.lastKnownCode;
|
|
5533
|
+
else {
|
|
5534
|
+
prevCode = this.editorView.getValue();
|
|
5535
|
+
this.lastKnownCode = prevCode;
|
|
5536
|
+
}
|
|
4941
5537
|
if (prevCode === newCode) return;
|
|
4942
5538
|
if (newCode.startsWith(prevCode) && prevCode.length < newCode.length) {
|
|
4943
5539
|
const suffix = newCode.slice(prevCode.length);
|
|
@@ -4981,7 +5577,9 @@ var EditorManager = class {
|
|
|
4981
5577
|
const changeRatio = maxLen > 0 ? Math.abs(next.length - prev.length) / maxLen : 0;
|
|
4982
5578
|
if (prev.length + next.length > maxChars || changeRatio > ratio) {
|
|
4983
5579
|
const prevLineCount = model.getLineCount();
|
|
4984
|
-
|
|
5580
|
+
this.runAsProgrammaticContentChange(() => {
|
|
5581
|
+
model.setValue(next);
|
|
5582
|
+
});
|
|
4985
5583
|
this.lastKnownCode = next;
|
|
4986
5584
|
const newLineCount = model.getLineCount();
|
|
4987
5585
|
this.cachedLineCount = newLineCount;
|
|
@@ -5000,8 +5598,10 @@ var EditorManager = class {
|
|
|
5000
5598
|
text: replaceText,
|
|
5001
5599
|
forceMoveMarkers: true
|
|
5002
5600
|
}];
|
|
5003
|
-
|
|
5004
|
-
|
|
5601
|
+
this.runAsProgrammaticContentChange(() => {
|
|
5602
|
+
if (isReadOnly) model.applyEdits(edit);
|
|
5603
|
+
else this.editorView.executeEdits("minimal-replace", edit);
|
|
5604
|
+
});
|
|
5005
5605
|
}
|
|
5006
5606
|
flushAppendBuffer() {
|
|
5007
5607
|
if (!this.editorView) return;
|
|
@@ -5018,19 +5618,20 @@ var EditorManager = class {
|
|
|
5018
5618
|
const lastColumn = model.getLineMaxColumn(lastLine);
|
|
5019
5619
|
const range = new monaco_shim_exports.Range(lastLine, lastColumn, lastLine, lastColumn);
|
|
5020
5620
|
const isReadOnly = this.editorView.getOption(monaco_shim_exports.editor.EditorOption.readOnly);
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5621
|
+
this.runAsProgrammaticContentChange(() => {
|
|
5622
|
+
if (isReadOnly) model.applyEdits([{
|
|
5623
|
+
range,
|
|
5624
|
+
text,
|
|
5625
|
+
forceMoveMarkers: true
|
|
5626
|
+
}]);
|
|
5627
|
+
else this.editorView.executeEdits("append", [{
|
|
5628
|
+
range,
|
|
5629
|
+
text,
|
|
5630
|
+
forceMoveMarkers: true
|
|
5631
|
+
}]);
|
|
5632
|
+
});
|
|
5633
|
+
if (this.lastKnownCode != null) this.lastKnownCode = this.lastKnownCode + text;
|
|
5634
|
+
else this.lastKnownCode = model.getValue();
|
|
5034
5635
|
const newLineCount = model.getLineCount();
|
|
5035
5636
|
if (lastLine !== newLineCount) {
|
|
5036
5637
|
this.cachedLineCount = newLineCount;
|
|
@@ -5055,30 +5656,19 @@ var EditorManager = class {
|
|
|
5055
5656
|
getEditorView() {
|
|
5056
5657
|
return this.editorView;
|
|
5057
5658
|
}
|
|
5058
|
-
|
|
5059
|
-
this.
|
|
5060
|
-
this.
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
this.rafScheduler.cancel("immediate-reveal");
|
|
5065
|
-
this.rafScheduler.cancel("maybe-resume");
|
|
5066
|
-
this.pendingUpdate = null;
|
|
5067
|
-
this.rafScheduler.cancel("append");
|
|
5068
|
-
this.appendBufferScheduled = false;
|
|
5069
|
-
this.appendBuffer.length = 0;
|
|
5070
|
-
if (this.revealDebounceId != null) {
|
|
5071
|
-
clearTimeout(this.revealDebounceId);
|
|
5072
|
-
this.revealDebounceId = null;
|
|
5073
|
-
}
|
|
5074
|
-
if (this.revealIdleTimerId != null) {
|
|
5075
|
-
clearTimeout(this.revealIdleTimerId);
|
|
5076
|
-
this.revealIdleTimerId = null;
|
|
5077
|
-
}
|
|
5078
|
-
if (this.scrollWatcherSuppressionTimer != null) {
|
|
5079
|
-
clearTimeout(this.scrollWatcherSuppressionTimer);
|
|
5080
|
-
this.scrollWatcherSuppressionTimer = null;
|
|
5659
|
+
setUpdateThrottleMs(ms) {
|
|
5660
|
+
this.updateThrottleMs = ms;
|
|
5661
|
+
if (!this.updateThrottleMs && this.updateThrottleTimer != null) {
|
|
5662
|
+
clearTimeout(this.updateThrottleTimer);
|
|
5663
|
+
this.updateThrottleTimer = null;
|
|
5664
|
+
this.rafScheduler.schedule("update", () => this.flushPendingUpdate());
|
|
5081
5665
|
}
|
|
5666
|
+
}
|
|
5667
|
+
getUpdateThrottleMs() {
|
|
5668
|
+
return this.updateThrottleMs;
|
|
5669
|
+
}
|
|
5670
|
+
cleanup() {
|
|
5671
|
+
this.clearAsyncWork();
|
|
5082
5672
|
if (this.editorView) {
|
|
5083
5673
|
this.editorView.dispose();
|
|
5084
5674
|
this.editorView = null;
|
|
@@ -5099,31 +5689,13 @@ var EditorManager = class {
|
|
|
5099
5689
|
}
|
|
5100
5690
|
}
|
|
5101
5691
|
safeClean() {
|
|
5102
|
-
this.
|
|
5103
|
-
this.pendingUpdate = null;
|
|
5104
|
-
this.rafScheduler.cancel("sync-last-known");
|
|
5692
|
+
this.clearAsyncWork();
|
|
5105
5693
|
if (this.scrollWatcher) {
|
|
5106
5694
|
try {
|
|
5107
5695
|
this.scrollWatcher.dispose();
|
|
5108
5696
|
} catch {}
|
|
5109
5697
|
this.scrollWatcher = null;
|
|
5110
5698
|
}
|
|
5111
|
-
if (this.revealDebounceId != null) {
|
|
5112
|
-
clearTimeout(this.revealDebounceId);
|
|
5113
|
-
this.revealDebounceId = null;
|
|
5114
|
-
}
|
|
5115
|
-
if (this.revealIdleTimerId != null) {
|
|
5116
|
-
clearTimeout(this.revealIdleTimerId);
|
|
5117
|
-
this.revealIdleTimerId = null;
|
|
5118
|
-
}
|
|
5119
|
-
if (this.scrollWatcherSuppressionTimer != null) {
|
|
5120
|
-
clearTimeout(this.scrollWatcherSuppressionTimer);
|
|
5121
|
-
this.scrollWatcherSuppressionTimer = null;
|
|
5122
|
-
}
|
|
5123
|
-
this.rafScheduler.cancel("maybe-scroll");
|
|
5124
|
-
this.rafScheduler.cancel("reveal");
|
|
5125
|
-
this.rafScheduler.cancel("immediate-reveal");
|
|
5126
|
-
this.rafScheduler.cancel("maybe-resume");
|
|
5127
5699
|
this._hasScrollBar = false;
|
|
5128
5700
|
this.shouldAutoScroll = !!this.autoScrollInitial;
|
|
5129
5701
|
this.lastScrollTop = 0;
|
|
@@ -5662,7 +6234,7 @@ function useMonaco(monacoOptions = {}) {
|
|
|
5662
6234
|
}
|
|
5663
6235
|
const initialThemeName = monacoOptions.theme ?? requestedThemeName ?? globalRequestedThemeName ?? currentTheme.value;
|
|
5664
6236
|
await ensureThemeRegistered(initialThemeName);
|
|
5665
|
-
editorMgr = new EditorManager(monacoOptions, maxHeightValue, maxHeightCSS, autoScrollOnUpdate, autoScrollInitial, autoScrollThresholdPx, autoScrollThresholdLines, monacoOptions.revealDebounceMs);
|
|
6237
|
+
editorMgr = new EditorManager(monacoOptions, maxHeightValue, maxHeightCSS, autoScrollOnUpdate, autoScrollInitial, autoScrollThresholdPx, autoScrollThresholdLines, monacoOptions.revealDebounceMs, updateThrottleMs);
|
|
5666
6238
|
editorView = await editorMgr.createEditor(container, code, language, initialThemeName);
|
|
5667
6239
|
if (pendingUpdate && editorMgr) {
|
|
5668
6240
|
const { code: queuedCode, lang: queuedLang } = pendingUpdate;
|
|
@@ -5704,6 +6276,23 @@ function useMonaco(monacoOptions = {}) {
|
|
|
5704
6276
|
modifiedModel = models.modified;
|
|
5705
6277
|
return diffEditorView;
|
|
5706
6278
|
}
|
|
6279
|
+
function clearFallbackAsyncWork() {
|
|
6280
|
+
rafScheduler.cancel("update");
|
|
6281
|
+
rafScheduler.cancel("append");
|
|
6282
|
+
rafScheduler.cancel("reveal");
|
|
6283
|
+
pendingUpdate = null;
|
|
6284
|
+
appendBufferScheduled = false;
|
|
6285
|
+
appendBuffer.length = 0;
|
|
6286
|
+
if (revealDebounceId != null) {
|
|
6287
|
+
clearTimeout(revealDebounceId);
|
|
6288
|
+
revealDebounceId = null;
|
|
6289
|
+
}
|
|
6290
|
+
if (updateThrottleTimer != null) {
|
|
6291
|
+
clearTimeout(updateThrottleTimer);
|
|
6292
|
+
updateThrottleTimer = null;
|
|
6293
|
+
}
|
|
6294
|
+
lastFlushTime = 0;
|
|
6295
|
+
}
|
|
5707
6296
|
function cleanupEditor() {
|
|
5708
6297
|
if (editorMgr) {
|
|
5709
6298
|
editorMgr.cleanup();
|
|
@@ -5713,11 +6302,7 @@ function useMonaco(monacoOptions = {}) {
|
|
|
5713
6302
|
diffMgr.cleanup();
|
|
5714
6303
|
diffMgr = null;
|
|
5715
6304
|
}
|
|
5716
|
-
|
|
5717
|
-
pendingUpdate = null;
|
|
5718
|
-
rafScheduler.cancel("append");
|
|
5719
|
-
appendBufferScheduled = false;
|
|
5720
|
-
appendBuffer.length = 0;
|
|
6305
|
+
clearFallbackAsyncWork();
|
|
5721
6306
|
if (!editorMgr && editorView) {
|
|
5722
6307
|
editorView.dispose();
|
|
5723
6308
|
editorView = null;
|
|
@@ -5731,10 +6316,6 @@ function useMonaco(monacoOptions = {}) {
|
|
|
5731
6316
|
themeWatcher();
|
|
5732
6317
|
themeWatcher = null;
|
|
5733
6318
|
}
|
|
5734
|
-
if (updateThrottleTimer != null) {
|
|
5735
|
-
clearTimeout(updateThrottleTimer);
|
|
5736
|
-
updateThrottleTimer = null;
|
|
5737
|
-
}
|
|
5738
6319
|
diffEditorView = null;
|
|
5739
6320
|
originalModel = null;
|
|
5740
6321
|
modifiedModel = null;
|
|
@@ -5800,13 +6381,17 @@ function useMonaco(monacoOptions = {}) {
|
|
|
5800
6381
|
pendingUpdate = null;
|
|
5801
6382
|
const processedCodeLanguage = processedLanguage(codeLanguage);
|
|
5802
6383
|
let prevCode = null;
|
|
5803
|
-
if (appendBuffer.length > 0)
|
|
5804
|
-
|
|
5805
|
-
|
|
5806
|
-
|
|
5807
|
-
|
|
5808
|
-
|
|
5809
|
-
|
|
6384
|
+
if (appendBuffer.length > 0) {
|
|
6385
|
+
appendBuffer.length = 0;
|
|
6386
|
+
appendBufferScheduled = false;
|
|
6387
|
+
rafScheduler.cancel("append");
|
|
6388
|
+
try {
|
|
6389
|
+
prevCode = model.getValue();
|
|
6390
|
+
lastKnownCode = prevCode;
|
|
6391
|
+
} catch {
|
|
6392
|
+
prevCode = lastKnownCode ?? "";
|
|
6393
|
+
}
|
|
6394
|
+
} else {
|
|
5810
6395
|
prevCode = lastKnownCode;
|
|
5811
6396
|
if (prevCode == null) try {
|
|
5812
6397
|
prevCode = model.getValue();
|
|
@@ -5923,9 +6508,10 @@ function useMonaco(monacoOptions = {}) {
|
|
|
5923
6508
|
}
|
|
5924
6509
|
function setUpdateThrottleMs(ms) {
|
|
5925
6510
|
updateThrottleMs = ms;
|
|
6511
|
+
editorMgr === null || editorMgr === void 0 || editorMgr.setUpdateThrottleMs(ms);
|
|
5926
6512
|
}
|
|
5927
6513
|
function getUpdateThrottleMs() {
|
|
5928
|
-
return updateThrottleMs;
|
|
6514
|
+
return (editorMgr === null || editorMgr === void 0 ? void 0 : editorMgr.getUpdateThrottleMs()) ?? updateThrottleMs;
|
|
5929
6515
|
}
|
|
5930
6516
|
function updateDiff(originalCode, modifiedCode, codeLanguage) {
|
|
5931
6517
|
if (diffMgr) diffMgr.updateDiff(originalCode, modifiedCode, codeLanguage);
|
|
@@ -5957,8 +6543,7 @@ function useMonaco(monacoOptions = {}) {
|
|
|
5957
6543
|
createDiffEditor,
|
|
5958
6544
|
cleanupEditor,
|
|
5959
6545
|
safeClean() {
|
|
5960
|
-
|
|
5961
|
-
pendingUpdate = null;
|
|
6546
|
+
clearFallbackAsyncWork();
|
|
5962
6547
|
if (editorMgr) try {
|
|
5963
6548
|
editorMgr.safeClean();
|
|
5964
6549
|
} catch {}
|