monaco-editor 0.58.0-dev-20261103 → 0.58.0-dev-20261105
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/CHANGELOG.md +11 -0
- package/dev/vs/assets/{css.worker-BXibjW7G.js → css.worker-C3Fca00n.js} +25 -21
- package/dev/vs/assets/{editor.worker-rm-mUaEO.js → editor.worker-CMQdN7Gz.js} +25 -21
- package/dev/vs/assets/{editorWebWorkerMain-BYRxwar0.js → editorWebWorkerMain-CZFKV3Sq.js} +25 -21
- package/dev/vs/assets/{html.worker-CrmruGcV.js → html.worker-D6JwdtKY.js} +25 -21
- package/dev/vs/assets/{json.worker-CsrWcsbY.js → json.worker-D88jdrJI.js} +25 -21
- package/dev/vs/assets/{ts.worker-BsddPuAD.js → ts.worker-C1jiN0UJ.js} +25 -21
- package/dev/vs/basic-languages/monaco.contribution.js +18 -18
- package/dev/vs/{css.worker-Cbj6Lgyl.js → css.worker-MMxx4Eli.js} +2 -2
- package/dev/vs/{cssMode-DDsK7kN3.js → cssMode-CTIuXU1I.js} +1 -1
- package/dev/vs/editor/editor.main.css +5 -1
- package/dev/vs/editor/editor.main.js +2 -2
- package/dev/vs/editor/editor.worker.js +1 -1
- package/dev/vs/{editor-DKS349od.js → editor-DRJlQG9s.js} +202 -54
- package/dev/vs/editor.js +1 -1
- package/dev/vs/{editorWorkerHost-C8IUfXRE.js → editorWorkerHost-Ci4jDF67.js} +30 -22
- package/dev/vs/{freemarker2-mKL_tDAS.js → freemarker2-DfylfLEF.js} +1 -1
- package/dev/vs/{handlebars-0cbIdUh5.js → handlebars-DMCj88rN.js} +1 -1
- package/dev/vs/{html-B7tWGiS1.js → html-CU4DKPqI.js} +1 -1
- package/dev/vs/{html.worker-8rO_Ej2A.js → html.worker-CawCoGvB.js} +2 -2
- package/dev/vs/{htmlMode-CY_haO3T.js → htmlMode-xHeLAFjz.js} +1 -1
- package/dev/vs/{index-3iBj28Mi.js → index-BXHr1DOu.js} +1 -1
- package/dev/vs/index.js +1 -1
- package/dev/vs/{initialize-ItNUYCgW.js → initialize-BFgu8eju.js} +1 -1
- package/dev/vs/{javascript-BPzI8Zuf.js → javascript-DLFmpSo0.js} +1 -1
- package/dev/vs/{json.worker-Bza_nH_U.js → json.worker-DWZWlrXK.js} +2 -2
- package/dev/vs/{jsonMode-BMa6sTpi.js → jsonMode-cVIZRZ7b.js} +1 -1
- package/dev/vs/language/css/css.worker.js +1 -1
- package/dev/vs/language/css/monaco.contribution.js +1 -1
- package/dev/vs/language/html/html.worker.js +1 -1
- package/dev/vs/language/html/monaco.contribution.js +1 -1
- package/dev/vs/language/json/json.worker.js +1 -1
- package/dev/vs/language/json/monaco.contribution.js +1 -1
- package/dev/vs/language/typescript/monaco.contribution.js +1 -1
- package/dev/vs/language/typescript/ts.worker.js +1 -1
- package/dev/vs/{liquid-TWvvsWgh.js → liquid-Dy68PSh2.js} +1 -1
- package/dev/vs/{lspLanguageFeatures-CAQu2Ud8.js → lspLanguageFeatures-BEuBXUIi.js} +1 -1
- package/dev/vs/{mdx-D72RTe8f.js → mdx-CqpdLLfI.js} +1 -1
- package/dev/vs/{monaco.contribution-D7iHvEWH.js → monaco.contribution-B2rf45ee.js} +2 -2
- package/dev/vs/{monaco.contribution-39YZ4VV2.js → monaco.contribution-CH5Igx20.js} +2 -2
- package/dev/vs/{monaco.contribution-B_1bsLaH.js → monaco.contribution-DCig2kug.js} +2 -2
- package/dev/vs/{monaco.contribution-b4fF5a-f.js → monaco.contribution-DG_MEtmr.js} +2 -2
- package/dev/vs/nls/lang/cs.js +1 -1
- package/dev/vs/nls/lang/de.js +1 -1
- package/dev/vs/nls/lang/es.js +1 -1
- package/dev/vs/nls/lang/fr.js +1 -1
- package/dev/vs/nls/lang/it.js +1 -1
- package/dev/vs/nls/lang/ja.js +1 -1
- package/dev/vs/nls/lang/ko.js +1 -1
- package/dev/vs/nls/lang/pl.js +1 -1
- package/dev/vs/nls/lang/pt-br.js +1 -1
- package/dev/vs/nls/lang/ru.js +1 -1
- package/dev/vs/nls/lang/tr.js +1 -1
- package/dev/vs/nls/lang/zh-cn.js +1 -1
- package/dev/vs/nls/lang/zh-tw.js +1 -1
- package/dev/vs/{python-BEA_VDf5.js → python-N8-RFLZD.js} +1 -1
- package/dev/vs/{razor-B_Y4fRDb.js → razor-BsskAxjx.js} +1 -1
- package/dev/vs/{toggleHighContrast-CgFa878v.js → toggleHighContrast-DFwN3RC8.js} +67 -52
- package/dev/vs/{ts.worker-CMIpX4_0.js → ts.worker-DhCULzao.js} +2 -2
- package/dev/vs/{tsMode-BhOzGsil.js → tsMode-DQ88TCq6.js} +1 -1
- package/dev/vs/{typescript-CW5I38Ex.js → typescript-C0WVzXrQ.js} +1 -1
- package/dev/vs/{workers-DcW-LZDs.js → workers-BZKW3VqS.js} +1 -1
- package/dev/vs/{xml-BJKDlWxj.js → xml-DUW3ABqK.js} +1 -1
- package/dev/vs/{yaml-DcAjn74d.js → yaml-DwWDrn-O.js} +1 -1
- package/esm/vs/base/browser/markdownRenderer.js +4 -1
- package/esm/vs/base/browser/ui/actionbar/actionViewItems.js +5 -1
- package/esm/vs/base/browser/ui/menu/menu.js +91 -19
- package/esm/vs/base/browser/ui/splitview/splitview.js +2 -0
- package/esm/vs/base/common/actions.js +18 -8
- package/esm/vs/base/common/buffer.js +4 -0
- package/esm/vs/base/common/htmlContent.js +58 -12
- package/esm/vs/base/common/platform.js +3 -0
- package/esm/vs/editor/browser/services/openerService.js +1 -0
- package/esm/vs/editor/browser/viewParts/minimap/minimap.css +5 -1
- package/esm/vs/editor/browser/viewParts/minimap/minimap.js +9 -3
- package/esm/vs/editor/browser/widget/multiDiffEditor/multiDiffEditorWidgetImpl.js +7 -3
- package/esm/vs/editor/common/config/editorConfigurationSchema.js +2 -1
- package/esm/vs/editor/common/diff/defaultLinesDiffComputer/defaultLinesDiffComputer.js +22 -9
- package/esm/vs/editor/common/diff/externalLinesDiffComputer.js +4 -20
- package/esm/vs/editor/contrib/colorPicker/browser/colorPickerParts/colorPickerSaturationBox.js +3 -7
- package/esm/vs/editor/contrib/colorPicker/browser/colorPickerParts/colorPickerStrip.js +3 -3
- package/esm/vs/editor/contrib/hover/browser/contentHoverController.js +7 -1
- package/esm/vs/editor/contrib/links/browser/links.js +3 -2
- package/esm/vs/nls/lang/cs.js +1 -1
- package/esm/vs/nls/lang/de.js +1 -1
- package/esm/vs/nls/lang/es.js +1 -1
- package/esm/vs/nls/lang/fr.js +1 -1
- package/esm/vs/nls/lang/it.js +1 -1
- package/esm/vs/nls/lang/ja.js +1 -1
- package/esm/vs/nls/lang/ko.js +1 -1
- package/esm/vs/nls/lang/pl.js +1 -1
- package/esm/vs/nls/lang/pt-br.js +1 -1
- package/esm/vs/nls/lang/ru.js +1 -1
- package/esm/vs/nls/lang/tr.js +1 -1
- package/esm/vs/nls/lang/zh-cn.js +1 -1
- package/esm/vs/nls/lang/zh-tw.js +1 -1
- package/esm/vs/platform/actionWidget/browser/actionList.js +55 -39
- package/esm/vs/platform/actions/common/actions.js +36 -2
- package/esm/vs/platform/actions/common/menuService.js +4 -2
- package/esm/vs/platform/contextkey/common/contextkey.js +19 -5
- package/esm/vs/platform/contextview/browser/contextMenuHandler.js +6 -2
- package/min/vs/assets/{css.worker-Dcv39cro.js → css.worker-BqM4eonz.js} +35 -37
- package/min/vs/assets/{editor.worker-Ds78qao_.js → editor.worker-mE4Cg5OU.js} +18 -20
- package/min/vs/assets/{editorWebWorkerMain-BKhlQlwl.js → editorWebWorkerMain-Clv56-8z.js} +18 -20
- package/min/vs/assets/{html.worker-CRx6sQRc.js → html.worker-Bgixh69X.js} +33 -35
- package/min/vs/assets/{json.worker-DUgsMPK4.js → json.worker-cbamKqJm.js} +29 -31
- package/min/vs/assets/{ts.worker-BsBMEI-E.js → ts.worker--aHci1nB.js} +113 -115
- package/min/vs/basic-languages/monaco.contribution.js +1 -1
- package/min/vs/css.worker-85Fzggpz.js +1 -0
- package/min/vs/{cssMode-x3bYRp97.js → cssMode-DYWJtW10.js} +1 -1
- package/min/vs/editor/editor.main.css +1 -1
- package/min/vs/editor/editor.main.js +1 -1
- package/min/vs/editor/editor.worker.js +1 -1
- package/min/vs/{editor-DCqhdM2J.js → editor-BFbEFc_I.js} +163 -139
- package/min/vs/editor.js +1 -1
- package/min/vs/{editorWorkerHost-D_Q8nkQ1.js → editorWorkerHost-l5K3heZh.js} +21 -23
- package/min/vs/{freemarker2-DLRyyVzK.js → freemarker2-ClAtsE_F.js} +1 -1
- package/min/vs/{handlebars-AlA7PZUi.js → handlebars-Ciwcx8bC.js} +1 -1
- package/min/vs/{html-BsRVzZQ5.js → html-1M76dnGJ.js} +1 -1
- package/min/vs/html.worker-3GmoXXzx.js +1 -0
- package/min/vs/{htmlMode-B3eOM2eK.js → htmlMode-BlByhTpy.js} +1 -1
- package/min/vs/{index-B0VP4pSX.js → index-PUoSNLLx.js} +1 -1
- package/min/vs/index.js +1 -1
- package/min/vs/{initialize-Dm2jEtk_.js → initialize-vEw6iZXO.js} +1 -1
- package/min/vs/{javascript-BlVqaSgt.js → javascript-BGfX2zMA.js} +1 -1
- package/min/vs/json.worker-B3SMyu1M.js +1 -0
- package/min/vs/{jsonMode-B_kyvD_h.js → jsonMode-Clv268dV.js} +1 -1
- package/min/vs/language/css/css.worker.js +1 -1
- package/min/vs/language/css/monaco.contribution.js +1 -1
- package/min/vs/language/html/html.worker.js +1 -1
- package/min/vs/language/html/monaco.contribution.js +1 -1
- package/min/vs/language/json/json.worker.js +1 -1
- package/min/vs/language/json/monaco.contribution.js +1 -1
- package/min/vs/language/typescript/monaco.contribution.js +1 -1
- package/min/vs/language/typescript/ts.worker.js +1 -1
- package/min/vs/{liquid-C-80sK-s.js → liquid-R72OjD6y.js} +1 -1
- package/min/vs/{lspLanguageFeatures-Dchqf_5B.js → lspLanguageFeatures-DdkEmRRW.js} +1 -1
- package/min/vs/{mdx-CsCH1P23.js → mdx-BAP9ZOIP.js} +1 -1
- package/min/vs/{monaco.contribution-B0e4tKKO.js → monaco.contribution-Baq4Rp09.js} +1 -1
- package/min/vs/{monaco.contribution-CgWraPpD.js → monaco.contribution-BcRrM1Sa.js} +1 -1
- package/min/vs/{monaco.contribution-BBOWNKe4.js → monaco.contribution-bElborlK.js} +1 -1
- package/min/vs/{monaco.contribution-CQMdDc0R.js → monaco.contribution-hSMXadYd.js} +1 -1
- package/min/vs/nls/lang/cs.js +1 -1
- package/min/vs/nls/lang/de.js +1 -1
- package/min/vs/nls/lang/es.js +1 -1
- package/min/vs/nls/lang/fr.js +1 -1
- package/min/vs/nls/lang/it.js +1 -1
- package/min/vs/nls/lang/ja.js +1 -1
- package/min/vs/nls/lang/ko.js +1 -1
- package/min/vs/nls/lang/pl.js +1 -1
- package/min/vs/nls/lang/pt-br.js +1 -1
- package/min/vs/nls/lang/ru.js +1 -1
- package/min/vs/nls/lang/tr.js +1 -1
- package/min/vs/nls/lang/zh-cn.js +1 -1
- package/min/vs/nls/lang/zh-tw.js +1 -1
- package/min/vs/{python-CpaqYDlz.js → python-C1MlHFpY.js} +1 -1
- package/min/vs/{razor-5aUqxT5R.js → razor-6o-KN_vb.js} +1 -1
- package/min/vs/{toggleHighContrast-Si6AE5-d.js → toggleHighContrast-CDZGFxuD.js} +22 -22
- package/min/vs/ts.worker-DSyALlF_.js +1 -0
- package/min/vs/{tsMode-DnNOhxB1.js → tsMode-CKItzx1i.js} +1 -1
- package/min/vs/{typescript-CbCtrC5M.js → typescript-BGBkOnto.js} +1 -1
- package/min/vs/{workers-BvZSPxig.js → workers-BEUlV0p3.js} +1 -1
- package/min/vs/{xml-CpsiMgp1.js → xml-AJ9vYulU.js} +1 -1
- package/min/vs/{yaml-BsiS2ov2.js → yaml-hpg4mTpo.js} +1 -1
- package/package.json +5 -5
- package/min/vs/css.worker-zn-SRDmD.js +0 -1
- package/min/vs/html.worker-DgjxB0R_.js +0 -1
- package/min/vs/json.worker-wUA-Y1Kg.js +0 -1
- package/min/vs/ts.worker-D3mizVFr.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Monaco Editor Changelog
|
|
2
2
|
|
|
3
|
+
## [0.57.1]
|
|
4
|
+
|
|
5
|
+
### Breaking Changes
|
|
6
|
+
|
|
7
|
+
- Markdown rendered by the editor (hovers, suggestion details, parameter hints, inline completion warnings, editor messages) no longer loads remote images by default. `data:` images are still shown. Use the new `markdownImages.allowedOrigins` editor option to allow images from specific origins (for example `['https://img.shields.io']`), or set it to `true` to allow all remote images as before.
|
|
8
|
+
|
|
9
|
+
### Updates
|
|
10
|
+
|
|
11
|
+
- Updates the editor core to VS Code commit `3bc96745d6414f97cd0c09e753ecf698b7829101`, validated in `0.58.0-dev-20261103`.
|
|
12
|
+
- Updates bundled DOMPurify from 3.4.15 to 3.4.17.
|
|
13
|
+
|
|
3
14
|
## [0.57.0]
|
|
4
15
|
|
|
5
16
|
### New Features and APIs
|
|
@@ -600,6 +600,7 @@
|
|
|
600
600
|
let _locale = void 0;
|
|
601
601
|
let _language = LANGUAGE_DEFAULT;
|
|
602
602
|
let _platformLocale = LANGUAGE_DEFAULT;
|
|
603
|
+
let _regionalLocale = LANGUAGE_DEFAULT;
|
|
603
604
|
let _translationsConfigFile = void 0;
|
|
604
605
|
let _userAgent = void 0;
|
|
605
606
|
const $globalThis = globalThis;
|
|
@@ -626,6 +627,7 @@
|
|
|
626
627
|
const nlsConfig = JSON.parse(rawNlsConfig);
|
|
627
628
|
_locale = nlsConfig.userLocale;
|
|
628
629
|
_platformLocale = nlsConfig.osLocale;
|
|
630
|
+
_regionalLocale = nlsConfig.regionalLocale ?? nlsConfig.osLocale;
|
|
629
631
|
_language = nlsConfig.resolvedLanguage || LANGUAGE_DEFAULT;
|
|
630
632
|
_translationsConfigFile = nlsConfig.languagePack?.translationsConfigFile;
|
|
631
633
|
} catch (e) {
|
|
@@ -644,6 +646,7 @@
|
|
|
644
646
|
_language = getNLSLanguage() || LANGUAGE_DEFAULT;
|
|
645
647
|
_locale = navigator.language.toLowerCase();
|
|
646
648
|
_platformLocale = _locale;
|
|
649
|
+
_regionalLocale = _locale;
|
|
647
650
|
} else {
|
|
648
651
|
console.error("Unable to resolve platform.");
|
|
649
652
|
}
|
|
@@ -12153,14 +12156,17 @@
|
|
|
12153
12156
|
this.myersDiffingAlgorithm = new MyersDiffAlgorithm();
|
|
12154
12157
|
}
|
|
12155
12158
|
computeDiff(originalLines, modifiedLines, options) {
|
|
12159
|
+
return this._computeDiff(originalLines, modifiedLines, options);
|
|
12160
|
+
}
|
|
12161
|
+
_computeDiff(originalLines, modifiedLines, options, rawChanges) {
|
|
12156
12162
|
if (originalLines.length <= 1 && equals(originalLines, modifiedLines, (a2, b) => a2 === b)) {
|
|
12157
12163
|
return new LinesDiff([], [], false);
|
|
12158
12164
|
}
|
|
12159
12165
|
if (originalLines.length === 1 && originalLines[0].length === 0 || modifiedLines.length === 1 && modifiedLines[0].length === 0) {
|
|
12166
|
+
const rangeMapping = new RangeMapping(new Range$1(1, 1, originalLines.length, originalLines[originalLines.length - 1].length + 1), new Range$1(1, 1, modifiedLines.length, modifiedLines[modifiedLines.length - 1].length + 1));
|
|
12167
|
+
rawChanges?.push(rangeMapping);
|
|
12160
12168
|
return new LinesDiff([
|
|
12161
|
-
new DetailedLineRangeMapping(new LineRange(1, originalLines.length + 1), new LineRange(1, modifiedLines.length + 1), [
|
|
12162
|
-
new RangeMapping(new Range$1(1, 1, originalLines.length, originalLines[originalLines.length - 1].length + 1), new Range$1(1, 1, modifiedLines.length, modifiedLines[modifiedLines.length - 1].length + 1))
|
|
12163
|
-
])
|
|
12169
|
+
new DetailedLineRangeMapping(new LineRange(1, originalLines.length + 1), new LineRange(1, modifiedLines.length + 1), [rangeMapping])
|
|
12164
12170
|
], [], false);
|
|
12165
12171
|
}
|
|
12166
12172
|
const timeout = options.maxComputationTimeMs === 0 ? InfiniteTimeout.instance : new DateTimeout(options.maxComputationTimeMs);
|
|
@@ -12197,7 +12203,7 @@
|
|
|
12197
12203
|
const seq1Offset = seq1LastStart + i;
|
|
12198
12204
|
const seq2Offset = seq2LastStart + i;
|
|
12199
12205
|
if (originalLines[seq1Offset] !== modifiedLines[seq2Offset]) {
|
|
12200
|
-
const characterDiffs = this.refineDiff(originalLines, modifiedLines, new SequenceDiff(new OffsetRange(seq1Offset, seq1Offset + 1), new OffsetRange(seq2Offset, seq2Offset + 1)), timeout, considerWhitespaceChanges, options);
|
|
12206
|
+
const characterDiffs = this.refineDiff(originalLines, modifiedLines, new SequenceDiff(new OffsetRange(seq1Offset, seq1Offset + 1), new OffsetRange(seq2Offset, seq2Offset + 1)), timeout, considerWhitespaceChanges, options, rawChanges);
|
|
12201
12207
|
for (const a2 of characterDiffs.mappings) {
|
|
12202
12208
|
alignments.push(a2);
|
|
12203
12209
|
}
|
|
@@ -12215,7 +12221,7 @@
|
|
|
12215
12221
|
scanForWhitespaceChanges(equalLinesCount);
|
|
12216
12222
|
seq1LastStart = diff.seq1Range.endExclusive;
|
|
12217
12223
|
seq2LastStart = diff.seq2Range.endExclusive;
|
|
12218
|
-
const characterDiffs = this.refineDiff(originalLines, modifiedLines, diff, timeout, considerWhitespaceChanges, options);
|
|
12224
|
+
const characterDiffs = this.refineDiff(originalLines, modifiedLines, diff, timeout, considerWhitespaceChanges, options, rawChanges);
|
|
12219
12225
|
if (characterDiffs.hitTimeout) {
|
|
12220
12226
|
hitTimeout = true;
|
|
12221
12227
|
}
|
|
@@ -12278,12 +12284,21 @@
|
|
|
12278
12284
|
});
|
|
12279
12285
|
return movesWithDiffs;
|
|
12280
12286
|
}
|
|
12281
|
-
refineDiff(originalLines, modifiedLines, diff, timeout, considerWhitespaceChanges, options) {
|
|
12287
|
+
refineDiff(originalLines, modifiedLines, diff, timeout, considerWhitespaceChanges, options, rawChanges) {
|
|
12282
12288
|
const lineRangeMapping = toLineRangeMapping(diff);
|
|
12283
12289
|
const rangeMapping = lineRangeMapping.toRangeMapping2(originalLines, modifiedLines);
|
|
12284
12290
|
const slice1 = new LinesSliceCharSequence(originalLines, rangeMapping.originalRange, considerWhitespaceChanges);
|
|
12285
12291
|
const slice2 = new LinesSliceCharSequence(modifiedLines, rangeMapping.modifiedRange, considerWhitespaceChanges);
|
|
12286
|
-
const
|
|
12292
|
+
const useDynamicProgramming = slice1.length + slice2.length < 500;
|
|
12293
|
+
const diffResult = useDynamicProgramming ? this.dynamicProgrammingDiffing.compute(slice1, slice2, timeout) : this.myersDiffingAlgorithm.compute(slice1, slice2, timeout);
|
|
12294
|
+
let hitTimeout = diffResult.hitTimeout;
|
|
12295
|
+
if (rawChanges) {
|
|
12296
|
+
const rawResult = useDynamicProgramming && !hitTimeout ? this.myersDiffingAlgorithm.compute(slice1, slice2, timeout) : diffResult;
|
|
12297
|
+
hitTimeout ||= rawResult.hitTimeout;
|
|
12298
|
+
for (const change of rawResult.diffs) {
|
|
12299
|
+
rawChanges.push(new RangeMapping(slice1.translateRange(change.seq1Range), slice2.translateRange(change.seq2Range)));
|
|
12300
|
+
}
|
|
12301
|
+
}
|
|
12287
12302
|
let diffs = diffResult.diffs;
|
|
12288
12303
|
diffs = optimizeSequenceDiffs(slice1, slice2, diffs);
|
|
12289
12304
|
diffs = extendDiffsToEntireWordIfAppropriate(slice1, slice2, diffs, (seq, idx) => seq.findWordContaining(idx));
|
|
@@ -12295,7 +12310,7 @@
|
|
|
12295
12310
|
const result = diffs.map((d) => new RangeMapping(slice1.translateRange(d.seq1Range), slice2.translateRange(d.seq2Range)));
|
|
12296
12311
|
return {
|
|
12297
12312
|
mappings: result,
|
|
12298
|
-
hitTimeout
|
|
12313
|
+
hitTimeout
|
|
12299
12314
|
};
|
|
12300
12315
|
}
|
|
12301
12316
|
}
|
|
@@ -12862,8 +12877,7 @@
|
|
|
12862
12877
|
const originalText = new StringText(originalLines.join("\n"));
|
|
12863
12878
|
const modifiedText = new StringText(modifiedLines.join("\n"));
|
|
12864
12879
|
const result = this._computer.computeDiff(originalText.value, modifiedText.value, {
|
|
12865
|
-
|
|
12866
|
-
// TODO: forward `maxComputationTimeMs` after updating @vscode/diff. The wasm build of the pinned version panics when measuring time.
|
|
12880
|
+
maxComputationTimeMs: options.maxComputationTimeMs,
|
|
12867
12881
|
computeMoves: options.computeMoves,
|
|
12868
12882
|
extendToSubwords: options.extendToSubwords
|
|
12869
12883
|
});
|
|
@@ -12875,7 +12889,7 @@
|
|
|
12875
12889
|
const originalRange = new OffsetRange(r.range.start, r.range.endExclusive);
|
|
12876
12890
|
const modifiedRange = new OffsetRange(r.range.start + delta, r.range.start + delta + r.newText.length);
|
|
12877
12891
|
delta += r.newText.length - originalRange.length;
|
|
12878
|
-
if (options.ignoreTrimWhitespace &&
|
|
12892
|
+
if (options.ignoreTrimWhitespace && r.data.isTrimWhitespaceChange) {
|
|
12879
12893
|
continue;
|
|
12880
12894
|
}
|
|
12881
12895
|
rangeMappings.push(new RangeMapping(originalTransformer.getRange(originalRange), modifiedTransformer.getRange(modifiedRange)));
|
|
@@ -12896,16 +12910,6 @@
|
|
|
12896
12910
|
return new LinesDiff(changes, moves, result.hitTimeout);
|
|
12897
12911
|
}
|
|
12898
12912
|
}
|
|
12899
|
-
const whitespaceWithoutLineBreak = /^[^\S\n]*$/;
|
|
12900
|
-
function isInTrimWhitespace(text, range) {
|
|
12901
|
-
if (!whitespaceWithoutLineBreak.test(range.substring(text))) {
|
|
12902
|
-
return false;
|
|
12903
|
-
}
|
|
12904
|
-
const lineStart = range.start === 0 ? 0 : text.lastIndexOf("\n", range.start - 1) + 1;
|
|
12905
|
-
const nextLineBreak = text.indexOf("\n", range.endExclusive);
|
|
12906
|
-
const lineEnd = nextLineBreak === -1 ? text.length : nextLineBreak;
|
|
12907
|
-
return whitespaceWithoutLineBreak.test(text.substring(lineStart, range.start)) || whitespaceWithoutLineBreak.test(text.substring(range.endExclusive, lineEnd));
|
|
12908
|
-
}
|
|
12909
12913
|
const linesDiffComputers = {
|
|
12910
12914
|
getLegacy: () => new LegacyLinesDiffComputer(),
|
|
12911
12915
|
getDefault: () => new DefaultLinesDiffComputer(),
|
|
@@ -601,6 +601,7 @@
|
|
|
601
601
|
let _locale = void 0;
|
|
602
602
|
let _language = LANGUAGE_DEFAULT;
|
|
603
603
|
let _platformLocale = LANGUAGE_DEFAULT;
|
|
604
|
+
let _regionalLocale = LANGUAGE_DEFAULT;
|
|
604
605
|
let _translationsConfigFile = void 0;
|
|
605
606
|
let _userAgent = void 0;
|
|
606
607
|
const $globalThis = globalThis;
|
|
@@ -627,6 +628,7 @@
|
|
|
627
628
|
const nlsConfig = JSON.parse(rawNlsConfig);
|
|
628
629
|
_locale = nlsConfig.userLocale;
|
|
629
630
|
_platformLocale = nlsConfig.osLocale;
|
|
631
|
+
_regionalLocale = nlsConfig.regionalLocale ?? nlsConfig.osLocale;
|
|
630
632
|
_language = nlsConfig.resolvedLanguage || LANGUAGE_DEFAULT;
|
|
631
633
|
_translationsConfigFile = nlsConfig.languagePack?.translationsConfigFile;
|
|
632
634
|
} catch (e) {
|
|
@@ -645,6 +647,7 @@
|
|
|
645
647
|
_language = getNLSLanguage() || LANGUAGE_DEFAULT;
|
|
646
648
|
_locale = navigator.language.toLowerCase();
|
|
647
649
|
_platformLocale = _locale;
|
|
650
|
+
_regionalLocale = _locale;
|
|
648
651
|
} else {
|
|
649
652
|
console.error("Unable to resolve platform.");
|
|
650
653
|
}
|
|
@@ -12158,14 +12161,17 @@
|
|
|
12158
12161
|
this.myersDiffingAlgorithm = new MyersDiffAlgorithm();
|
|
12159
12162
|
}
|
|
12160
12163
|
computeDiff(originalLines, modifiedLines, options) {
|
|
12164
|
+
return this._computeDiff(originalLines, modifiedLines, options);
|
|
12165
|
+
}
|
|
12166
|
+
_computeDiff(originalLines, modifiedLines, options, rawChanges) {
|
|
12161
12167
|
if (originalLines.length <= 1 && equals(originalLines, modifiedLines, (a, b) => a === b)) {
|
|
12162
12168
|
return new LinesDiff([], [], false);
|
|
12163
12169
|
}
|
|
12164
12170
|
if (originalLines.length === 1 && originalLines[0].length === 0 || modifiedLines.length === 1 && modifiedLines[0].length === 0) {
|
|
12171
|
+
const rangeMapping = new RangeMapping(new Range(1, 1, originalLines.length, originalLines[originalLines.length - 1].length + 1), new Range(1, 1, modifiedLines.length, modifiedLines[modifiedLines.length - 1].length + 1));
|
|
12172
|
+
rawChanges?.push(rangeMapping);
|
|
12165
12173
|
return new LinesDiff([
|
|
12166
|
-
new DetailedLineRangeMapping(new LineRange(1, originalLines.length + 1), new LineRange(1, modifiedLines.length + 1), [
|
|
12167
|
-
new RangeMapping(new Range(1, 1, originalLines.length, originalLines[originalLines.length - 1].length + 1), new Range(1, 1, modifiedLines.length, modifiedLines[modifiedLines.length - 1].length + 1))
|
|
12168
|
-
])
|
|
12174
|
+
new DetailedLineRangeMapping(new LineRange(1, originalLines.length + 1), new LineRange(1, modifiedLines.length + 1), [rangeMapping])
|
|
12169
12175
|
], [], false);
|
|
12170
12176
|
}
|
|
12171
12177
|
const timeout = options.maxComputationTimeMs === 0 ? InfiniteTimeout.instance : new DateTimeout(options.maxComputationTimeMs);
|
|
@@ -12202,7 +12208,7 @@
|
|
|
12202
12208
|
const seq1Offset = seq1LastStart + i;
|
|
12203
12209
|
const seq2Offset = seq2LastStart + i;
|
|
12204
12210
|
if (originalLines[seq1Offset] !== modifiedLines[seq2Offset]) {
|
|
12205
|
-
const characterDiffs = this.refineDiff(originalLines, modifiedLines, new SequenceDiff(new OffsetRange(seq1Offset, seq1Offset + 1), new OffsetRange(seq2Offset, seq2Offset + 1)), timeout, considerWhitespaceChanges, options);
|
|
12211
|
+
const characterDiffs = this.refineDiff(originalLines, modifiedLines, new SequenceDiff(new OffsetRange(seq1Offset, seq1Offset + 1), new OffsetRange(seq2Offset, seq2Offset + 1)), timeout, considerWhitespaceChanges, options, rawChanges);
|
|
12206
12212
|
for (const a of characterDiffs.mappings) {
|
|
12207
12213
|
alignments.push(a);
|
|
12208
12214
|
}
|
|
@@ -12220,7 +12226,7 @@
|
|
|
12220
12226
|
scanForWhitespaceChanges(equalLinesCount);
|
|
12221
12227
|
seq1LastStart = diff.seq1Range.endExclusive;
|
|
12222
12228
|
seq2LastStart = diff.seq2Range.endExclusive;
|
|
12223
|
-
const characterDiffs = this.refineDiff(originalLines, modifiedLines, diff, timeout, considerWhitespaceChanges, options);
|
|
12229
|
+
const characterDiffs = this.refineDiff(originalLines, modifiedLines, diff, timeout, considerWhitespaceChanges, options, rawChanges);
|
|
12224
12230
|
if (characterDiffs.hitTimeout) {
|
|
12225
12231
|
hitTimeout = true;
|
|
12226
12232
|
}
|
|
@@ -12283,12 +12289,21 @@
|
|
|
12283
12289
|
});
|
|
12284
12290
|
return movesWithDiffs;
|
|
12285
12291
|
}
|
|
12286
|
-
refineDiff(originalLines, modifiedLines, diff, timeout, considerWhitespaceChanges, options) {
|
|
12292
|
+
refineDiff(originalLines, modifiedLines, diff, timeout, considerWhitespaceChanges, options, rawChanges) {
|
|
12287
12293
|
const lineRangeMapping = toLineRangeMapping(diff);
|
|
12288
12294
|
const rangeMapping = lineRangeMapping.toRangeMapping2(originalLines, modifiedLines);
|
|
12289
12295
|
const slice1 = new LinesSliceCharSequence(originalLines, rangeMapping.originalRange, considerWhitespaceChanges);
|
|
12290
12296
|
const slice2 = new LinesSliceCharSequence(modifiedLines, rangeMapping.modifiedRange, considerWhitespaceChanges);
|
|
12291
|
-
const
|
|
12297
|
+
const useDynamicProgramming = slice1.length + slice2.length < 500;
|
|
12298
|
+
const diffResult = useDynamicProgramming ? this.dynamicProgrammingDiffing.compute(slice1, slice2, timeout) : this.myersDiffingAlgorithm.compute(slice1, slice2, timeout);
|
|
12299
|
+
let hitTimeout = diffResult.hitTimeout;
|
|
12300
|
+
if (rawChanges) {
|
|
12301
|
+
const rawResult = useDynamicProgramming && !hitTimeout ? this.myersDiffingAlgorithm.compute(slice1, slice2, timeout) : diffResult;
|
|
12302
|
+
hitTimeout ||= rawResult.hitTimeout;
|
|
12303
|
+
for (const change of rawResult.diffs) {
|
|
12304
|
+
rawChanges.push(new RangeMapping(slice1.translateRange(change.seq1Range), slice2.translateRange(change.seq2Range)));
|
|
12305
|
+
}
|
|
12306
|
+
}
|
|
12292
12307
|
let diffs = diffResult.diffs;
|
|
12293
12308
|
diffs = optimizeSequenceDiffs(slice1, slice2, diffs);
|
|
12294
12309
|
diffs = extendDiffsToEntireWordIfAppropriate(slice1, slice2, diffs, (seq, idx) => seq.findWordContaining(idx));
|
|
@@ -12300,7 +12315,7 @@
|
|
|
12300
12315
|
const result = diffs.map((d) => new RangeMapping(slice1.translateRange(d.seq1Range), slice2.translateRange(d.seq2Range)));
|
|
12301
12316
|
return {
|
|
12302
12317
|
mappings: result,
|
|
12303
|
-
hitTimeout
|
|
12318
|
+
hitTimeout
|
|
12304
12319
|
};
|
|
12305
12320
|
}
|
|
12306
12321
|
}
|
|
@@ -12867,8 +12882,7 @@
|
|
|
12867
12882
|
const originalText = new StringText(originalLines.join("\n"));
|
|
12868
12883
|
const modifiedText = new StringText(modifiedLines.join("\n"));
|
|
12869
12884
|
const result = this._computer.computeDiff(originalText.value, modifiedText.value, {
|
|
12870
|
-
|
|
12871
|
-
// TODO: forward `maxComputationTimeMs` after updating @vscode/diff. The wasm build of the pinned version panics when measuring time.
|
|
12885
|
+
maxComputationTimeMs: options.maxComputationTimeMs,
|
|
12872
12886
|
computeMoves: options.computeMoves,
|
|
12873
12887
|
extendToSubwords: options.extendToSubwords
|
|
12874
12888
|
});
|
|
@@ -12880,7 +12894,7 @@
|
|
|
12880
12894
|
const originalRange = new OffsetRange(r.range.start, r.range.endExclusive);
|
|
12881
12895
|
const modifiedRange = new OffsetRange(r.range.start + delta, r.range.start + delta + r.newText.length);
|
|
12882
12896
|
delta += r.newText.length - originalRange.length;
|
|
12883
|
-
if (options.ignoreTrimWhitespace &&
|
|
12897
|
+
if (options.ignoreTrimWhitespace && r.data.isTrimWhitespaceChange) {
|
|
12884
12898
|
continue;
|
|
12885
12899
|
}
|
|
12886
12900
|
rangeMappings.push(new RangeMapping(originalTransformer.getRange(originalRange), modifiedTransformer.getRange(modifiedRange)));
|
|
@@ -12901,16 +12915,6 @@
|
|
|
12901
12915
|
return new LinesDiff(changes, moves, result.hitTimeout);
|
|
12902
12916
|
}
|
|
12903
12917
|
}
|
|
12904
|
-
const whitespaceWithoutLineBreak = /^[^\S\n]*$/;
|
|
12905
|
-
function isInTrimWhitespace(text, range) {
|
|
12906
|
-
if (!whitespaceWithoutLineBreak.test(range.substring(text))) {
|
|
12907
|
-
return false;
|
|
12908
|
-
}
|
|
12909
|
-
const lineStart = range.start === 0 ? 0 : text.lastIndexOf("\n", range.start - 1) + 1;
|
|
12910
|
-
const nextLineBreak = text.indexOf("\n", range.endExclusive);
|
|
12911
|
-
const lineEnd = nextLineBreak === -1 ? text.length : nextLineBreak;
|
|
12912
|
-
return whitespaceWithoutLineBreak.test(text.substring(lineStart, range.start)) || whitespaceWithoutLineBreak.test(text.substring(range.endExclusive, lineEnd));
|
|
12913
|
-
}
|
|
12914
12918
|
const linesDiffComputers = {
|
|
12915
12919
|
getLegacy: () => new LegacyLinesDiffComputer(),
|
|
12916
12920
|
getDefault: () => new DefaultLinesDiffComputer(),
|
|
@@ -601,6 +601,7 @@
|
|
|
601
601
|
let _locale = void 0;
|
|
602
602
|
let _language = LANGUAGE_DEFAULT;
|
|
603
603
|
let _platformLocale = LANGUAGE_DEFAULT;
|
|
604
|
+
let _regionalLocale = LANGUAGE_DEFAULT;
|
|
604
605
|
let _translationsConfigFile = void 0;
|
|
605
606
|
let _userAgent = void 0;
|
|
606
607
|
const $globalThis = globalThis;
|
|
@@ -627,6 +628,7 @@
|
|
|
627
628
|
const nlsConfig = JSON.parse(rawNlsConfig);
|
|
628
629
|
_locale = nlsConfig.userLocale;
|
|
629
630
|
_platformLocale = nlsConfig.osLocale;
|
|
631
|
+
_regionalLocale = nlsConfig.regionalLocale ?? nlsConfig.osLocale;
|
|
630
632
|
_language = nlsConfig.resolvedLanguage || LANGUAGE_DEFAULT;
|
|
631
633
|
_translationsConfigFile = nlsConfig.languagePack?.translationsConfigFile;
|
|
632
634
|
} catch (e) {
|
|
@@ -645,6 +647,7 @@
|
|
|
645
647
|
_language = getNLSLanguage() || LANGUAGE_DEFAULT;
|
|
646
648
|
_locale = navigator.language.toLowerCase();
|
|
647
649
|
_platformLocale = _locale;
|
|
650
|
+
_regionalLocale = _locale;
|
|
648
651
|
} else {
|
|
649
652
|
console.error("Unable to resolve platform.");
|
|
650
653
|
}
|
|
@@ -12165,14 +12168,17 @@
|
|
|
12165
12168
|
this.myersDiffingAlgorithm = new MyersDiffAlgorithm();
|
|
12166
12169
|
}
|
|
12167
12170
|
computeDiff(originalLines, modifiedLines, options) {
|
|
12171
|
+
return this._computeDiff(originalLines, modifiedLines, options);
|
|
12172
|
+
}
|
|
12173
|
+
_computeDiff(originalLines, modifiedLines, options, rawChanges) {
|
|
12168
12174
|
if (originalLines.length <= 1 && equals(originalLines, modifiedLines, (a, b) => a === b)) {
|
|
12169
12175
|
return new LinesDiff([], [], false);
|
|
12170
12176
|
}
|
|
12171
12177
|
if (originalLines.length === 1 && originalLines[0].length === 0 || modifiedLines.length === 1 && modifiedLines[0].length === 0) {
|
|
12178
|
+
const rangeMapping = new RangeMapping(new Range(1, 1, originalLines.length, originalLines[originalLines.length - 1].length + 1), new Range(1, 1, modifiedLines.length, modifiedLines[modifiedLines.length - 1].length + 1));
|
|
12179
|
+
rawChanges?.push(rangeMapping);
|
|
12172
12180
|
return new LinesDiff([
|
|
12173
|
-
new DetailedLineRangeMapping(new LineRange(1, originalLines.length + 1), new LineRange(1, modifiedLines.length + 1), [
|
|
12174
|
-
new RangeMapping(new Range(1, 1, originalLines.length, originalLines[originalLines.length - 1].length + 1), new Range(1, 1, modifiedLines.length, modifiedLines[modifiedLines.length - 1].length + 1))
|
|
12175
|
-
])
|
|
12181
|
+
new DetailedLineRangeMapping(new LineRange(1, originalLines.length + 1), new LineRange(1, modifiedLines.length + 1), [rangeMapping])
|
|
12176
12182
|
], [], false);
|
|
12177
12183
|
}
|
|
12178
12184
|
const timeout = options.maxComputationTimeMs === 0 ? InfiniteTimeout.instance : new DateTimeout(options.maxComputationTimeMs);
|
|
@@ -12209,7 +12215,7 @@
|
|
|
12209
12215
|
const seq1Offset = seq1LastStart + i;
|
|
12210
12216
|
const seq2Offset = seq2LastStart + i;
|
|
12211
12217
|
if (originalLines[seq1Offset] !== modifiedLines[seq2Offset]) {
|
|
12212
|
-
const characterDiffs = this.refineDiff(originalLines, modifiedLines, new SequenceDiff(new OffsetRange(seq1Offset, seq1Offset + 1), new OffsetRange(seq2Offset, seq2Offset + 1)), timeout, considerWhitespaceChanges, options);
|
|
12218
|
+
const characterDiffs = this.refineDiff(originalLines, modifiedLines, new SequenceDiff(new OffsetRange(seq1Offset, seq1Offset + 1), new OffsetRange(seq2Offset, seq2Offset + 1)), timeout, considerWhitespaceChanges, options, rawChanges);
|
|
12213
12219
|
for (const a of characterDiffs.mappings) {
|
|
12214
12220
|
alignments.push(a);
|
|
12215
12221
|
}
|
|
@@ -12227,7 +12233,7 @@
|
|
|
12227
12233
|
scanForWhitespaceChanges(equalLinesCount);
|
|
12228
12234
|
seq1LastStart = diff.seq1Range.endExclusive;
|
|
12229
12235
|
seq2LastStart = diff.seq2Range.endExclusive;
|
|
12230
|
-
const characterDiffs = this.refineDiff(originalLines, modifiedLines, diff, timeout, considerWhitespaceChanges, options);
|
|
12236
|
+
const characterDiffs = this.refineDiff(originalLines, modifiedLines, diff, timeout, considerWhitespaceChanges, options, rawChanges);
|
|
12231
12237
|
if (characterDiffs.hitTimeout) {
|
|
12232
12238
|
hitTimeout = true;
|
|
12233
12239
|
}
|
|
@@ -12290,12 +12296,21 @@
|
|
|
12290
12296
|
});
|
|
12291
12297
|
return movesWithDiffs;
|
|
12292
12298
|
}
|
|
12293
|
-
refineDiff(originalLines, modifiedLines, diff, timeout, considerWhitespaceChanges, options) {
|
|
12299
|
+
refineDiff(originalLines, modifiedLines, diff, timeout, considerWhitespaceChanges, options, rawChanges) {
|
|
12294
12300
|
const lineRangeMapping = toLineRangeMapping(diff);
|
|
12295
12301
|
const rangeMapping = lineRangeMapping.toRangeMapping2(originalLines, modifiedLines);
|
|
12296
12302
|
const slice1 = new LinesSliceCharSequence(originalLines, rangeMapping.originalRange, considerWhitespaceChanges);
|
|
12297
12303
|
const slice2 = new LinesSliceCharSequence(modifiedLines, rangeMapping.modifiedRange, considerWhitespaceChanges);
|
|
12298
|
-
const
|
|
12304
|
+
const useDynamicProgramming = slice1.length + slice2.length < 500;
|
|
12305
|
+
const diffResult = useDynamicProgramming ? this.dynamicProgrammingDiffing.compute(slice1, slice2, timeout) : this.myersDiffingAlgorithm.compute(slice1, slice2, timeout);
|
|
12306
|
+
let hitTimeout = diffResult.hitTimeout;
|
|
12307
|
+
if (rawChanges) {
|
|
12308
|
+
const rawResult = useDynamicProgramming && !hitTimeout ? this.myersDiffingAlgorithm.compute(slice1, slice2, timeout) : diffResult;
|
|
12309
|
+
hitTimeout ||= rawResult.hitTimeout;
|
|
12310
|
+
for (const change of rawResult.diffs) {
|
|
12311
|
+
rawChanges.push(new RangeMapping(slice1.translateRange(change.seq1Range), slice2.translateRange(change.seq2Range)));
|
|
12312
|
+
}
|
|
12313
|
+
}
|
|
12299
12314
|
let diffs = diffResult.diffs;
|
|
12300
12315
|
diffs = optimizeSequenceDiffs(slice1, slice2, diffs);
|
|
12301
12316
|
diffs = extendDiffsToEntireWordIfAppropriate(slice1, slice2, diffs, (seq, idx) => seq.findWordContaining(idx));
|
|
@@ -12307,7 +12322,7 @@
|
|
|
12307
12322
|
const result = diffs.map((d) => new RangeMapping(slice1.translateRange(d.seq1Range), slice2.translateRange(d.seq2Range)));
|
|
12308
12323
|
return {
|
|
12309
12324
|
mappings: result,
|
|
12310
|
-
hitTimeout
|
|
12325
|
+
hitTimeout
|
|
12311
12326
|
};
|
|
12312
12327
|
}
|
|
12313
12328
|
}
|
|
@@ -12874,8 +12889,7 @@
|
|
|
12874
12889
|
const originalText = new StringText(originalLines.join("\n"));
|
|
12875
12890
|
const modifiedText = new StringText(modifiedLines.join("\n"));
|
|
12876
12891
|
const result = this._computer.computeDiff(originalText.value, modifiedText.value, {
|
|
12877
|
-
|
|
12878
|
-
// TODO: forward `maxComputationTimeMs` after updating @vscode/diff. The wasm build of the pinned version panics when measuring time.
|
|
12892
|
+
maxComputationTimeMs: options.maxComputationTimeMs,
|
|
12879
12893
|
computeMoves: options.computeMoves,
|
|
12880
12894
|
extendToSubwords: options.extendToSubwords
|
|
12881
12895
|
});
|
|
@@ -12887,7 +12901,7 @@
|
|
|
12887
12901
|
const originalRange = new OffsetRange(r.range.start, r.range.endExclusive);
|
|
12888
12902
|
const modifiedRange = new OffsetRange(r.range.start + delta, r.range.start + delta + r.newText.length);
|
|
12889
12903
|
delta += r.newText.length - originalRange.length;
|
|
12890
|
-
if (options.ignoreTrimWhitespace &&
|
|
12904
|
+
if (options.ignoreTrimWhitespace && r.data.isTrimWhitespaceChange) {
|
|
12891
12905
|
continue;
|
|
12892
12906
|
}
|
|
12893
12907
|
rangeMappings.push(new RangeMapping(originalTransformer.getRange(originalRange), modifiedTransformer.getRange(modifiedRange)));
|
|
@@ -12908,16 +12922,6 @@
|
|
|
12908
12922
|
return new LinesDiff(changes, moves, result.hitTimeout);
|
|
12909
12923
|
}
|
|
12910
12924
|
}
|
|
12911
|
-
const whitespaceWithoutLineBreak = /^[^\S\n]*$/;
|
|
12912
|
-
function isInTrimWhitespace(text, range) {
|
|
12913
|
-
if (!whitespaceWithoutLineBreak.test(range.substring(text))) {
|
|
12914
|
-
return false;
|
|
12915
|
-
}
|
|
12916
|
-
const lineStart = range.start === 0 ? 0 : text.lastIndexOf("\n", range.start - 1) + 1;
|
|
12917
|
-
const nextLineBreak = text.indexOf("\n", range.endExclusive);
|
|
12918
|
-
const lineEnd = nextLineBreak === -1 ? text.length : nextLineBreak;
|
|
12919
|
-
return whitespaceWithoutLineBreak.test(text.substring(lineStart, range.start)) || whitespaceWithoutLineBreak.test(text.substring(range.endExclusive, lineEnd));
|
|
12920
|
-
}
|
|
12921
12925
|
const linesDiffComputers = {
|
|
12922
12926
|
getLegacy: () => new LegacyLinesDiffComputer(),
|
|
12923
12927
|
getDefault: () => new DefaultLinesDiffComputer(),
|
|
@@ -600,6 +600,7 @@
|
|
|
600
600
|
let _locale = void 0;
|
|
601
601
|
let _language = LANGUAGE_DEFAULT;
|
|
602
602
|
let _platformLocale = LANGUAGE_DEFAULT;
|
|
603
|
+
let _regionalLocale = LANGUAGE_DEFAULT;
|
|
603
604
|
let _translationsConfigFile = void 0;
|
|
604
605
|
let _userAgent = void 0;
|
|
605
606
|
const $globalThis = globalThis;
|
|
@@ -626,6 +627,7 @@
|
|
|
626
627
|
const nlsConfig = JSON.parse(rawNlsConfig);
|
|
627
628
|
_locale = nlsConfig.userLocale;
|
|
628
629
|
_platformLocale = nlsConfig.osLocale;
|
|
630
|
+
_regionalLocale = nlsConfig.regionalLocale ?? nlsConfig.osLocale;
|
|
629
631
|
_language = nlsConfig.resolvedLanguage || LANGUAGE_DEFAULT;
|
|
630
632
|
_translationsConfigFile = nlsConfig.languagePack?.translationsConfigFile;
|
|
631
633
|
} catch (e) {
|
|
@@ -644,6 +646,7 @@
|
|
|
644
646
|
_language = getNLSLanguage() || LANGUAGE_DEFAULT;
|
|
645
647
|
_locale = navigator.language.toLowerCase();
|
|
646
648
|
_platformLocale = _locale;
|
|
649
|
+
_regionalLocale = _locale;
|
|
647
650
|
} else {
|
|
648
651
|
console.error("Unable to resolve platform.");
|
|
649
652
|
}
|
|
@@ -12153,14 +12156,17 @@
|
|
|
12153
12156
|
this.myersDiffingAlgorithm = new MyersDiffAlgorithm();
|
|
12154
12157
|
}
|
|
12155
12158
|
computeDiff(originalLines, modifiedLines, options) {
|
|
12159
|
+
return this._computeDiff(originalLines, modifiedLines, options);
|
|
12160
|
+
}
|
|
12161
|
+
_computeDiff(originalLines, modifiedLines, options, rawChanges) {
|
|
12156
12162
|
if (originalLines.length <= 1 && equals(originalLines, modifiedLines, (a, b) => a === b)) {
|
|
12157
12163
|
return new LinesDiff([], [], false);
|
|
12158
12164
|
}
|
|
12159
12165
|
if (originalLines.length === 1 && originalLines[0].length === 0 || modifiedLines.length === 1 && modifiedLines[0].length === 0) {
|
|
12166
|
+
const rangeMapping = new RangeMapping(new Range$1(1, 1, originalLines.length, originalLines[originalLines.length - 1].length + 1), new Range$1(1, 1, modifiedLines.length, modifiedLines[modifiedLines.length - 1].length + 1));
|
|
12167
|
+
rawChanges?.push(rangeMapping);
|
|
12160
12168
|
return new LinesDiff([
|
|
12161
|
-
new DetailedLineRangeMapping(new LineRange(1, originalLines.length + 1), new LineRange(1, modifiedLines.length + 1), [
|
|
12162
|
-
new RangeMapping(new Range$1(1, 1, originalLines.length, originalLines[originalLines.length - 1].length + 1), new Range$1(1, 1, modifiedLines.length, modifiedLines[modifiedLines.length - 1].length + 1))
|
|
12163
|
-
])
|
|
12169
|
+
new DetailedLineRangeMapping(new LineRange(1, originalLines.length + 1), new LineRange(1, modifiedLines.length + 1), [rangeMapping])
|
|
12164
12170
|
], [], false);
|
|
12165
12171
|
}
|
|
12166
12172
|
const timeout = options.maxComputationTimeMs === 0 ? InfiniteTimeout.instance : new DateTimeout(options.maxComputationTimeMs);
|
|
@@ -12197,7 +12203,7 @@
|
|
|
12197
12203
|
const seq1Offset = seq1LastStart + i;
|
|
12198
12204
|
const seq2Offset = seq2LastStart + i;
|
|
12199
12205
|
if (originalLines[seq1Offset] !== modifiedLines[seq2Offset]) {
|
|
12200
|
-
const characterDiffs = this.refineDiff(originalLines, modifiedLines, new SequenceDiff(new OffsetRange(seq1Offset, seq1Offset + 1), new OffsetRange(seq2Offset, seq2Offset + 1)), timeout, considerWhitespaceChanges, options);
|
|
12206
|
+
const characterDiffs = this.refineDiff(originalLines, modifiedLines, new SequenceDiff(new OffsetRange(seq1Offset, seq1Offset + 1), new OffsetRange(seq2Offset, seq2Offset + 1)), timeout, considerWhitespaceChanges, options, rawChanges);
|
|
12201
12207
|
for (const a of characterDiffs.mappings) {
|
|
12202
12208
|
alignments.push(a);
|
|
12203
12209
|
}
|
|
@@ -12215,7 +12221,7 @@
|
|
|
12215
12221
|
scanForWhitespaceChanges(equalLinesCount);
|
|
12216
12222
|
seq1LastStart = diff.seq1Range.endExclusive;
|
|
12217
12223
|
seq2LastStart = diff.seq2Range.endExclusive;
|
|
12218
|
-
const characterDiffs = this.refineDiff(originalLines, modifiedLines, diff, timeout, considerWhitespaceChanges, options);
|
|
12224
|
+
const characterDiffs = this.refineDiff(originalLines, modifiedLines, diff, timeout, considerWhitespaceChanges, options, rawChanges);
|
|
12219
12225
|
if (characterDiffs.hitTimeout) {
|
|
12220
12226
|
hitTimeout = true;
|
|
12221
12227
|
}
|
|
@@ -12278,12 +12284,21 @@
|
|
|
12278
12284
|
});
|
|
12279
12285
|
return movesWithDiffs;
|
|
12280
12286
|
}
|
|
12281
|
-
refineDiff(originalLines, modifiedLines, diff, timeout, considerWhitespaceChanges, options) {
|
|
12287
|
+
refineDiff(originalLines, modifiedLines, diff, timeout, considerWhitespaceChanges, options, rawChanges) {
|
|
12282
12288
|
const lineRangeMapping = toLineRangeMapping(diff);
|
|
12283
12289
|
const rangeMapping = lineRangeMapping.toRangeMapping2(originalLines, modifiedLines);
|
|
12284
12290
|
const slice1 = new LinesSliceCharSequence(originalLines, rangeMapping.originalRange, considerWhitespaceChanges);
|
|
12285
12291
|
const slice2 = new LinesSliceCharSequence(modifiedLines, rangeMapping.modifiedRange, considerWhitespaceChanges);
|
|
12286
|
-
const
|
|
12292
|
+
const useDynamicProgramming = slice1.length + slice2.length < 500;
|
|
12293
|
+
const diffResult = useDynamicProgramming ? this.dynamicProgrammingDiffing.compute(slice1, slice2, timeout) : this.myersDiffingAlgorithm.compute(slice1, slice2, timeout);
|
|
12294
|
+
let hitTimeout = diffResult.hitTimeout;
|
|
12295
|
+
if (rawChanges) {
|
|
12296
|
+
const rawResult = useDynamicProgramming && !hitTimeout ? this.myersDiffingAlgorithm.compute(slice1, slice2, timeout) : diffResult;
|
|
12297
|
+
hitTimeout ||= rawResult.hitTimeout;
|
|
12298
|
+
for (const change of rawResult.diffs) {
|
|
12299
|
+
rawChanges.push(new RangeMapping(slice1.translateRange(change.seq1Range), slice2.translateRange(change.seq2Range)));
|
|
12300
|
+
}
|
|
12301
|
+
}
|
|
12287
12302
|
let diffs = diffResult.diffs;
|
|
12288
12303
|
diffs = optimizeSequenceDiffs(slice1, slice2, diffs);
|
|
12289
12304
|
diffs = extendDiffsToEntireWordIfAppropriate(slice1, slice2, diffs, (seq, idx) => seq.findWordContaining(idx));
|
|
@@ -12295,7 +12310,7 @@
|
|
|
12295
12310
|
const result = diffs.map((d) => new RangeMapping(slice1.translateRange(d.seq1Range), slice2.translateRange(d.seq2Range)));
|
|
12296
12311
|
return {
|
|
12297
12312
|
mappings: result,
|
|
12298
|
-
hitTimeout
|
|
12313
|
+
hitTimeout
|
|
12299
12314
|
};
|
|
12300
12315
|
}
|
|
12301
12316
|
}
|
|
@@ -12862,8 +12877,7 @@
|
|
|
12862
12877
|
const originalText = new StringText(originalLines.join("\n"));
|
|
12863
12878
|
const modifiedText = new StringText(modifiedLines.join("\n"));
|
|
12864
12879
|
const result = this._computer.computeDiff(originalText.value, modifiedText.value, {
|
|
12865
|
-
|
|
12866
|
-
// TODO: forward `maxComputationTimeMs` after updating @vscode/diff. The wasm build of the pinned version panics when measuring time.
|
|
12880
|
+
maxComputationTimeMs: options.maxComputationTimeMs,
|
|
12867
12881
|
computeMoves: options.computeMoves,
|
|
12868
12882
|
extendToSubwords: options.extendToSubwords
|
|
12869
12883
|
});
|
|
@@ -12875,7 +12889,7 @@
|
|
|
12875
12889
|
const originalRange = new OffsetRange(r.range.start, r.range.endExclusive);
|
|
12876
12890
|
const modifiedRange = new OffsetRange(r.range.start + delta, r.range.start + delta + r.newText.length);
|
|
12877
12891
|
delta += r.newText.length - originalRange.length;
|
|
12878
|
-
if (options.ignoreTrimWhitespace &&
|
|
12892
|
+
if (options.ignoreTrimWhitespace && r.data.isTrimWhitespaceChange) {
|
|
12879
12893
|
continue;
|
|
12880
12894
|
}
|
|
12881
12895
|
rangeMappings.push(new RangeMapping(originalTransformer.getRange(originalRange), modifiedTransformer.getRange(modifiedRange)));
|
|
@@ -12896,16 +12910,6 @@
|
|
|
12896
12910
|
return new LinesDiff(changes, moves, result.hitTimeout);
|
|
12897
12911
|
}
|
|
12898
12912
|
}
|
|
12899
|
-
const whitespaceWithoutLineBreak = /^[^\S\n]*$/;
|
|
12900
|
-
function isInTrimWhitespace(text, range) {
|
|
12901
|
-
if (!whitespaceWithoutLineBreak.test(range.substring(text))) {
|
|
12902
|
-
return false;
|
|
12903
|
-
}
|
|
12904
|
-
const lineStart = range.start === 0 ? 0 : text.lastIndexOf("\n", range.start - 1) + 1;
|
|
12905
|
-
const nextLineBreak = text.indexOf("\n", range.endExclusive);
|
|
12906
|
-
const lineEnd = nextLineBreak === -1 ? text.length : nextLineBreak;
|
|
12907
|
-
return whitespaceWithoutLineBreak.test(text.substring(lineStart, range.start)) || whitespaceWithoutLineBreak.test(text.substring(range.endExclusive, lineEnd));
|
|
12908
|
-
}
|
|
12909
12913
|
const linesDiffComputers = {
|
|
12910
12914
|
getLegacy: () => new LegacyLinesDiffComputer(),
|
|
12911
12915
|
getDefault: () => new DefaultLinesDiffComputer(),
|