@codingame/monaco-vscode-extensions-service-override 1.85.0 → 1.85.1

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.
Files changed (55) hide show
  1. package/package.json +3 -3
  2. package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents2.js +3 -3
  3. package/vscode/src/vs/workbench/api/browser/mainThreadCustomEditors.js +1 -1
  4. package/vscode/src/vs/workbench/api/browser/mainThreadEditorTabs.js +3 -3
  5. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookSaveParticipant.js +1 -1
  6. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.js +2 -2
  7. package/vscode/src/vs/workbench/contrib/comments/browser/commentsController.js +3 -3
  8. package/vscode/src/vs/workbench/contrib/comments/browser/commentsTreeViewer.js +2 -2
  9. package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveEditorInput.js +1 -1
  10. package/override/vs/workbench/contrib/notebook/common/notebookEditorInput.js +0 -3
  11. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.js +0 -40
  12. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditorInput.js +0 -141
  13. package/vscode/src/vs/workbench/contrib/chat/browser/chatFollowups.js +0 -37
  14. package/vscode/src/vs/workbench/contrib/chat/browser/chatInputPart.js +0 -342
  15. package/vscode/src/vs/workbench/contrib/chat/browser/chatListRenderer.js +0 -1197
  16. package/vscode/src/vs/workbench/contrib/chat/browser/chatMarkdownDecorationsRenderer.js +0 -117
  17. package/vscode/src/vs/workbench/contrib/chat/browser/chatOptions.js +0 -83
  18. package/vscode/src/vs/workbench/contrib/chat/browser/chatWidget.js +0 -543
  19. package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.css.js +0 -6
  20. package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.js +0 -292
  21. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatDynamicVariables.js +0 -169
  22. package/vscode/src/vs/workbench/contrib/chat/browser/media/chat.css.js +0 -6
  23. package/vscode/src/vs/workbench/contrib/chat/common/chatModel.js +0 -255
  24. package/vscode/src/vs/workbench/contrib/chat/common/chatRequestParser.js +0 -195
  25. package/vscode/src/vs/workbench/contrib/chat/common/chatViewModel.js +0 -260
  26. package/vscode/src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.js +0 -5
  27. package/vscode/src/vs/workbench/contrib/chat/common/chatWordCounter.js +0 -26
  28. package/vscode/src/vs/workbench/contrib/comments/browser/commentColors.js +0 -63
  29. package/vscode/src/vs/workbench/contrib/comments/browser/commentFormActions.js +0 -51
  30. package/vscode/src/vs/workbench/contrib/comments/browser/commentNode.js +0 -649
  31. package/vscode/src/vs/workbench/contrib/comments/browser/commentReply.js +0 -302
  32. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadAdditionalActions.js +0 -62
  33. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadBody.js +0 -251
  34. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadHeader.js +0 -109
  35. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadWidget.js +0 -335
  36. package/vscode/src/vs/workbench/contrib/comments/browser/media/review.css.js +0 -6
  37. package/vscode/src/vs/workbench/contrib/comments/browser/reactionsAction.js +0 -101
  38. package/vscode/src/vs/workbench/contrib/comments/browser/timestamp.js +0 -57
  39. package/vscode/src/vs/workbench/contrib/comments/common/commentsConfiguration.js +0 -3
  40. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorInput.js +0 -144
  41. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel.js +0 -482
  42. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeMarkers/mergeMarkersController.js +0 -6
  43. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/diffComputer.js +0 -92
  44. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/editing.js +0 -56
  45. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/lineRange.js +0 -110
  46. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/mapping.js +0 -260
  47. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/mergeEditorModel.js +0 -616
  48. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/modifiedBaseRange.js +0 -309
  49. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/rangeUtils.js +0 -38
  50. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/textModelDiffs.js +0 -167
  51. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/telemetry.js +0 -80
  52. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/utils.js +0 -70
  53. package/vscode/src/vs/workbench/contrib/mergeEditor/common/mergeEditor.js +0 -3
  54. package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModel.js +0 -108
  55. package/vscode/src/vs/workbench/services/workingCopy/common/resourceWorkingCopy.js +0 -79
