@mdzip/editor 2.4.2 → 2.6.0
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/AGENTS.md +8 -0
- package/README.md +322 -5
- package/dist/diff-rendered.d.ts +54 -0
- package/dist/diff-rendered.d.ts.map +1 -0
- package/dist/diff-rendered.js +462 -0
- package/dist/diff-rendered.js.map +1 -0
- package/dist/diff-view-css.d.ts +2 -0
- package/dist/diff-view-css.d.ts.map +1 -1
- package/dist/diff-view-css.js +69 -6
- package/dist/diff-view-css.js.map +1 -1
- package/dist/diff-view.d.ts +112 -9
- package/dist/diff-view.d.ts.map +1 -1
- package/dist/diff-view.js +435 -49
- package/dist/diff-view.js.map +1 -1
- package/dist/front-matter-extension.d.ts.map +1 -1
- package/dist/front-matter-extension.js +2 -8
- package/dist/front-matter-extension.js.map +1 -1
- package/dist/heading-outline.d.ts +66 -0
- package/dist/heading-outline.d.ts.map +1 -0
- package/dist/heading-outline.js +208 -0
- package/dist/heading-outline.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/json-validation.d.ts +97 -0
- package/dist/json-validation.d.ts.map +1 -0
- package/dist/json-validation.js +496 -0
- package/dist/json-validation.js.map +1 -0
- package/dist/library-info.d.ts +7 -2
- package/dist/library-info.d.ts.map +1 -1
- package/dist/library-info.js +8 -2
- package/dist/library-info.js.map +1 -1
- package/dist/manifest-form.d.ts +46 -0
- package/dist/manifest-form.d.ts.map +1 -0
- package/dist/manifest-form.js +327 -0
- package/dist/manifest-form.js.map +1 -0
- package/dist/merge-conflicts.d.ts +56 -0
- package/dist/merge-conflicts.d.ts.map +1 -0
- package/dist/merge-conflicts.js +130 -0
- package/dist/merge-conflicts.js.map +1 -0
- package/dist/merge-regions.d.ts +92 -0
- package/dist/merge-regions.d.ts.map +1 -0
- package/dist/merge-regions.js +416 -0
- package/dist/merge-regions.js.map +1 -0
- package/dist/merge-view.d.ts +267 -0
- package/dist/merge-view.d.ts.map +1 -0
- package/dist/merge-view.js +2039 -0
- package/dist/merge-view.js.map +1 -0
- package/dist/preview-find.d.ts +30 -0
- package/dist/preview-find.d.ts.map +1 -0
- package/dist/preview-find.js +172 -0
- package/dist/preview-find.js.map +1 -0
- package/dist/rendering.d.ts +17 -52
- package/dist/rendering.d.ts.map +1 -1
- package/dist/rendering.js +21 -324
- package/dist/rendering.js.map +1 -1
- package/dist/scroll-anchors.d.ts +33 -0
- package/dist/scroll-anchors.d.ts.map +1 -0
- package/dist/scroll-anchors.js +80 -0
- package/dist/scroll-anchors.js.map +1 -0
- package/dist/view-css.d.ts.map +1 -1
- package/dist/view-css.js +679 -0
- package/dist/view-css.js.map +1 -1
- package/dist/view.d.ts +412 -9
- package/dist/view.d.ts.map +1 -1
- package/dist/view.js +2276 -427
- package/dist/view.js.map +1 -1
- package/dist/workspace-view.d.ts +2 -0
- package/dist/workspace-view.d.ts.map +1 -1
- package/dist/workspace-view.js +25 -2
- package/dist/workspace-view.js.map +1 -1
- package/dist/workspace.d.ts +29 -0
- package/dist/workspace.d.ts.map +1 -1
- package/dist/workspace.js +124 -9
- package/dist/workspace.js.map +1 -1
- package/package.json +93 -83
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
export type MergeSide = 'ours' | 'theirs';
|
|
2
|
+
/**
|
|
3
|
+
* A region's choice: the sides it takes, in order (none: the original for a
|
|
4
|
+
* one-sided change), the original text, the conflict markers (unresolved), or
|
|
5
|
+
* text written by hand.
|
|
6
|
+
*/
|
|
7
|
+
export type RegionChoice = MergeSide[] | 'base' | 'manual' | 'unresolved';
|
|
8
|
+
/** Changed in current only, incoming only, the same in both, or differently in both. */
|
|
9
|
+
export type RegionKind = 'ours' | 'theirs' | 'same' | 'conflict';
|
|
10
|
+
export interface MergeRegion {
|
|
11
|
+
kind: RegionKind;
|
|
12
|
+
/** Each version's text for the region, every line ending in a line break. */
|
|
13
|
+
base: string;
|
|
14
|
+
ours: string;
|
|
15
|
+
theirs: string;
|
|
16
|
+
/** Whether conflict markers for it include the original (diff3 style). */
|
|
17
|
+
hasBase: boolean;
|
|
18
|
+
/** The region's lines in each side's whole text, `[start, end)` from 0. */
|
|
19
|
+
oursLines: [number, number];
|
|
20
|
+
theirsLines: [number, number];
|
|
21
|
+
/** Where it is in the result now. */
|
|
22
|
+
from: number;
|
|
23
|
+
to: number;
|
|
24
|
+
choice: RegionChoice;
|
|
25
|
+
}
|
|
26
|
+
export interface MarkerStyle {
|
|
27
|
+
size: number;
|
|
28
|
+
ours: string;
|
|
29
|
+
base: string;
|
|
30
|
+
theirs: string;
|
|
31
|
+
}
|
|
32
|
+
interface Hunk {
|
|
33
|
+
aStart: number;
|
|
34
|
+
aEnd: number;
|
|
35
|
+
bStart: number;
|
|
36
|
+
bEnd: number;
|
|
37
|
+
}
|
|
38
|
+
export declare class MergeModel {
|
|
39
|
+
/** The result as it is now. */
|
|
40
|
+
text: string;
|
|
41
|
+
readonly regions: MergeRegion[];
|
|
42
|
+
/** Each side's whole text, as the input panes show it. */
|
|
43
|
+
readonly sides: {
|
|
44
|
+
ours: string;
|
|
45
|
+
theirs: string;
|
|
46
|
+
base: string | null;
|
|
47
|
+
};
|
|
48
|
+
readonly markers: MarkerStyle;
|
|
49
|
+
/** Built from the three versions (one-sided changes included), not just conflict markers. */
|
|
50
|
+
readonly fromVersions: boolean;
|
|
51
|
+
private constructor();
|
|
52
|
+
/**
|
|
53
|
+
* From the three versions, finding each region in `result`. Null when the
|
|
54
|
+
* result no longer lines up with them (text both sides share was edited).
|
|
55
|
+
*/
|
|
56
|
+
static fromVersions(result: string, base: string, ours: string, theirs: string): MergeModel | null;
|
|
57
|
+
/** From conflict markers alone: each block is a conflict region; the sides are the result with every block resolved one way. */
|
|
58
|
+
static fromMarkers(result: string): MergeModel;
|
|
59
|
+
/** Conflict blocks left in the result. */
|
|
60
|
+
get remaining(): number;
|
|
61
|
+
/** The text region `index` gets for `choice`. */
|
|
62
|
+
generate(index: number, choice: RegionChoice): string;
|
|
63
|
+
/** The change that sets region `index` to `choice`. */
|
|
64
|
+
change(index: number, choice: RegionChoice): {
|
|
65
|
+
from: number;
|
|
66
|
+
to: number;
|
|
67
|
+
insert: string;
|
|
68
|
+
};
|
|
69
|
+
/** The choice after ticking or unticking `side` on region `index`. */
|
|
70
|
+
toggled(index: number, side: MergeSide): RegionChoice;
|
|
71
|
+
/**
|
|
72
|
+
* Takes the result's new text after an edit: moves each region with
|
|
73
|
+
* `mapPos` (text typed at a region's edge joins it) and reads its choice
|
|
74
|
+
* back from its text.
|
|
75
|
+
*/
|
|
76
|
+
update(text: string, mapPos: (pos: number, assoc: number) => number): void;
|
|
77
|
+
/** Applies a change to the text directly (no editor). */
|
|
78
|
+
apply(change: {
|
|
79
|
+
from: number;
|
|
80
|
+
to: number;
|
|
81
|
+
insert: string;
|
|
82
|
+
}): void;
|
|
83
|
+
/** The region holding offset `pos` of the result, or -1. */
|
|
84
|
+
regionAt(pos: number): number;
|
|
85
|
+
private markerText;
|
|
86
|
+
}
|
|
87
|
+
/** A region's choice, read from its text in the result. */
|
|
88
|
+
export declare function recognize(region: Pick<MergeRegion, 'kind' | 'base' | 'ours' | 'theirs'>, text: string): RegionChoice;
|
|
89
|
+
/** Line diff (Myers): the runs of `a` replaced in `b`, as half-open line ranges. */
|
|
90
|
+
export declare function diffLines(a: string[], b: string[]): Hunk[];
|
|
91
|
+
export {};
|
|
92
|
+
//# sourceMappingURL=merge-regions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge-regions.d.ts","sourceRoot":"","sources":["../src/merge-regions.ts"],"names":[],"mappings":"AAeA,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE1C;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,SAAS,EAAE,GAAG,MAAM,GAAG,QAAQ,GAAG,YAAY,CAAC;AAE1E,wFAAwF;AAC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E,CAoE1D"}
|
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The regions of a three-way merge, for resolving it with checkboxes as the
|
|
3
|
+
* Visual Studio and VS Code merge editors do.
|
|
4
|
+
*
|
|
5
|
+
* Given the common ancestor (base), current (ours) and incoming (theirs), the
|
|
6
|
+
* merge splits the text into stretches all three share and regions where one
|
|
7
|
+
* or both sides changed: a change on one side, the same change on both, or a
|
|
8
|
+
* conflict. Each region's text in the result comes from a choice (which sides,
|
|
9
|
+
* in the order they were ticked), and the choice is read back from the text,
|
|
10
|
+
* so editing the result by hand and ticking boxes stay in step.
|
|
11
|
+
*
|
|
12
|
+
* All texts here use LF line endings.
|
|
13
|
+
*/
|
|
14
|
+
import { findMergeConflicts } from './merge-conflicts.js';
|
|
15
|
+
/** Above this many changed lines the diff gives up and treats the whole text as one change. */
|
|
16
|
+
const MAX_EDIT_DISTANCE = 4000;
|
|
17
|
+
export class MergeModel {
|
|
18
|
+
constructor(text, regions, sides, markers, fromVersions) {
|
|
19
|
+
this.text = text;
|
|
20
|
+
this.regions = regions;
|
|
21
|
+
this.sides = sides;
|
|
22
|
+
this.markers = markers;
|
|
23
|
+
this.fromVersions = fromVersions;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* From the three versions, finding each region in `result`. Null when the
|
|
27
|
+
* result no longer lines up with them (text both sides share was edited).
|
|
28
|
+
*/
|
|
29
|
+
static fromVersions(result, base, ours, theirs) {
|
|
30
|
+
const markers = markerStyle(result);
|
|
31
|
+
const segments = merge3(splitLines(base), splitLines(ours), splitLines(theirs));
|
|
32
|
+
const resultLines = splitLines(result);
|
|
33
|
+
const ranges = locate(resultLines, segments, markers);
|
|
34
|
+
if (!ranges)
|
|
35
|
+
return null;
|
|
36
|
+
const offsets = lineOffsets(resultLines, result.length);
|
|
37
|
+
const regions = [];
|
|
38
|
+
let index = 0;
|
|
39
|
+
for (const segment of segments) {
|
|
40
|
+
if (!('region' in segment))
|
|
41
|
+
continue;
|
|
42
|
+
const [start, end] = ranges[index++];
|
|
43
|
+
const region = { ...segment.region, from: offsets[start], to: offsets[end], choice: 'unresolved' };
|
|
44
|
+
region.choice = recognize(region, result.slice(region.from, region.to));
|
|
45
|
+
regions.push(region);
|
|
46
|
+
}
|
|
47
|
+
return new MergeModel(result, regions, { ours, theirs, base }, markers, true);
|
|
48
|
+
}
|
|
49
|
+
/** From conflict markers alone: each block is a conflict region; the sides are the result with every block resolved one way. */
|
|
50
|
+
static fromMarkers(result) {
|
|
51
|
+
const markers = markerStyle(result);
|
|
52
|
+
const conflicts = findMergeConflicts(result);
|
|
53
|
+
const regions = [];
|
|
54
|
+
let ours = '';
|
|
55
|
+
let theirs = '';
|
|
56
|
+
let base = '';
|
|
57
|
+
let at = 0;
|
|
58
|
+
const hasBase = conflicts.length > 0 && conflicts.every((conflict) => conflict.base !== null);
|
|
59
|
+
for (const conflict of conflicts) {
|
|
60
|
+
const between = result.slice(at, conflict.start);
|
|
61
|
+
ours += between;
|
|
62
|
+
theirs += between;
|
|
63
|
+
base += between;
|
|
64
|
+
const oursStart = countLines(ours);
|
|
65
|
+
const theirsStart = countLines(theirs);
|
|
66
|
+
ours += conflict.ours;
|
|
67
|
+
theirs += conflict.theirs;
|
|
68
|
+
base += conflict.base ?? '';
|
|
69
|
+
regions.push({
|
|
70
|
+
kind: 'conflict',
|
|
71
|
+
base: conflict.base ?? '',
|
|
72
|
+
ours: conflict.ours,
|
|
73
|
+
theirs: conflict.theirs,
|
|
74
|
+
hasBase: conflict.base !== null,
|
|
75
|
+
oursLines: [oursStart, countLines(ours)],
|
|
76
|
+
theirsLines: [theirsStart, countLines(theirs)],
|
|
77
|
+
from: conflict.start,
|
|
78
|
+
to: conflict.end,
|
|
79
|
+
choice: 'unresolved'
|
|
80
|
+
});
|
|
81
|
+
at = conflict.end;
|
|
82
|
+
}
|
|
83
|
+
const rest = result.slice(at);
|
|
84
|
+
return new MergeModel(result, regions, { ours: ours + rest, theirs: theirs + rest, base: hasBase ? base + rest : null }, markers, false);
|
|
85
|
+
}
|
|
86
|
+
/** Conflict blocks left in the result. */
|
|
87
|
+
get remaining() {
|
|
88
|
+
return findMergeConflicts(this.text).length;
|
|
89
|
+
}
|
|
90
|
+
/** The text region `index` gets for `choice`. */
|
|
91
|
+
generate(index, choice) {
|
|
92
|
+
const region = this.regions[index];
|
|
93
|
+
if (choice === 'unresolved')
|
|
94
|
+
return this.markerText(region);
|
|
95
|
+
if (choice === 'base')
|
|
96
|
+
return region.base;
|
|
97
|
+
if (choice === 'manual')
|
|
98
|
+
return this.text.slice(region.from, region.to);
|
|
99
|
+
if (region.kind === 'same')
|
|
100
|
+
return choice.length ? region.ours : region.base;
|
|
101
|
+
if (!choice.length)
|
|
102
|
+
return region.kind === 'conflict' ? this.markerText(region) : region.base;
|
|
103
|
+
return choice.map((side) => region[side]).join('');
|
|
104
|
+
}
|
|
105
|
+
/** The change that sets region `index` to `choice`. */
|
|
106
|
+
change(index, choice) {
|
|
107
|
+
const region = this.regions[index];
|
|
108
|
+
return { from: region.from, to: region.to, insert: this.generate(index, choice) };
|
|
109
|
+
}
|
|
110
|
+
/** The choice after ticking or unticking `side` on region `index`. */
|
|
111
|
+
toggled(index, side) {
|
|
112
|
+
const region = this.regions[index];
|
|
113
|
+
const current = Array.isArray(region.choice) ? [...region.choice] : [];
|
|
114
|
+
// Both sides made the same change: one text, so both boxes go together.
|
|
115
|
+
if (region.kind === 'same')
|
|
116
|
+
return current.length ? [] : ['ours', 'theirs'];
|
|
117
|
+
const next = current.includes(side) ? current.filter((candidate) => candidate !== side) : [...current, side];
|
|
118
|
+
if (!next.length && region.kind === 'conflict')
|
|
119
|
+
return 'unresolved';
|
|
120
|
+
return next;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Takes the result's new text after an edit: moves each region with
|
|
124
|
+
* `mapPos` (text typed at a region's edge joins it) and reads its choice
|
|
125
|
+
* back from its text.
|
|
126
|
+
*/
|
|
127
|
+
update(text, mapPos) {
|
|
128
|
+
for (const region of this.regions) {
|
|
129
|
+
region.from = mapPos(region.from, -1);
|
|
130
|
+
region.to = Math.max(region.from, mapPos(region.to, 1));
|
|
131
|
+
}
|
|
132
|
+
this.text = text;
|
|
133
|
+
for (const region of this.regions)
|
|
134
|
+
region.choice = recognize(region, text.slice(region.from, region.to));
|
|
135
|
+
}
|
|
136
|
+
/** Applies a change to the text directly (no editor). */
|
|
137
|
+
apply(change) {
|
|
138
|
+
const delta = change.insert.length - (change.to - change.from);
|
|
139
|
+
const text = this.text.slice(0, change.from) + change.insert + this.text.slice(change.to);
|
|
140
|
+
this.update(text, (pos, assoc) => {
|
|
141
|
+
if (pos < change.from || (pos === change.from && assoc < 0))
|
|
142
|
+
return pos;
|
|
143
|
+
if (pos > change.to || (pos === change.to && assoc > 0))
|
|
144
|
+
return pos + delta;
|
|
145
|
+
return assoc < 0 ? change.from : change.from + change.insert.length;
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
/** The region holding offset `pos` of the result, or -1. */
|
|
149
|
+
regionAt(pos) {
|
|
150
|
+
return this.regions.findIndex((region) => pos >= region.from && (pos < region.to || (pos === region.from && region.from === region.to)));
|
|
151
|
+
}
|
|
152
|
+
markerText(region) {
|
|
153
|
+
const { size } = this.markers;
|
|
154
|
+
const line = (char, label) => `${char.repeat(size)}${label ? ` ${label}` : ''}\n`;
|
|
155
|
+
return line('<', this.markers.ours) + region.ours
|
|
156
|
+
+ (region.hasBase ? line('|', this.markers.base) + region.base : '')
|
|
157
|
+
+ line('=', '') + region.theirs + line('>', this.markers.theirs);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/** A region's choice, read from its text in the result. */
|
|
161
|
+
export function recognize(region, text) {
|
|
162
|
+
const blocks = findMergeConflicts(text);
|
|
163
|
+
if (blocks.length === 1 && blocks[0].start === 0 && blocks[0].end === text.length)
|
|
164
|
+
return 'unresolved';
|
|
165
|
+
if (region.kind === 'same') {
|
|
166
|
+
if (text === region.ours)
|
|
167
|
+
return ['ours', 'theirs'];
|
|
168
|
+
return text === region.base ? [] : 'manual';
|
|
169
|
+
}
|
|
170
|
+
if (region.kind === 'ours') {
|
|
171
|
+
if (text === region.ours)
|
|
172
|
+
return ['ours'];
|
|
173
|
+
return text === region.base ? [] : 'manual';
|
|
174
|
+
}
|
|
175
|
+
if (region.kind === 'theirs') {
|
|
176
|
+
if (text === region.theirs)
|
|
177
|
+
return ['theirs'];
|
|
178
|
+
return text === region.base ? [] : 'manual';
|
|
179
|
+
}
|
|
180
|
+
if (text === region.ours)
|
|
181
|
+
return ['ours'];
|
|
182
|
+
if (text === region.theirs)
|
|
183
|
+
return ['theirs'];
|
|
184
|
+
if (text === region.ours + region.theirs)
|
|
185
|
+
return ['ours', 'theirs'];
|
|
186
|
+
if (text === region.theirs + region.ours)
|
|
187
|
+
return ['theirs', 'ours'];
|
|
188
|
+
if (text === region.base)
|
|
189
|
+
return 'base';
|
|
190
|
+
return 'manual';
|
|
191
|
+
}
|
|
192
|
+
// ------------------------------------------------------------ the merge
|
|
193
|
+
/** Lines of a text; the last item is '' when it ends with a line break. */
|
|
194
|
+
function splitLines(text) {
|
|
195
|
+
return text.split('\n');
|
|
196
|
+
}
|
|
197
|
+
function joinRegion(lines) {
|
|
198
|
+
return lines.map((line) => `${line}\n`).join('');
|
|
199
|
+
}
|
|
200
|
+
function lineOffsets(lines, length) {
|
|
201
|
+
const offsets = [0];
|
|
202
|
+
for (const line of lines)
|
|
203
|
+
offsets.push(Math.min(length, offsets[offsets.length - 1] + line.length + 1));
|
|
204
|
+
return offsets;
|
|
205
|
+
}
|
|
206
|
+
function countLines(text) {
|
|
207
|
+
let count = 0;
|
|
208
|
+
for (let i = text.indexOf('\n'); i >= 0; i = text.indexOf('\n', i + 1))
|
|
209
|
+
count += 1;
|
|
210
|
+
return count;
|
|
211
|
+
}
|
|
212
|
+
/** Line diff (Myers): the runs of `a` replaced in `b`, as half-open line ranges. */
|
|
213
|
+
export function diffLines(a, b) {
|
|
214
|
+
let start = 0;
|
|
215
|
+
while (start < a.length && start < b.length && a[start] === b[start])
|
|
216
|
+
start += 1;
|
|
217
|
+
let endA = a.length;
|
|
218
|
+
let endB = b.length;
|
|
219
|
+
while (endA > start && endB > start && a[endA - 1] === b[endB - 1]) {
|
|
220
|
+
endA -= 1;
|
|
221
|
+
endB -= 1;
|
|
222
|
+
}
|
|
223
|
+
const n = endA - start;
|
|
224
|
+
const m = endB - start;
|
|
225
|
+
if (!n && !m)
|
|
226
|
+
return [];
|
|
227
|
+
if (!n || !m)
|
|
228
|
+
return [{ aStart: start, aEnd: endA, bStart: start, bEnd: endB }];
|
|
229
|
+
const A = a.slice(start, endA);
|
|
230
|
+
const B = b.slice(start, endB);
|
|
231
|
+
const max = Math.min(n + m, MAX_EDIT_DISTANCE);
|
|
232
|
+
const offset = max + 1;
|
|
233
|
+
const v = new Int32Array(2 * max + 3);
|
|
234
|
+
const trace = [];
|
|
235
|
+
let found = false;
|
|
236
|
+
for (let d = 0; d <= max && !found; d++) {
|
|
237
|
+
trace.push(v.slice());
|
|
238
|
+
for (let k = -d; k <= d; k += 2) {
|
|
239
|
+
let x = k === -d || (k !== d && v[offset + k - 1] < v[offset + k + 1]) ? v[offset + k + 1] : v[offset + k - 1] + 1;
|
|
240
|
+
let y = x - k;
|
|
241
|
+
while (x < n && y < m && A[x] === B[y]) {
|
|
242
|
+
x += 1;
|
|
243
|
+
y += 1;
|
|
244
|
+
}
|
|
245
|
+
v[offset + k] = x;
|
|
246
|
+
if (x >= n && y >= m) {
|
|
247
|
+
found = true;
|
|
248
|
+
break;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
if (!found)
|
|
253
|
+
return [{ aStart: start, aEnd: endA, bStart: start, bEnd: endB }];
|
|
254
|
+
// Walk back to collect the matching lines.
|
|
255
|
+
const matches = [];
|
|
256
|
+
let x = n;
|
|
257
|
+
let y = m;
|
|
258
|
+
for (let d = trace.length - 1; d >= 0; d--) {
|
|
259
|
+
const previous = trace[d];
|
|
260
|
+
const k = x - y;
|
|
261
|
+
const prevK = k === -d || (k !== d && previous[offset + k - 1] < previous[offset + k + 1]) ? k + 1 : k - 1;
|
|
262
|
+
const prevX = d === 0 ? 0 : previous[offset + prevK];
|
|
263
|
+
const prevY = d === 0 ? 0 : prevX - prevK;
|
|
264
|
+
while (x > prevX && y > prevY) {
|
|
265
|
+
x -= 1;
|
|
266
|
+
y -= 1;
|
|
267
|
+
matches.push([x, y]);
|
|
268
|
+
}
|
|
269
|
+
x = prevX;
|
|
270
|
+
y = prevY;
|
|
271
|
+
}
|
|
272
|
+
matches.reverse();
|
|
273
|
+
const hunks = [];
|
|
274
|
+
let lastA = -1;
|
|
275
|
+
let lastB = -1;
|
|
276
|
+
for (const [ma, mb] of [...matches, [n, m]]) {
|
|
277
|
+
if (ma > lastA + 1 || mb > lastB + 1) {
|
|
278
|
+
hunks.push({ aStart: start + lastA + 1, aEnd: start + ma, bStart: start + lastB + 1, bEnd: start + mb });
|
|
279
|
+
}
|
|
280
|
+
lastA = ma;
|
|
281
|
+
lastB = mb;
|
|
282
|
+
}
|
|
283
|
+
return hunks;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Three-way merge of line arrays. Changes that overlap or touch are one
|
|
287
|
+
* region, as `git merge-file` groups them.
|
|
288
|
+
*/
|
|
289
|
+
function merge3(base, ours, theirs) {
|
|
290
|
+
const hunks = [
|
|
291
|
+
...diffLines(base, ours).map((hunk) => ({ ...hunk, side: 'ours' })),
|
|
292
|
+
...diffLines(base, theirs).map((hunk) => ({ ...hunk, side: 'theirs' }))
|
|
293
|
+
].sort((a, b) => a.aStart - b.aStart || a.aEnd - b.aEnd);
|
|
294
|
+
const segments = [];
|
|
295
|
+
let baseAt = 0;
|
|
296
|
+
let deltaOurs = 0;
|
|
297
|
+
let deltaTheirs = 0;
|
|
298
|
+
let i = 0;
|
|
299
|
+
while (i < hunks.length) {
|
|
300
|
+
const group = [hunks[i]];
|
|
301
|
+
let groupStart = hunks[i].aStart;
|
|
302
|
+
let groupEnd = hunks[i].aEnd;
|
|
303
|
+
i += 1;
|
|
304
|
+
while (i < hunks.length && hunks[i].aStart <= groupEnd) {
|
|
305
|
+
groupEnd = Math.max(groupEnd, hunks[i].aEnd);
|
|
306
|
+
groupStart = Math.min(groupStart, hunks[i].aStart);
|
|
307
|
+
group.push(hunks[i]);
|
|
308
|
+
i += 1;
|
|
309
|
+
}
|
|
310
|
+
if (groupStart > baseAt)
|
|
311
|
+
segments.push({ same: base.slice(baseAt, groupStart) });
|
|
312
|
+
const sideRange = (side, delta) => {
|
|
313
|
+
const own = group.filter((hunk) => hunk.side === side);
|
|
314
|
+
const grown = own.reduce((sum, hunk) => sum + (hunk.bEnd - hunk.bStart) - (hunk.aEnd - hunk.aStart), 0);
|
|
315
|
+
return [groupStart + delta, groupEnd + delta + grown, delta + grown];
|
|
316
|
+
};
|
|
317
|
+
const [oursStart, oursEnd, nextOurs] = sideRange('ours', deltaOurs);
|
|
318
|
+
const [theirsStart, theirsEnd, nextTheirs] = sideRange('theirs', deltaTheirs);
|
|
319
|
+
const baseLines = base.slice(groupStart, groupEnd);
|
|
320
|
+
const oursLines = ours.slice(oursStart, oursEnd);
|
|
321
|
+
const theirsLines = theirs.slice(theirsStart, theirsEnd);
|
|
322
|
+
const touchesOurs = group.some((hunk) => hunk.side === 'ours');
|
|
323
|
+
const touchesTheirs = group.some((hunk) => hunk.side === 'theirs');
|
|
324
|
+
const kind = touchesOurs && touchesTheirs
|
|
325
|
+
? (oursLines.join('\n') === theirsLines.join('\n') && oursLines.length === theirsLines.length ? 'same' : 'conflict')
|
|
326
|
+
: touchesOurs ? 'ours' : 'theirs';
|
|
327
|
+
segments.push({
|
|
328
|
+
region: {
|
|
329
|
+
kind,
|
|
330
|
+
base: joinRegion(baseLines),
|
|
331
|
+
ours: joinRegion(oursLines),
|
|
332
|
+
theirs: joinRegion(theirsLines),
|
|
333
|
+
hasBase: true,
|
|
334
|
+
oursLines: [oursStart, oursEnd],
|
|
335
|
+
theirsLines: [theirsStart, theirsEnd]
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
deltaOurs = nextOurs;
|
|
339
|
+
deltaTheirs = nextTheirs;
|
|
340
|
+
baseAt = groupEnd;
|
|
341
|
+
}
|
|
342
|
+
if (baseAt < base.length)
|
|
343
|
+
segments.push({ same: base.slice(baseAt) });
|
|
344
|
+
return segments;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Each region's line range in the result: the stretches all three share
|
|
348
|
+
* must appear in order, and a region is whatever lies between them. Where a
|
|
349
|
+
* shared stretch appears more than once, the place that makes the region read
|
|
350
|
+
* as one of its known choices wins. Null when a stretch is missing.
|
|
351
|
+
*/
|
|
352
|
+
function locate(result, segments, markers) {
|
|
353
|
+
const ranges = [];
|
|
354
|
+
let cursor = 0;
|
|
355
|
+
let pending = null;
|
|
356
|
+
const matchesAt = (at, lines) => {
|
|
357
|
+
if (at + lines.length > result.length)
|
|
358
|
+
return false;
|
|
359
|
+
for (let j = 0; j < lines.length; j++)
|
|
360
|
+
if (result[at + j] !== lines[j])
|
|
361
|
+
return false;
|
|
362
|
+
return true;
|
|
363
|
+
};
|
|
364
|
+
for (const segment of segments) {
|
|
365
|
+
if ('region' in segment) {
|
|
366
|
+
pending = segment.region;
|
|
367
|
+
continue;
|
|
368
|
+
}
|
|
369
|
+
const lines = segment.same;
|
|
370
|
+
if (!pending) {
|
|
371
|
+
if (!matchesAt(cursor, lines))
|
|
372
|
+
return null;
|
|
373
|
+
cursor += lines.length;
|
|
374
|
+
continue;
|
|
375
|
+
}
|
|
376
|
+
let chosen = -1;
|
|
377
|
+
for (let at = cursor; at + lines.length <= result.length; at++) {
|
|
378
|
+
if (!matchesAt(at, lines))
|
|
379
|
+
continue;
|
|
380
|
+
if (chosen < 0)
|
|
381
|
+
chosen = at;
|
|
382
|
+
const text = joinRegion(result.slice(cursor, at));
|
|
383
|
+
if (recognize(pending, text) !== 'manual' || isMarkerBlock(text, markers)) {
|
|
384
|
+
chosen = at;
|
|
385
|
+
break;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
if (chosen < 0)
|
|
389
|
+
return null;
|
|
390
|
+
ranges.push([cursor, chosen]);
|
|
391
|
+
pending = null;
|
|
392
|
+
cursor = chosen + lines.length;
|
|
393
|
+
}
|
|
394
|
+
if (pending) {
|
|
395
|
+
ranges.push([cursor, result.length]);
|
|
396
|
+
}
|
|
397
|
+
else if (cursor !== result.length) {
|
|
398
|
+
return null;
|
|
399
|
+
}
|
|
400
|
+
return ranges;
|
|
401
|
+
}
|
|
402
|
+
function isMarkerBlock(text, _markers) {
|
|
403
|
+
const blocks = findMergeConflicts(text);
|
|
404
|
+
return blocks.length === 1 && blocks[0].start === 0 && blocks[0].end === text.length;
|
|
405
|
+
}
|
|
406
|
+
/** The marker size and labels the result's conflicts use, or Git's defaults. */
|
|
407
|
+
function markerStyle(text) {
|
|
408
|
+
const [first] = findMergeConflicts(text);
|
|
409
|
+
if (!first)
|
|
410
|
+
return { size: 7, ours: 'ours', base: 'base', theirs: 'theirs' };
|
|
411
|
+
let size = 0;
|
|
412
|
+
while (text[first.start + size] === '<')
|
|
413
|
+
size += 1;
|
|
414
|
+
return { size, ours: first.oursLabel, base: first.baseLabel ?? 'base', theirs: first.theirsLabel };
|
|
415
|
+
}
|
|
416
|
+
//# sourceMappingURL=merge-regions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge-regions.js","sourceRoot":"","sources":["../src/merge-regions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AA+C1D,+FAA+F;AAC/F,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAE/B,MAAM,OAAO,UAAU;IAUrB,YAAoB,IAAY,EAAE,OAAsB,EAAE,KAA0B,EAAE,OAAoB,EAAE,YAAqB;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