@codingame/monaco-vscode-extensions-service-override 1.85.0 → 1.85.2
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/extensions.js +3 -3
- package/package.json +3 -3
- package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents2.js +3 -3
- package/vscode/src/vs/workbench/api/browser/mainThreadCustomEditors.js +1 -1
- package/vscode/src/vs/workbench/api/browser/mainThreadEditorTabs.js +3 -3
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookSaveParticipant.js +1 -1
- package/vscode/src/vs/workbench/api/browser/mainThreadTask.js +8 -8
- package/vscode/src/vs/workbench/api/browser/mainThreadTerminalService.js +1 -1
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.js +2 -2
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsController.js +3 -3
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsTreeViewer.js +2 -2
- package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveEditorInput.js +1 -1
- package/override/vs/workbench/contrib/notebook/common/notebookEditorInput.js +0 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.js +0 -40
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditorInput.js +0 -141
- package/vscode/src/vs/workbench/contrib/chat/browser/chatFollowups.js +0 -37
- package/vscode/src/vs/workbench/contrib/chat/browser/chatInputPart.js +0 -342
- package/vscode/src/vs/workbench/contrib/chat/browser/chatListRenderer.js +0 -1197
- package/vscode/src/vs/workbench/contrib/chat/browser/chatMarkdownDecorationsRenderer.js +0 -117
- package/vscode/src/vs/workbench/contrib/chat/browser/chatOptions.js +0 -83
- package/vscode/src/vs/workbench/contrib/chat/browser/chatWidget.js +0 -543
- package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.js +0 -292
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatDynamicVariables.js +0 -169
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chat.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/chat/common/chatModel.js +0 -255
- package/vscode/src/vs/workbench/contrib/chat/common/chatRequestParser.js +0 -195
- package/vscode/src/vs/workbench/contrib/chat/common/chatViewModel.js +0 -260
- package/vscode/src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.js +0 -5
- package/vscode/src/vs/workbench/contrib/chat/common/chatWordCounter.js +0 -26
- package/vscode/src/vs/workbench/contrib/comments/browser/commentColors.js +0 -63
- package/vscode/src/vs/workbench/contrib/comments/browser/commentFormActions.js +0 -51
- package/vscode/src/vs/workbench/contrib/comments/browser/commentNode.js +0 -649
- package/vscode/src/vs/workbench/contrib/comments/browser/commentReply.js +0 -302
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadAdditionalActions.js +0 -62
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadBody.js +0 -251
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadHeader.js +0 -109
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadWidget.js +0 -335
- package/vscode/src/vs/workbench/contrib/comments/browser/media/review.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/comments/browser/reactionsAction.js +0 -101
- package/vscode/src/vs/workbench/contrib/comments/browser/timestamp.js +0 -57
- package/vscode/src/vs/workbench/contrib/comments/common/commentsConfiguration.js +0 -3
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorInput.js +0 -144
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel.js +0 -482
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeMarkers/mergeMarkersController.js +0 -6
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/diffComputer.js +0 -92
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/editing.js +0 -56
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/lineRange.js +0 -110
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/mapping.js +0 -260
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/mergeEditorModel.js +0 -616
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/modifiedBaseRange.js +0 -309
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/rangeUtils.js +0 -38
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/textModelDiffs.js +0 -167
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/telemetry.js +0 -80
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/utils.js +0 -70
- package/vscode/src/vs/workbench/contrib/mergeEditor/common/mergeEditor.js +0 -3
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModel.js +0 -108
- package/vscode/src/vs/workbench/contrib/tasks/common/tasks.js +0 -506
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalProcessExtHostProxy.js +0 -132
- package/vscode/src/vs/workbench/services/workingCopy/common/resourceWorkingCopy.js +0 -79
|
@@ -1,309 +0,0 @@
|
|
|
1
|
-
import { equals, tieBreakComparators, compareBy, numberComparator } from 'monaco-editor/esm/vs/base/common/arrays.js';
|
|
2
|
-
import { BugIndicatingError } from 'monaco-editor/esm/vs/base/common/errors.js';
|
|
3
|
-
import { splitLines } from 'monaco-editor/esm/vs/base/common/strings.js';
|
|
4
|
-
import { Position } from 'monaco-editor/esm/vs/editor/common/core/position.js';
|
|
5
|
-
import { Range } from 'monaco-editor/esm/vs/editor/common/core/range.js';
|
|
6
|
-
import { RangeEdit, LineRangeEdit } from './editing.js';
|
|
7
|
-
import { MappingAlignment, DetailedLineRangeMapping } from './mapping.js';
|
|
8
|
-
import { concatArrays } from '../utils.js';
|
|
9
|
-
|
|
10
|
-
class ModifiedBaseRange {
|
|
11
|
-
static fromDiffs(diffs1, diffs2, baseTextModel, input1TextModel, input2TextModel) {
|
|
12
|
-
const alignments = MappingAlignment.compute(diffs1, diffs2);
|
|
13
|
-
return ( alignments.map((a) => ( new ModifiedBaseRange(
|
|
14
|
-
a.inputRange,
|
|
15
|
-
baseTextModel,
|
|
16
|
-
a.output1Range,
|
|
17
|
-
input1TextModel,
|
|
18
|
-
a.output1LineMappings,
|
|
19
|
-
a.output2Range,
|
|
20
|
-
input2TextModel,
|
|
21
|
-
a.output2LineMappings
|
|
22
|
-
))));
|
|
23
|
-
}
|
|
24
|
-
constructor(baseRange, baseTextModel, input1Range, input1TextModel,
|
|
25
|
-
input1Diffs, input2Range, input2TextModel,
|
|
26
|
-
input2Diffs) {
|
|
27
|
-
this.baseRange = baseRange;
|
|
28
|
-
this.baseTextModel = baseTextModel;
|
|
29
|
-
this.input1Range = input1Range;
|
|
30
|
-
this.input1TextModel = input1TextModel;
|
|
31
|
-
this.input1Diffs = input1Diffs;
|
|
32
|
-
this.input2Range = input2Range;
|
|
33
|
-
this.input2TextModel = input2TextModel;
|
|
34
|
-
this.input2Diffs = input2Diffs;
|
|
35
|
-
this.input1CombinedDiff = DetailedLineRangeMapping.join(this.input1Diffs);
|
|
36
|
-
this.input2CombinedDiff = DetailedLineRangeMapping.join(this.input2Diffs);
|
|
37
|
-
this.isEqualChange = equals(this.input1Diffs, this.input2Diffs, (a, b) => a.getLineEdit().equals(b.getLineEdit()));
|
|
38
|
-
this.smartInput1LineRangeEdit = null;
|
|
39
|
-
this.smartInput2LineRangeEdit = null;
|
|
40
|
-
this.dumbInput1LineRangeEdit = null;
|
|
41
|
-
this.dumbInput2LineRangeEdit = null;
|
|
42
|
-
if (this.input1Diffs.length === 0 && this.input2Diffs.length === 0) {
|
|
43
|
-
throw new BugIndicatingError('must have at least one diff');
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
getInputRange(inputNumber) {
|
|
47
|
-
return inputNumber === 1 ? this.input1Range : this.input2Range;
|
|
48
|
-
}
|
|
49
|
-
getInputCombinedDiff(inputNumber) {
|
|
50
|
-
return inputNumber === 1 ? this.input1CombinedDiff : this.input2CombinedDiff;
|
|
51
|
-
}
|
|
52
|
-
getInputDiffs(inputNumber) {
|
|
53
|
-
return inputNumber === 1 ? this.input1Diffs : this.input2Diffs;
|
|
54
|
-
}
|
|
55
|
-
get isConflicting() {
|
|
56
|
-
return this.input1Diffs.length > 0 && this.input2Diffs.length > 0;
|
|
57
|
-
}
|
|
58
|
-
get canBeCombined() {
|
|
59
|
-
return this.smartCombineInputs(1) !== undefined;
|
|
60
|
-
}
|
|
61
|
-
get isOrderRelevant() {
|
|
62
|
-
const input1 = this.smartCombineInputs(1);
|
|
63
|
-
const input2 = this.smartCombineInputs(2);
|
|
64
|
-
if (!input1 || !input2) {
|
|
65
|
-
return false;
|
|
66
|
-
}
|
|
67
|
-
return !input1.equals(input2);
|
|
68
|
-
}
|
|
69
|
-
getEditForBase(state) {
|
|
70
|
-
const diffs = [];
|
|
71
|
-
if (state.includesInput1 && this.input1CombinedDiff) {
|
|
72
|
-
diffs.push({ diff: this.input1CombinedDiff, inputNumber: 1 });
|
|
73
|
-
}
|
|
74
|
-
if (state.includesInput2 && this.input2CombinedDiff) {
|
|
75
|
-
diffs.push({ diff: this.input2CombinedDiff, inputNumber: 2 });
|
|
76
|
-
}
|
|
77
|
-
if (diffs.length === 0) {
|
|
78
|
-
return { edit: undefined, effectiveState: ModifiedBaseRangeState.base };
|
|
79
|
-
}
|
|
80
|
-
if (diffs.length === 1) {
|
|
81
|
-
return { edit: diffs[0].diff.getLineEdit(), effectiveState: ModifiedBaseRangeState.base.withInputValue(diffs[0].inputNumber, true, false) };
|
|
82
|
-
}
|
|
83
|
-
if (state.kind !== ModifiedBaseRangeStateKind.both) {
|
|
84
|
-
throw new BugIndicatingError();
|
|
85
|
-
}
|
|
86
|
-
const smartCombinedEdit = state.smartCombination ? this.smartCombineInputs(state.firstInput) : this.dumbCombineInputs(state.firstInput);
|
|
87
|
-
if (smartCombinedEdit) {
|
|
88
|
-
return { edit: smartCombinedEdit, effectiveState: state };
|
|
89
|
-
}
|
|
90
|
-
return {
|
|
91
|
-
edit: diffs[getOtherInputNumber(state.firstInput) - 1].diff.getLineEdit(),
|
|
92
|
-
effectiveState: ModifiedBaseRangeState.base.withInputValue(getOtherInputNumber(state.firstInput), true, false),
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
smartCombineInputs(firstInput) {
|
|
96
|
-
if (firstInput === 1 && this.smartInput1LineRangeEdit !== null) {
|
|
97
|
-
return this.smartInput1LineRangeEdit;
|
|
98
|
-
}
|
|
99
|
-
else if (firstInput === 2 && this.smartInput2LineRangeEdit !== null) {
|
|
100
|
-
return this.smartInput2LineRangeEdit;
|
|
101
|
-
}
|
|
102
|
-
const combinedDiffs = concatArrays(this.input1Diffs.flatMap((diffs) => ( diffs.rangeMappings.map((diff) => ({ diff, input: 1 })))), this.input2Diffs.flatMap((diffs) => ( diffs.rangeMappings.map((diff) => ({ diff, input: 2 }))))).sort(tieBreakComparators(compareBy((d) => d.diff.inputRange, Range.compareRangesUsingStarts), compareBy((d) => (d.input === firstInput ? 1 : 2), numberComparator)));
|
|
103
|
-
const sortedEdits = ( combinedDiffs.map(d => {
|
|
104
|
-
const sourceTextModel = d.input === 1 ? this.input1TextModel : this.input2TextModel;
|
|
105
|
-
return ( new RangeEdit(d.diff.inputRange, sourceTextModel.getValueInRange(d.diff.outputRange)));
|
|
106
|
-
}));
|
|
107
|
-
const result = editsToLineRangeEdit(this.baseRange, sortedEdits, this.baseTextModel);
|
|
108
|
-
if (firstInput === 1) {
|
|
109
|
-
this.smartInput1LineRangeEdit = result;
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
this.smartInput2LineRangeEdit = result;
|
|
113
|
-
}
|
|
114
|
-
return result;
|
|
115
|
-
}
|
|
116
|
-
dumbCombineInputs(firstInput) {
|
|
117
|
-
if (firstInput === 1 && this.dumbInput1LineRangeEdit !== null) {
|
|
118
|
-
return this.dumbInput1LineRangeEdit;
|
|
119
|
-
}
|
|
120
|
-
else if (firstInput === 2 && this.dumbInput2LineRangeEdit !== null) {
|
|
121
|
-
return this.dumbInput2LineRangeEdit;
|
|
122
|
-
}
|
|
123
|
-
let input1Lines = this.input1Range.getLines(this.input1TextModel);
|
|
124
|
-
let input2Lines = this.input2Range.getLines(this.input2TextModel);
|
|
125
|
-
if (firstInput === 2) {
|
|
126
|
-
[input1Lines, input2Lines] = [input2Lines, input1Lines];
|
|
127
|
-
}
|
|
128
|
-
const result = ( new LineRangeEdit(this.baseRange, input1Lines.concat(input2Lines)));
|
|
129
|
-
if (firstInput === 1) {
|
|
130
|
-
this.dumbInput1LineRangeEdit = result;
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
this.dumbInput2LineRangeEdit = result;
|
|
134
|
-
}
|
|
135
|
-
return result;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
function editsToLineRangeEdit(range, sortedEdits, textModel) {
|
|
139
|
-
let text = '';
|
|
140
|
-
const startsLineBefore = range.startLineNumber > 1;
|
|
141
|
-
let currentPosition = startsLineBefore
|
|
142
|
-
? ( new Position(
|
|
143
|
-
range.startLineNumber - 1,
|
|
144
|
-
textModel.getLineMaxColumn(range.startLineNumber - 1)
|
|
145
|
-
))
|
|
146
|
-
: ( new Position(range.startLineNumber, 1));
|
|
147
|
-
for (const edit of sortedEdits) {
|
|
148
|
-
const diffStart = edit.range.getStartPosition();
|
|
149
|
-
if (!currentPosition.isBeforeOrEqual(diffStart)) {
|
|
150
|
-
return undefined;
|
|
151
|
-
}
|
|
152
|
-
let originalText = textModel.getValueInRange(Range.fromPositions(currentPosition, diffStart));
|
|
153
|
-
if (diffStart.lineNumber > textModel.getLineCount()) {
|
|
154
|
-
originalText += '\n';
|
|
155
|
-
}
|
|
156
|
-
text += originalText;
|
|
157
|
-
text += edit.newText;
|
|
158
|
-
currentPosition = edit.range.getEndPosition();
|
|
159
|
-
}
|
|
160
|
-
const endsLineAfter = range.endLineNumberExclusive <= textModel.getLineCount();
|
|
161
|
-
const end = endsLineAfter ? ( new Position(range.endLineNumberExclusive, 1)) : ( new Position(
|
|
162
|
-
range.endLineNumberExclusive - 1,
|
|
163
|
-
1073741824
|
|
164
|
-
));
|
|
165
|
-
const originalText = textModel.getValueInRange(Range.fromPositions(currentPosition, end));
|
|
166
|
-
text += originalText;
|
|
167
|
-
const lines = splitLines(text);
|
|
168
|
-
if (startsLineBefore) {
|
|
169
|
-
if (lines[0] !== '') {
|
|
170
|
-
return undefined;
|
|
171
|
-
}
|
|
172
|
-
lines.shift();
|
|
173
|
-
}
|
|
174
|
-
if (endsLineAfter) {
|
|
175
|
-
if (lines[lines.length - 1] !== '') {
|
|
176
|
-
return undefined;
|
|
177
|
-
}
|
|
178
|
-
lines.pop();
|
|
179
|
-
}
|
|
180
|
-
return ( new LineRangeEdit(range, lines));
|
|
181
|
-
}
|
|
182
|
-
var ModifiedBaseRangeStateKind;
|
|
183
|
-
( (function(ModifiedBaseRangeStateKind) {
|
|
184
|
-
ModifiedBaseRangeStateKind[ModifiedBaseRangeStateKind["base"] = 0] = "base";
|
|
185
|
-
ModifiedBaseRangeStateKind[ModifiedBaseRangeStateKind["input1"] = 1] = "input1";
|
|
186
|
-
ModifiedBaseRangeStateKind[ModifiedBaseRangeStateKind["input2"] = 2] = "input2";
|
|
187
|
-
ModifiedBaseRangeStateKind[ModifiedBaseRangeStateKind["both"] = 3] = "both";
|
|
188
|
-
ModifiedBaseRangeStateKind[ModifiedBaseRangeStateKind["unrecognized"] = 4] = "unrecognized";
|
|
189
|
-
})(ModifiedBaseRangeStateKind || (ModifiedBaseRangeStateKind = {})));
|
|
190
|
-
function getOtherInputNumber(inputNumber) {
|
|
191
|
-
return inputNumber === 1 ? 2 : 1;
|
|
192
|
-
}
|
|
193
|
-
class AbstractModifiedBaseRangeState {
|
|
194
|
-
constructor() { }
|
|
195
|
-
get includesInput1() { return false; }
|
|
196
|
-
get includesInput2() { return false; }
|
|
197
|
-
includesInput(inputNumber) {
|
|
198
|
-
return inputNumber === 1 ? this.includesInput1 : this.includesInput2;
|
|
199
|
-
}
|
|
200
|
-
isInputIncluded(inputNumber) {
|
|
201
|
-
return inputNumber === 1 ? this.includesInput1 : this.includesInput2;
|
|
202
|
-
}
|
|
203
|
-
toggle(inputNumber) {
|
|
204
|
-
return this.withInputValue(inputNumber, !this.includesInput(inputNumber), true);
|
|
205
|
-
}
|
|
206
|
-
getInput(inputNumber) {
|
|
207
|
-
if (!this.isInputIncluded(inputNumber)) {
|
|
208
|
-
return 0 ;
|
|
209
|
-
}
|
|
210
|
-
return 1 ;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
class ModifiedBaseRangeStateBase extends AbstractModifiedBaseRangeState {
|
|
214
|
-
get kind() { return ModifiedBaseRangeStateKind.base; }
|
|
215
|
-
toString() { return 'base'; }
|
|
216
|
-
swap() { return this; }
|
|
217
|
-
withInputValue(inputNumber, value, smartCombination = false) {
|
|
218
|
-
if (inputNumber === 1) {
|
|
219
|
-
return value ? ( new ModifiedBaseRangeStateInput1()) : this;
|
|
220
|
-
}
|
|
221
|
-
else {
|
|
222
|
-
return value ? ( new ModifiedBaseRangeStateInput2()) : this;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
equals(other) {
|
|
226
|
-
return other.kind === ModifiedBaseRangeStateKind.base;
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
class ModifiedBaseRangeStateInput1 extends AbstractModifiedBaseRangeState {
|
|
230
|
-
get kind() { return ModifiedBaseRangeStateKind.input1; }
|
|
231
|
-
get includesInput1() { return true; }
|
|
232
|
-
toString() { return '1✓'; }
|
|
233
|
-
swap() { return ( new ModifiedBaseRangeStateInput2()); }
|
|
234
|
-
withInputValue(inputNumber, value, smartCombination = false) {
|
|
235
|
-
if (inputNumber === 1) {
|
|
236
|
-
return value ? this : ( new ModifiedBaseRangeStateBase());
|
|
237
|
-
}
|
|
238
|
-
else {
|
|
239
|
-
return value ? ( new ModifiedBaseRangeStateBoth(1, smartCombination)) : ( new ModifiedBaseRangeStateInput2());
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
equals(other) {
|
|
243
|
-
return other.kind === ModifiedBaseRangeStateKind.input1;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
class ModifiedBaseRangeStateInput2 extends AbstractModifiedBaseRangeState {
|
|
247
|
-
get kind() { return ModifiedBaseRangeStateKind.input2; }
|
|
248
|
-
get includesInput2() { return true; }
|
|
249
|
-
toString() { return '2✓'; }
|
|
250
|
-
swap() { return ( new ModifiedBaseRangeStateInput1()); }
|
|
251
|
-
withInputValue(inputNumber, value, smartCombination = false) {
|
|
252
|
-
if (inputNumber === 2) {
|
|
253
|
-
return value ? this : ( new ModifiedBaseRangeStateBase());
|
|
254
|
-
}
|
|
255
|
-
else {
|
|
256
|
-
return value ? ( new ModifiedBaseRangeStateBoth(2, smartCombination)) : ( new ModifiedBaseRangeStateInput2());
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
equals(other) {
|
|
260
|
-
return other.kind === ModifiedBaseRangeStateKind.input2;
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
class ModifiedBaseRangeStateBoth extends AbstractModifiedBaseRangeState {
|
|
264
|
-
constructor(firstInput, smartCombination) {
|
|
265
|
-
super();
|
|
266
|
-
this.firstInput = firstInput;
|
|
267
|
-
this.smartCombination = smartCombination;
|
|
268
|
-
}
|
|
269
|
-
get kind() { return ModifiedBaseRangeStateKind.both; }
|
|
270
|
-
get includesInput1() { return true; }
|
|
271
|
-
get includesInput2() { return true; }
|
|
272
|
-
toString() {
|
|
273
|
-
return '2✓';
|
|
274
|
-
}
|
|
275
|
-
swap() { return ( new ModifiedBaseRangeStateBoth(getOtherInputNumber(this.firstInput), this.smartCombination)); }
|
|
276
|
-
withInputValue(inputNumber, value, smartCombination = false) {
|
|
277
|
-
if (value) {
|
|
278
|
-
return this;
|
|
279
|
-
}
|
|
280
|
-
return inputNumber === 1 ? ( new ModifiedBaseRangeStateInput2()) : ( new ModifiedBaseRangeStateInput1());
|
|
281
|
-
}
|
|
282
|
-
equals(other) {
|
|
283
|
-
return other.kind === ModifiedBaseRangeStateKind.both && this.firstInput === other.firstInput && this.smartCombination === other.smartCombination;
|
|
284
|
-
}
|
|
285
|
-
getInput(inputNumber) {
|
|
286
|
-
return inputNumber === this.firstInput ? 1 : 2 ;
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
class ModifiedBaseRangeStateUnrecognized extends AbstractModifiedBaseRangeState {
|
|
290
|
-
get kind() { return ModifiedBaseRangeStateKind.unrecognized; }
|
|
291
|
-
toString() { return 'unrecognized'; }
|
|
292
|
-
swap() { return this; }
|
|
293
|
-
withInputValue(inputNumber, value, smartCombination = false) {
|
|
294
|
-
if (!value) {
|
|
295
|
-
return this;
|
|
296
|
-
}
|
|
297
|
-
return inputNumber === 1 ? ( new ModifiedBaseRangeStateInput1()) : ( new ModifiedBaseRangeStateInput2());
|
|
298
|
-
}
|
|
299
|
-
equals(other) {
|
|
300
|
-
return other.kind === ModifiedBaseRangeStateKind.unrecognized;
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
var ModifiedBaseRangeState;
|
|
304
|
-
( (function(ModifiedBaseRangeState) {
|
|
305
|
-
ModifiedBaseRangeState.base = ( new ModifiedBaseRangeStateBase());
|
|
306
|
-
ModifiedBaseRangeState.unrecognized = ( new ModifiedBaseRangeStateUnrecognized());
|
|
307
|
-
})(ModifiedBaseRangeState || (ModifiedBaseRangeState = {})));
|
|
308
|
-
|
|
309
|
-
export { AbstractModifiedBaseRangeState, ModifiedBaseRange, ModifiedBaseRangeState, ModifiedBaseRangeStateBase, ModifiedBaseRangeStateBoth, ModifiedBaseRangeStateInput1, ModifiedBaseRangeStateInput2, ModifiedBaseRangeStateKind, ModifiedBaseRangeStateUnrecognized, getOtherInputNumber };
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { Position } from 'monaco-editor/esm/vs/editor/common/core/position.js';
|
|
2
|
-
import { LengthObj } from 'monaco-editor/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/length.js';
|
|
3
|
-
|
|
4
|
-
function rangeContainsPosition(range, position) {
|
|
5
|
-
if (position.lineNumber < range.startLineNumber || position.lineNumber > range.endLineNumber) {
|
|
6
|
-
return false;
|
|
7
|
-
}
|
|
8
|
-
if (position.lineNumber === range.startLineNumber && position.column < range.startColumn) {
|
|
9
|
-
return false;
|
|
10
|
-
}
|
|
11
|
-
if (position.lineNumber === range.endLineNumber && position.column >= range.endColumn) {
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
return true;
|
|
15
|
-
}
|
|
16
|
-
function lengthBetweenPositions(position1, position2) {
|
|
17
|
-
if (position1.lineNumber === position2.lineNumber) {
|
|
18
|
-
return ( new LengthObj(0, position2.column - position1.column));
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
return ( new LengthObj(position2.lineNumber - position1.lineNumber, position2.column - 1));
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
function addLength(position, length) {
|
|
25
|
-
if (length.lineCount === 0) {
|
|
26
|
-
return ( new Position(position.lineNumber, position.column + length.columnCount));
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
return ( new Position(position.lineNumber + length.lineCount, length.columnCount + 1));
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
function rangeIsBeforeOrTouching(range, other) {
|
|
33
|
-
return (range.endLineNumber < other.startLineNumber ||
|
|
34
|
-
(range.endLineNumber === other.startLineNumber &&
|
|
35
|
-
range.endColumn <= other.startColumn));
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export { addLength, lengthBetweenPositions, rangeContainsPosition, rangeIsBeforeOrTouching };
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
import { compareBy, numberComparator } from 'monaco-editor/esm/vs/base/common/arrays.js';
|
|
2
|
-
import { BugIndicatingError } from 'monaco-editor/esm/vs/base/common/errors.js';
|
|
3
|
-
import { Disposable, toDisposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
4
|
-
import { DetailedLineRangeMapping } from './mapping.js';
|
|
5
|
-
import { LineRangeEdit } from './editing.js';
|
|
6
|
-
import { LineRange } from './lineRange.js';
|
|
7
|
-
import { ReentrancyBarrier } from '../utils.js';
|
|
8
|
-
import { observableValue, observableSignal, autorun, transaction } from 'monaco-editor/esm/vs/base/common/observable.js';
|
|
9
|
-
|
|
10
|
-
class TextModelDiffs extends Disposable {
|
|
11
|
-
get isApplyingChange() {
|
|
12
|
-
return this.barrier.isActive;
|
|
13
|
-
}
|
|
14
|
-
constructor(baseTextModel, textModel, diffComputer) {
|
|
15
|
-
super();
|
|
16
|
-
this.baseTextModel = baseTextModel;
|
|
17
|
-
this.textModel = textModel;
|
|
18
|
-
this.diffComputer = diffComputer;
|
|
19
|
-
this.recomputeCount = 0;
|
|
20
|
-
this._state = observableValue(this, 1 );
|
|
21
|
-
this._diffs = observableValue(this, []);
|
|
22
|
-
this.barrier = ( new ReentrancyBarrier());
|
|
23
|
-
this.isDisposed = false;
|
|
24
|
-
this.isInitializing = true;
|
|
25
|
-
const recomputeSignal = observableSignal('recompute');
|
|
26
|
-
this._register(autorun(reader => {
|
|
27
|
-
recomputeSignal.read(reader);
|
|
28
|
-
this.recompute(reader);
|
|
29
|
-
}));
|
|
30
|
-
this._register(baseTextModel.onDidChangeContent(this.barrier.makeExclusive(() => {
|
|
31
|
-
recomputeSignal.trigger(undefined);
|
|
32
|
-
})));
|
|
33
|
-
this._register(textModel.onDidChangeContent(this.barrier.makeExclusive(() => {
|
|
34
|
-
recomputeSignal.trigger(undefined);
|
|
35
|
-
})));
|
|
36
|
-
this._register(toDisposable(() => {
|
|
37
|
-
this.isDisposed = true;
|
|
38
|
-
}));
|
|
39
|
-
}
|
|
40
|
-
get state() {
|
|
41
|
-
return this._state;
|
|
42
|
-
}
|
|
43
|
-
get diffs() {
|
|
44
|
-
return this._diffs;
|
|
45
|
-
}
|
|
46
|
-
recompute(reader) {
|
|
47
|
-
this.recomputeCount++;
|
|
48
|
-
const currentRecomputeIdx = this.recomputeCount;
|
|
49
|
-
if (this._state.get() === 1 ) {
|
|
50
|
-
this.isInitializing = true;
|
|
51
|
-
}
|
|
52
|
-
transaction(tx => {
|
|
53
|
-
this._state.set(this.isInitializing ? 1 : 3 , tx, 0 );
|
|
54
|
-
});
|
|
55
|
-
const result = this.diffComputer.computeDiff(this.baseTextModel, this.textModel, reader);
|
|
56
|
-
result.then((result) => {
|
|
57
|
-
if (this.isDisposed) {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
if (currentRecomputeIdx !== this.recomputeCount) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
transaction(tx => {
|
|
64
|
-
if (result.diffs) {
|
|
65
|
-
this._state.set(2 , tx, 1 );
|
|
66
|
-
this._diffs.set(result.diffs, tx, 1 );
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
this._state.set(4 , tx, 1 );
|
|
70
|
-
}
|
|
71
|
-
this.isInitializing = false;
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
ensureUpToDate() {
|
|
76
|
-
if (this.state.get() !== 2 ) {
|
|
77
|
-
throw new BugIndicatingError('Cannot remove diffs when the model is not up to date');
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
removeDiffs(diffToRemoves, transaction, group) {
|
|
81
|
-
this.ensureUpToDate();
|
|
82
|
-
diffToRemoves.sort(compareBy((d) => d.inputRange.startLineNumber, numberComparator));
|
|
83
|
-
diffToRemoves.reverse();
|
|
84
|
-
let diffs = this._diffs.get();
|
|
85
|
-
for (const diffToRemove of diffToRemoves) {
|
|
86
|
-
const len = diffs.length;
|
|
87
|
-
diffs = diffs.filter((d) => d !== diffToRemove);
|
|
88
|
-
if (len === diffs.length) {
|
|
89
|
-
throw new BugIndicatingError();
|
|
90
|
-
}
|
|
91
|
-
this.barrier.runExclusivelyOrThrow(() => {
|
|
92
|
-
const edits = diffToRemove.getReverseLineEdit().toEdits(this.textModel.getLineCount());
|
|
93
|
-
this.textModel.pushEditOperations(null, edits, () => null, group);
|
|
94
|
-
});
|
|
95
|
-
diffs = ( diffs.map((d) => d.outputRange.isAfter(diffToRemove.outputRange)
|
|
96
|
-
? d.addOutputLineDelta(diffToRemove.inputRange.lineCount - diffToRemove.outputRange.lineCount)
|
|
97
|
-
: d));
|
|
98
|
-
}
|
|
99
|
-
this._diffs.set(diffs, transaction, 0 );
|
|
100
|
-
}
|
|
101
|
-
applyEditRelativeToOriginal(edit, transaction, group) {
|
|
102
|
-
this.ensureUpToDate();
|
|
103
|
-
const editMapping = ( new DetailedLineRangeMapping(edit.range, this.baseTextModel, ( new LineRange(edit.range.startLineNumber, edit.newLines.length)), this.textModel));
|
|
104
|
-
let firstAfter = false;
|
|
105
|
-
let delta = 0;
|
|
106
|
-
const newDiffs = ( new Array());
|
|
107
|
-
for (const diff of this.diffs.get()) {
|
|
108
|
-
if (diff.inputRange.touches(edit.range)) {
|
|
109
|
-
throw new BugIndicatingError('Edit must be conflict free.');
|
|
110
|
-
}
|
|
111
|
-
else if (diff.inputRange.isAfter(edit.range)) {
|
|
112
|
-
if (!firstAfter) {
|
|
113
|
-
firstAfter = true;
|
|
114
|
-
newDiffs.push(editMapping.addOutputLineDelta(delta));
|
|
115
|
-
}
|
|
116
|
-
newDiffs.push(diff.addOutputLineDelta(edit.newLines.length - edit.range.lineCount));
|
|
117
|
-
}
|
|
118
|
-
else {
|
|
119
|
-
newDiffs.push(diff);
|
|
120
|
-
}
|
|
121
|
-
if (!firstAfter) {
|
|
122
|
-
delta += diff.outputRange.lineCount - diff.inputRange.lineCount;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
if (!firstAfter) {
|
|
126
|
-
firstAfter = true;
|
|
127
|
-
newDiffs.push(editMapping.addOutputLineDelta(delta));
|
|
128
|
-
}
|
|
129
|
-
this.barrier.runExclusivelyOrThrow(() => {
|
|
130
|
-
const edits = ( new LineRangeEdit(edit.range.delta(delta), edit.newLines)).toEdits(this.textModel.getLineCount());
|
|
131
|
-
this.textModel.pushEditOperations(null, edits, () => null, group);
|
|
132
|
-
});
|
|
133
|
-
this._diffs.set(newDiffs, transaction, 0 );
|
|
134
|
-
}
|
|
135
|
-
findTouchingDiffs(baseRange) {
|
|
136
|
-
return this.diffs.get().filter(d => d.inputRange.touches(baseRange));
|
|
137
|
-
}
|
|
138
|
-
getResultLine(lineNumber, reader) {
|
|
139
|
-
let offset = 0;
|
|
140
|
-
const diffs = reader ? this.diffs.read(reader) : this.diffs.get();
|
|
141
|
-
for (const diff of diffs) {
|
|
142
|
-
if (diff.inputRange.contains(lineNumber) || diff.inputRange.endLineNumberExclusive === lineNumber) {
|
|
143
|
-
return diff;
|
|
144
|
-
}
|
|
145
|
-
else if (diff.inputRange.endLineNumberExclusive < lineNumber) {
|
|
146
|
-
offset = diff.resultingDeltaFromOriginalToModified;
|
|
147
|
-
}
|
|
148
|
-
else {
|
|
149
|
-
break;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
return lineNumber + offset;
|
|
153
|
-
}
|
|
154
|
-
getResultLineRange(baseRange, reader) {
|
|
155
|
-
let start = this.getResultLine(baseRange.startLineNumber, reader);
|
|
156
|
-
if (typeof start !== 'number') {
|
|
157
|
-
start = start.outputRange.startLineNumber;
|
|
158
|
-
}
|
|
159
|
-
let endExclusive = this.getResultLine(baseRange.endLineNumberExclusive, reader);
|
|
160
|
-
if (typeof endExclusive !== 'number') {
|
|
161
|
-
endExclusive = endExclusive.outputRange.endLineNumberExclusive;
|
|
162
|
-
}
|
|
163
|
-
return LineRange.fromLineNumbers(start, endExclusive);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
export { TextModelDiffs };
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { ITelemetryService } from 'monaco-editor/esm/vs/platform/telemetry/common/telemetry.js';
|
|
3
|
-
|
|
4
|
-
let MergeEditorTelemetry = class MergeEditorTelemetry {
|
|
5
|
-
constructor(telemetryService) {
|
|
6
|
-
this.telemetryService = telemetryService;
|
|
7
|
-
}
|
|
8
|
-
reportMergeEditorOpened(args) {
|
|
9
|
-
this.telemetryService.publicLog2('mergeEditor.opened', {
|
|
10
|
-
conflictCount: args.conflictCount,
|
|
11
|
-
combinableConflictCount: args.combinableConflictCount,
|
|
12
|
-
baseVisible: args.baseVisible,
|
|
13
|
-
isColumnView: args.isColumnView,
|
|
14
|
-
baseTop: args.baseTop,
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
reportLayoutChange(args) {
|
|
18
|
-
this.telemetryService.publicLog2('mergeEditor.layoutChanged', {
|
|
19
|
-
baseVisible: args.baseVisible,
|
|
20
|
-
isColumnView: args.isColumnView,
|
|
21
|
-
baseTop: args.baseTop,
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
reportMergeEditorClosed(args) {
|
|
25
|
-
this.telemetryService.publicLog2('mergeEditor.closed', {
|
|
26
|
-
conflictCount: args.conflictCount,
|
|
27
|
-
combinableConflictCount: args.combinableConflictCount,
|
|
28
|
-
durationOpenedSecs: args.durationOpenedSecs,
|
|
29
|
-
remainingConflictCount: args.remainingConflictCount,
|
|
30
|
-
accepted: args.accepted,
|
|
31
|
-
conflictsResolvedWithBase: args.conflictsResolvedWithBase,
|
|
32
|
-
conflictsResolvedWithInput1: args.conflictsResolvedWithInput1,
|
|
33
|
-
conflictsResolvedWithInput2: args.conflictsResolvedWithInput2,
|
|
34
|
-
conflictsResolvedWithSmartCombination: args.conflictsResolvedWithSmartCombination,
|
|
35
|
-
manuallySolvedConflictCountThatEqualNone: args.manuallySolvedConflictCountThatEqualNone,
|
|
36
|
-
manuallySolvedConflictCountThatEqualSmartCombine: args.manuallySolvedConflictCountThatEqualSmartCombine,
|
|
37
|
-
manuallySolvedConflictCountThatEqualInput1: args.manuallySolvedConflictCountThatEqualInput1,
|
|
38
|
-
manuallySolvedConflictCountThatEqualInput2: args.manuallySolvedConflictCountThatEqualInput2,
|
|
39
|
-
manuallySolvedConflictCountThatEqualNoneAndStartedWithBase: args.manuallySolvedConflictCountThatEqualNoneAndStartedWithBase,
|
|
40
|
-
manuallySolvedConflictCountThatEqualNoneAndStartedWithInput1: args.manuallySolvedConflictCountThatEqualNoneAndStartedWithInput1,
|
|
41
|
-
manuallySolvedConflictCountThatEqualNoneAndStartedWithInput2: args.manuallySolvedConflictCountThatEqualNoneAndStartedWithInput2,
|
|
42
|
-
manuallySolvedConflictCountThatEqualNoneAndStartedWithBothNonSmart: args.manuallySolvedConflictCountThatEqualNoneAndStartedWithBothNonSmart,
|
|
43
|
-
manuallySolvedConflictCountThatEqualNoneAndStartedWithBothSmart: args.manuallySolvedConflictCountThatEqualNoneAndStartedWithBothSmart,
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
reportAcceptInvoked(inputNumber, otherAccepted) {
|
|
47
|
-
this.telemetryService.publicLog2('mergeEditor.action.accept', {
|
|
48
|
-
otherAccepted: otherAccepted,
|
|
49
|
-
isInput1: inputNumber === 1,
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
reportSmartCombinationInvoked(otherAccepted) {
|
|
53
|
-
this.telemetryService.publicLog2('mergeEditor.action.smartCombination', {
|
|
54
|
-
otherAccepted: otherAccepted,
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
reportRemoveInvoked(inputNumber, otherAccepted) {
|
|
58
|
-
this.telemetryService.publicLog2('mergeEditor.action.remove', {
|
|
59
|
-
otherAccepted: otherAccepted,
|
|
60
|
-
isInput1: inputNumber === 1,
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
reportResetToBaseInvoked() {
|
|
64
|
-
this.telemetryService.publicLog2('mergeEditor.action.resetToBase', {});
|
|
65
|
-
}
|
|
66
|
-
reportNavigationToNextConflict() {
|
|
67
|
-
this.telemetryService.publicLog2('mergeEditor.action.goToNextConflict', {});
|
|
68
|
-
}
|
|
69
|
-
reportNavigationToPreviousConflict() {
|
|
70
|
-
this.telemetryService.publicLog2('mergeEditor.action.goToPreviousConflict', {});
|
|
71
|
-
}
|
|
72
|
-
reportConflictCounterClicked() {
|
|
73
|
-
this.telemetryService.publicLog2('mergeEditor.action.conflictCounterClicked', {});
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
MergeEditorTelemetry = ( __decorate([
|
|
77
|
-
( __param(0, ITelemetryService))
|
|
78
|
-
], MergeEditorTelemetry));
|
|
79
|
-
|
|
80
|
-
export { MergeEditorTelemetry };
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { ArrayQueue, CompareResult } from 'monaco-editor/esm/vs/base/common/arrays.js';
|
|
2
|
-
import { BugIndicatingError } from 'monaco-editor/esm/vs/base/common/errors.js';
|
|
3
|
-
import { observableFromEvent } from 'monaco-editor/esm/vs/base/common/observable.js';
|
|
4
|
-
|
|
5
|
-
class ReentrancyBarrier {
|
|
6
|
-
constructor() {
|
|
7
|
-
this._isActive = false;
|
|
8
|
-
}
|
|
9
|
-
get isActive() {
|
|
10
|
-
return this._isActive;
|
|
11
|
-
}
|
|
12
|
-
makeExclusive(fn) {
|
|
13
|
-
return ((...args) => {
|
|
14
|
-
if (this._isActive) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
this._isActive = true;
|
|
18
|
-
try {
|
|
19
|
-
return fn(...args);
|
|
20
|
-
}
|
|
21
|
-
finally {
|
|
22
|
-
this._isActive = false;
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
runExclusively(fn) {
|
|
27
|
-
if (this._isActive) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
this._isActive = true;
|
|
31
|
-
try {
|
|
32
|
-
fn();
|
|
33
|
-
}
|
|
34
|
-
finally {
|
|
35
|
-
this._isActive = false;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
runExclusivelyOrThrow(fn) {
|
|
39
|
-
if (this._isActive) {
|
|
40
|
-
throw new BugIndicatingError();
|
|
41
|
-
}
|
|
42
|
-
this._isActive = true;
|
|
43
|
-
try {
|
|
44
|
-
fn();
|
|
45
|
-
}
|
|
46
|
-
finally {
|
|
47
|
-
this._isActive = false;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
function* leftJoin(left, right, compare) {
|
|
52
|
-
const rightQueue = ( new ArrayQueue(right));
|
|
53
|
-
for (const leftElement of left) {
|
|
54
|
-
rightQueue.takeWhile(rightElement => CompareResult.isGreaterThan(compare(leftElement, rightElement)));
|
|
55
|
-
const equals = rightQueue.takeWhile(rightElement => CompareResult.isNeitherLessOrGreaterThan(compare(leftElement, rightElement)));
|
|
56
|
-
yield { left: leftElement, rights: equals || [] };
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
function concatArrays(...arrays) {
|
|
60
|
-
return [].concat(...arrays);
|
|
61
|
-
}
|
|
62
|
-
function observableConfigValue(key, defaultValue, configurationService) {
|
|
63
|
-
return observableFromEvent((handleChange) => configurationService.onDidChangeConfiguration(e => {
|
|
64
|
-
if (e.affectsConfiguration(key)) {
|
|
65
|
-
handleChange(e);
|
|
66
|
-
}
|
|
67
|
-
}), () => configurationService.getValue(key) ?? defaultValue);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export { ReentrancyBarrier, concatArrays, leftJoin, observableConfigValue };
|