@@ -1,92 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
2
- import { assertFn, checkAdjacentItems } from 'monaco-editor/esm/vs/base/common/assert.js';
3
- import { IEditorWorkerService } from 'monaco-editor/esm/vs/editor/common/services/editorWorker.js';
4
- import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
5
- import { LineRange } from './lineRange.js';
6
- import { DetailedLineRangeMapping, RangeMapping } from './mapping.js';
7
- import { observableConfigValue } from '../utils.js';
8
-
9
- let MergeDiffComputer = class MergeDiffComputer {
10
- constructor(editorWorkerService, configurationService) {
11
- this.editorWorkerService = editorWorkerService;
12
- this.configurationService = configurationService;
13
- this.mergeAlgorithm = ( observableConfigValue('mergeEditor.diffAlgorithm', 'advanced', this.configurationService)
14
- .map(v => v === 'smart' ? 'legacy' : v === 'experimental' ? 'advanced' : v));
15
- }
16
- async computeDiff(textModel1, textModel2, reader) {
17
- const diffAlgorithm = this.mergeAlgorithm.read(reader);
18
- const inputVersion = textModel1.getVersionId();
19
- const outputVersion = textModel2.getVersionId();
20
- const result = await this.editorWorkerService.computeDiff(textModel1.uri, textModel2.uri, {
21
- ignoreTrimWhitespace: false,
22
- maxComputationTimeMs: 0,
23
- computeMoves: false,
24
- }, diffAlgorithm);
25
- if (!result) {
26
- throw new Error('Diff computation failed');
27
- }
28
- if (textModel1.isDisposed() || textModel2.isDisposed()) {
29
- return { diffs: null };
30
- }
31
- const changes = ( result.changes.map(c => ( new DetailedLineRangeMapping(
32
- toLineRange(c.original),
33
- textModel1,
34
- toLineRange(c.modified),
35
- textModel2,
36
- c.innerChanges?.map(ic => toRangeMapping(ic))
37
- ))));
38
- const newInputVersion = textModel1.getVersionId();
39
- const newOutputVersion = textModel2.getVersionId();
40
- if (inputVersion !== newInputVersion || outputVersion !== newOutputVersion) {
41
- return { diffs: null };
42
- }
43
- assertFn(() => {
44
- for (const c of changes) {
45
- const inputRange = c.inputRange;
46
- const outputRange = c.outputRange;
47
- const inputTextModel = c.inputTextModel;
48
- const outputTextModel = c.outputTextModel;
49
- for (const map of c.rangeMappings) {
50
- let inputRangesValid = inputRange.startLineNumber - 1 <= map.inputRange.startLineNumber
51
- && map.inputRange.endLineNumber <= inputRange.endLineNumberExclusive;
52
- if (inputRangesValid && map.inputRange.startLineNumber === inputRange.startLineNumber - 1) {
53
- inputRangesValid = map.inputRange.endColumn >= inputTextModel.getLineMaxColumn(map.inputRange.startLineNumber);
54
- }
55
- if (inputRangesValid && map.inputRange.endLineNumber === inputRange.endLineNumberExclusive) {
56
- inputRangesValid = map.inputRange.endColumn === 1;
57
- }
58
- let outputRangesValid = outputRange.startLineNumber - 1 <= map.outputRange.startLineNumber
59
- && map.outputRange.endLineNumber <= outputRange.endLineNumberExclusive;
60
- if (outputRangesValid && map.outputRange.startLineNumber === outputRange.startLineNumber - 1) {
61
- outputRangesValid = map.outputRange.endColumn >= outputTextModel.getLineMaxColumn(map.outputRange.endLineNumber);
62
- }
63
- if (outputRangesValid && map.outputRange.endLineNumber === outputRange.endLineNumberExclusive) {
64
- outputRangesValid = map.outputRange.endColumn === 1;
65
- }
66
- if (!inputRangesValid || !outputRangesValid) {
67
- return false;
68
- }
69
- }
70
- }
71
- return changes.length === 0 || (changes[0].inputRange.startLineNumber === changes[0].outputRange.startLineNumber &&
72
- checkAdjacentItems(changes, (m1, m2) => m2.inputRange.startLineNumber - m1.inputRange.endLineNumberExclusive === m2.outputRange.startLineNumber - m1.outputRange.endLineNumberExclusive &&
73
- m1.inputRange.endLineNumberExclusive < m2.inputRange.startLineNumber &&
74
- m1.outputRange.endLineNumberExclusive < m2.outputRange.startLineNumber));
75
- });
76
- return {
77
- diffs: changes
78
- };
79
- }
80
- };
81
- MergeDiffComputer = ( __decorate([
82
- ( __param(0, IEditorWorkerService)),
83
- ( __param(1, IConfigurationService))
84
- ], MergeDiffComputer));
85
- function toLineRange(range) {
86
- return ( new LineRange(range.startLineNumber, range.length));
87
- }
88
- function toRangeMapping(mapping) {
89
- return ( new RangeMapping(mapping.originalRange, mapping.modifiedRange));
90
- }
91
-
92
- export { MergeDiffComputer, toLineRange, toRangeMapping };
@@ -1,56 +0,0 @@
1
- import { equals } from 'monaco-editor/esm/vs/base/common/arrays.js';
2
- import { Range } from 'monaco-editor/esm/vs/editor/common/core/range.js';
3
-
4
- class LineRangeEdit {
5
- constructor(range, newLines) {
6
- this.range = range;
7
- this.newLines = newLines;
8
- }
9
- equals(other) {
10
- return this.range.equals(other.range) && equals(this.newLines, other.newLines);
11
- }
12
- toEdits(modelLineCount) {
13
- return ( new LineEdits([this])).toEdits(modelLineCount);
14
- }
15
- }
16
- class RangeEdit {
17
- constructor(range, newText) {
18
- this.range = range;
19
- this.newText = newText;
20
- }
21
- equals(other) {
22
- return Range.equalsRange(this.range, other.range) && this.newText === other.newText;
23
- }
24
- }
25
- class LineEdits {
26
- constructor(edits) {
27
- this.edits = edits;
28
- }
29
- toEdits(modelLineCount) {
30
- return ( this.edits.map((e) => {
31
- if (e.range.endLineNumberExclusive <= modelLineCount) {
32
- return {
33
- range: ( new Range(e.range.startLineNumber, 1, e.range.endLineNumberExclusive, 1)),
34
- text: ( e.newLines.map(s => s + '\n')).join(''),
35
- };
36
- }
37
- if (e.range.startLineNumber === 1) {
38
- return {
39
- range: ( new Range(1, 1, modelLineCount, Number.MAX_SAFE_INTEGER)),
40
- text: e.newLines.join('\n'),
41
- };
42
- }
43
- return {
44
- range: ( new Range(
45
- e.range.startLineNumber - 1,
46
- Number.MAX_SAFE_INTEGER,
47
- modelLineCount,
48
- Number.MAX_SAFE_INTEGER
49
- )),
50
- text: ( e.newLines.map(s => '\n' + s)).join(''),
51
- };
52
- }));
53
- }
54
- }
55
-
56
- export { LineEdits, LineRangeEdit, RangeEdit };
@@ -1,110 +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 { Range } from 'monaco-editor/esm/vs/editor/common/core/range.js';
4
-
5
- class LineRange {
6
- static { this.compareByStart = compareBy(l => l.startLineNumber, numberComparator); }
7
- static join(ranges) {
8
- if (ranges.length === 0) {
9
- return undefined;
10
- }
11
- let startLineNumber = Number.MAX_SAFE_INTEGER;
12
- let endLineNumber = 0;
13
- for (const range of ranges) {
14
- startLineNumber = Math.min(startLineNumber, range.startLineNumber);
15
- endLineNumber = Math.max(endLineNumber, range.startLineNumber + range.lineCount);
16
- }
17
- return ( new LineRange(startLineNumber, endLineNumber - startLineNumber));
18
- }
19
- static fromLineNumbers(startLineNumber, endExclusiveLineNumber) {
20
- return ( new LineRange(startLineNumber, endExclusiveLineNumber - startLineNumber));
21
- }
22
- constructor(startLineNumber, lineCount) {
23
- this.startLineNumber = startLineNumber;
24
- this.lineCount = lineCount;
25
- if (lineCount < 0) {
26
- throw new BugIndicatingError();
27
- }
28
- }
29
- join(other) {
30
- return ( new LineRange(
31
- Math.min(this.startLineNumber, other.startLineNumber),
32
- Math.max(this.endLineNumberExclusive, other.endLineNumberExclusive) - this.startLineNumber
33
- ));
34
- }
35
- get endLineNumberExclusive() {
36
- return this.startLineNumber + this.lineCount;
37
- }
38
- get isEmpty() {
39
- return this.lineCount === 0;
40
- }
41
- touches(other) {
42
- return (this.endLineNumberExclusive >= other.startLineNumber &&
43
- other.endLineNumberExclusive >= this.startLineNumber);
44
- }
45
- isAfter(range) {
46
- return this.startLineNumber >= range.endLineNumberExclusive;
47
- }
48
- isBefore(range) {
49
- return range.startLineNumber >= this.endLineNumberExclusive;
50
- }
51
- delta(lineDelta) {
52
- return ( new LineRange(this.startLineNumber + lineDelta, this.lineCount));
53
- }
54
- toString() {
55
- return `[${this.startLineNumber},${this.endLineNumberExclusive})`;
56
- }
57
- equals(originalRange) {
58
- return this.startLineNumber === originalRange.startLineNumber && this.lineCount === originalRange.lineCount;
59
- }
60
- contains(lineNumber) {
61
- return this.startLineNumber <= lineNumber && lineNumber < this.endLineNumberExclusive;
62
- }
63
- deltaEnd(delta) {
64
- return ( new LineRange(this.startLineNumber, this.lineCount + delta));
65
- }
66
- deltaStart(lineDelta) {
67
- return ( new LineRange(this.startLineNumber + lineDelta, this.lineCount - lineDelta));
68
- }
69
- getLines(model) {
70
- const result = ( new Array(this.lineCount));
71
- for (let i = 0; i < this.lineCount; i++) {
72
- result[i] = model.getLineContent(this.startLineNumber + i);
73
- }
74
- return result;
75
- }
76
- containsRange(range) {
77
- return this.startLineNumber <= range.startLineNumber && range.endLineNumberExclusive <= this.endLineNumberExclusive;
78
- }
79
- toRange() {
80
- return ( new Range(this.startLineNumber, 1, this.endLineNumberExclusive, 1));
81
- }
82
- toInclusiveRange() {
83
- if (this.isEmpty) {
84
- return undefined;
85
- }
86
- return ( new Range(
87
- this.startLineNumber,
88
- 1,
89
- this.endLineNumberExclusive - 1,
90
- 1073741824
91
- ));
92
- }
93
- toInclusiveRangeOrEmpty() {
94
- if (this.isEmpty) {
95
- return ( new Range(this.startLineNumber, 1, this.startLineNumber, 1));
96
- }
97
- return ( new Range(
98
- this.startLineNumber,
99
- 1,
100
- this.endLineNumberExclusive - 1,
101
- 1073741824
102
- ));
103
- }
104
- intersects(lineRange) {
105
- return this.startLineNumber <= lineRange.endLineNumberExclusive
106
- && lineRange.startLineNumber <= this.endLineNumberExclusive;
107
- }
108
- }
109
-
110
- export { LineRange };
@@ -1,260 +0,0 @@
1
- import { lastOrDefault, compareBy, numberComparator } from 'monaco-editor/esm/vs/base/common/arrays.js';
2
- import { findLast } from 'monaco-editor/esm/vs/base/common/arraysFind.js';
3
- import { assertFn, checkAdjacentItems } from 'monaco-editor/esm/vs/base/common/assert.js';
4
- import { BugIndicatingError } from 'monaco-editor/esm/vs/base/common/errors.js';
5
- import { Range } from 'monaco-editor/esm/vs/editor/common/core/range.js';
6
- import { concatArrays } from '../utils.js';
7
- import { LineRangeEdit } from './editing.js';
8
- import { LineRange } from './lineRange.js';
9
- import { rangeIsBeforeOrTouching, rangeContainsPosition, lengthBetweenPositions, addLength } from './rangeUtils.js';
10
-
11
- class LineRangeMapping {
12
- static join(mappings) {
13
- return mappings.reduce((acc, cur) => acc ? acc.join(cur) : cur, undefined);
14
- }
15
- constructor(inputRange, outputRange) {
16
- this.inputRange = inputRange;
17
- this.outputRange = outputRange;
18
- }
19
- extendInputRange(extendedInputRange) {
20
- if (!extendedInputRange.containsRange(this.inputRange)) {
21
- throw new BugIndicatingError();
22
- }
23
- const startDelta = extendedInputRange.startLineNumber - this.inputRange.startLineNumber;
24
- const endDelta = extendedInputRange.endLineNumberExclusive - this.inputRange.endLineNumberExclusive;
25
- return ( new LineRangeMapping(extendedInputRange, ( new LineRange(
26
- this.outputRange.startLineNumber + startDelta,
27
- this.outputRange.lineCount - startDelta + endDelta
28
- ))));
29
- }
30
- join(other) {
31
- return ( new LineRangeMapping(
32
- this.inputRange.join(other.inputRange),
33
- this.outputRange.join(other.outputRange)
34
- ));
35
- }
36
- get resultingDeltaFromOriginalToModified() {
37
- return this.outputRange.endLineNumberExclusive - this.inputRange.endLineNumberExclusive;
38
- }
39
- toString() {
40
- return `${( this.inputRange.toString())} -> ${( this.outputRange.toString())}`;
41
- }
42
- addOutputLineDelta(delta) {
43
- return ( new LineRangeMapping(this.inputRange, this.outputRange.delta(delta)));
44
- }
45
- addInputLineDelta(delta) {
46
- return ( new LineRangeMapping(this.inputRange.delta(delta), this.outputRange));
47
- }
48
- reverse() {
49
- return ( new LineRangeMapping(this.outputRange, this.inputRange));
50
- }
51
- }
52
- class DocumentLineRangeMap {
53
- static betweenOutputs(inputToOutput1, inputToOutput2, inputLineCount) {
54
- const alignments = MappingAlignment.compute(inputToOutput1, inputToOutput2);
55
- const mappings = ( alignments.map((m) => ( new LineRangeMapping(m.output1Range, m.output2Range))));
56
- return ( new DocumentLineRangeMap(mappings, inputLineCount));
57
- }
58
- constructor(
59
- lineRangeMappings, inputLineCount) {
60
- this.lineRangeMappings = lineRangeMappings;
61
- this.inputLineCount = inputLineCount;
62
- assertFn(() => {
63
- return checkAdjacentItems(lineRangeMappings, (m1, m2) => m1.inputRange.isBefore(m2.inputRange) && m1.outputRange.isBefore(m2.outputRange) &&
64
- m2.inputRange.startLineNumber - m1.inputRange.endLineNumberExclusive === m2.outputRange.startLineNumber - m1.outputRange.endLineNumberExclusive);
65
- });
66
- }
67
- project(lineNumber) {
68
- const lastBefore = findLast(this.lineRangeMappings, r => r.inputRange.startLineNumber <= lineNumber);
69
- if (!lastBefore) {
70
- return ( new LineRangeMapping(( new LineRange(lineNumber, 1)), ( new LineRange(lineNumber, 1))));
71
- }
72
- if (lastBefore.inputRange.contains(lineNumber)) {
73
- return lastBefore;
74
- }
75
- const containingRange = ( new LineRange(lineNumber, 1));
76
- const mappedRange = ( new LineRange(lineNumber +
77
- lastBefore.outputRange.endLineNumberExclusive -
78
- lastBefore.inputRange.endLineNumberExclusive, 1));
79
- return ( new LineRangeMapping(containingRange, mappedRange));
80
- }
81
- get outputLineCount() {
82
- const last = lastOrDefault(this.lineRangeMappings);
83
- const diff = last ? last.outputRange.endLineNumberExclusive - last.inputRange.endLineNumberExclusive : 0;
84
- return this.inputLineCount + diff;
85
- }
86
- reverse() {
87
- return ( new DocumentLineRangeMap(( this.lineRangeMappings.map(r => r.reverse())), this.outputLineCount));
88
- }
89
- }
90
- class MappingAlignment {
91
- static compute(fromInputToOutput1, fromInputToOutput2) {
92
- const compareByStartLineNumber = compareBy((d) => d.inputRange.startLineNumber, numberComparator);
93
- const combinedDiffs = concatArrays(( fromInputToOutput1.map((diff) => ({ source: 0, diff }))), ( fromInputToOutput2.map((diff) => ({ source: 1, diff })))).sort(compareBy((d) => d.diff, compareByStartLineNumber));
94
- const currentDiffs = [( new Array()), ( new Array())];
95
- const deltaFromBaseToInput = [0, 0];
96
- const alignments = ( new Array());
97
- function pushAndReset(inputRange) {
98
- const mapping1 = LineRangeMapping.join(currentDiffs[0]) || ( new LineRangeMapping(inputRange, inputRange.delta(deltaFromBaseToInput[0])));
99
- const mapping2 = LineRangeMapping.join(currentDiffs[1]) || ( new LineRangeMapping(inputRange, inputRange.delta(deltaFromBaseToInput[1])));
100
- alignments.push(( new MappingAlignment(
101
- currentInputRange,
102
- mapping1.extendInputRange(currentInputRange).outputRange,
103
- currentDiffs[0],
104
- mapping2.extendInputRange(currentInputRange).outputRange,
105
- currentDiffs[1]
106
- )));
107
- currentDiffs[0] = [];
108
- currentDiffs[1] = [];
109
- }
110
- let currentInputRange;
111
- for (const diff of combinedDiffs) {
112
- const range = diff.diff.inputRange;
113
- if (currentInputRange && !currentInputRange.touches(range)) {
114
- pushAndReset(currentInputRange);
115
- currentInputRange = undefined;
116
- }
117
- deltaFromBaseToInput[diff.source] =
118
- diff.diff.resultingDeltaFromOriginalToModified;
119
- currentInputRange = currentInputRange ? currentInputRange.join(range) : range;
120
- currentDiffs[diff.source].push(diff.diff);
121
- }
122
- if (currentInputRange) {
123
- pushAndReset(currentInputRange);
124
- }
125
- return alignments;
126
- }
127
- constructor(inputRange, output1Range, output1LineMappings, output2Range, output2LineMappings) {
128
- this.inputRange = inputRange;
129
- this.output1Range = output1Range;
130
- this.output1LineMappings = output1LineMappings;
131
- this.output2Range = output2Range;
132
- this.output2LineMappings = output2LineMappings;
133
- }
134
- toString() {
135
- return `${this.output1Range} <- ${this.inputRange} -> ${this.output2Range}`;
136
- }
137
- }
138
- class DetailedLineRangeMapping extends LineRangeMapping {
139
- static join(mappings) {
140
- return mappings.reduce((acc, cur) => acc ? acc.join(cur) : cur, undefined);
141
- }
142
- constructor(inputRange, inputTextModel, outputRange, outputTextModel, rangeMappings) {
143
- super(inputRange, outputRange);
144
- this.inputTextModel = inputTextModel;
145
- this.outputTextModel = outputTextModel;
146
- this.rangeMappings = rangeMappings || [( new RangeMapping(this.inputRange.toRange(), this.outputRange.toRange()))];
147
- }
148
- addOutputLineDelta(delta) {
149
- return ( new DetailedLineRangeMapping(
150
- this.inputRange,
151
- this.inputTextModel,
152
- this.outputRange.delta(delta),
153
- this.outputTextModel,
154
- ( this.rangeMappings.map(d => d.addOutputLineDelta(delta)))
155
- ));
156
- }
157
- addInputLineDelta(delta) {
158
- return ( new DetailedLineRangeMapping(
159
- this.inputRange.delta(delta),
160
- this.inputTextModel,
161
- this.outputRange,
162
- this.outputTextModel,
163
- ( this.rangeMappings.map(d => d.addInputLineDelta(delta)))
164
- ));
165
- }
166
- join(other) {
167
- return ( new DetailedLineRangeMapping(
168
- this.inputRange.join(other.inputRange),
169
- this.inputTextModel,
170
- this.outputRange.join(other.outputRange),
171
- this.outputTextModel
172
- ));
173
- }
174
- getLineEdit() {
175
- return ( new LineRangeEdit(this.inputRange, this.getOutputLines()));
176
- }
177
- getReverseLineEdit() {
178
- return ( new LineRangeEdit(this.outputRange, this.getInputLines()));
179
- }
180
- getOutputLines() {
181
- return this.outputRange.getLines(this.outputTextModel);
182
- }
183
- getInputLines() {
184
- return this.inputRange.getLines(this.inputTextModel);
185
- }
186
- }
187
- class RangeMapping {
188
- constructor(inputRange, outputRange) {
189
- this.inputRange = inputRange;
190
- this.outputRange = outputRange;
191
- }
192
- toString() {
193
- function rangeToString(range) {
194
- return `[${range.startLineNumber}:${range.startColumn}, ${range.endLineNumber}:${range.endColumn})`;
195
- }
196
- return `${rangeToString(this.inputRange)} -> ${rangeToString(this.outputRange)}`;
197
- }
198
- addOutputLineDelta(deltaLines) {
199
- return ( new RangeMapping(this.inputRange, ( new Range(
200
- this.outputRange.startLineNumber + deltaLines,
201
- this.outputRange.startColumn,
202
- this.outputRange.endLineNumber + deltaLines,
203
- this.outputRange.endColumn
204
- ))));
205
- }
206
- addInputLineDelta(deltaLines) {
207
- return ( new RangeMapping(( new Range(
208
- this.inputRange.startLineNumber + deltaLines,
209
- this.inputRange.startColumn,
210
- this.inputRange.endLineNumber + deltaLines,
211
- this.inputRange.endColumn
212
- )), this.outputRange));
213
- }
214
- reverse() {
215
- return ( new RangeMapping(this.outputRange, this.inputRange));
216
- }
217
- }
218
- class DocumentRangeMap {
219
- constructor(
220
- rangeMappings, inputLineCount) {
221
- this.rangeMappings = rangeMappings;
222
- this.inputLineCount = inputLineCount;
223
- assertFn(() => checkAdjacentItems(rangeMappings, (m1, m2) => rangeIsBeforeOrTouching(m1.inputRange, m2.inputRange) &&
224
- rangeIsBeforeOrTouching(m1.outputRange, m2.outputRange)
225
- ));
226
- }
227
- project(position) {
228
- const lastBefore = findLast(this.rangeMappings, r => r.inputRange.getStartPosition().isBeforeOrEqual(position));
229
- if (!lastBefore) {
230
- return ( new RangeMapping(
231
- Range.fromPositions(position, position),
232
- Range.fromPositions(position, position)
233
- ));
234
- }
235
- if (rangeContainsPosition(lastBefore.inputRange, position)) {
236
- return lastBefore;
237
- }
238
- const dist = lengthBetweenPositions(lastBefore.inputRange.getEndPosition(), position);
239
- const outputPos = addLength(lastBefore.outputRange.getEndPosition(), dist);
240
- return ( new RangeMapping(Range.fromPositions(position), Range.fromPositions(outputPos)));
241
- }
242
- projectRange(range) {
243
- const start = this.project(range.getStartPosition());
244
- const end = this.project(range.getEndPosition());
245
- return ( new RangeMapping(
246
- start.inputRange.plusRange(end.inputRange),
247
- start.outputRange.plusRange(end.outputRange)
248
- ));
249
- }
250
- get outputLineCount() {
251
- const last = lastOrDefault(this.rangeMappings);
252
- const diff = last ? last.outputRange.endLineNumber - last.inputRange.endLineNumber : 0;
253
- return this.inputLineCount + diff;
254
- }
255
- reverse() {
256
- return ( new DocumentRangeMap(( this.rangeMappings.map(m => m.reverse())), this.outputLineCount));
257
- }
258
- }
259
-
260
- export { DetailedLineRangeMapping, DocumentLineRangeMap, DocumentRangeMap, LineRangeMapping, MappingAlignment, RangeMapping };