@lvce-editor/editor-worker 19.78.1 → 19.78.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/api.d.ts +1 -0
- package/dist/diff-sdk.js +181 -171
- package/dist/editorWorkerMain.js +175 -165
- package/package.json +1 -1
package/dist/diff-sdk.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExtensionManagementWorker, SyntaxHighlightingWorker, RendererWorker,
|
|
1
|
+
import { ExtensionManagementWorker, CacheWorker, SyntaxHighlightingWorker, RendererWorker, TextMeasurementWorker, get as get$c, ErrorWorker, createLazyRpc, RpcId, OpenerWorker, DialogWorker, DragAndDropWorker, set as set$d, remove as remove$9 } from '@lvce-editor/rpc-registry';
|
|
2
2
|
|
|
3
3
|
const Text$1 = 12;
|
|
4
4
|
const Reference = 100;
|
|
@@ -417,6 +417,30 @@ const activateByEvent = async (event, assetDir, platform) => {
|
|
|
417
417
|
await ExtensionManagementWorker.invoke('Extensions.activateByEvent', event);
|
|
418
418
|
};
|
|
419
419
|
|
|
420
|
+
const cacheName$1 = 'lvce-editor-character-widths-v1';
|
|
421
|
+
const character = 'a';
|
|
422
|
+
const getKey$2 = (fontWeight, fontSize, fontFamily, letterSpacing) => {
|
|
423
|
+
return `https://cache.invalid/character-width/${encodeURIComponent(JSON.stringify([character, fontWeight, fontSize, fontFamily, letterSpacing]))}`;
|
|
424
|
+
};
|
|
425
|
+
const get$b = async (fontWeight, fontSize, fontFamily, letterSpacing) => {
|
|
426
|
+
const item = await CacheWorker.getCacheStorageJsonItem(getKey$2(fontWeight, fontSize, fontFamily, letterSpacing), cacheName$1);
|
|
427
|
+
const width = item?.value;
|
|
428
|
+
if (typeof width !== 'number' || !Number.isFinite(width) || width < 0) {
|
|
429
|
+
return undefined;
|
|
430
|
+
}
|
|
431
|
+
return width;
|
|
432
|
+
};
|
|
433
|
+
const set$c = async (fontWeight, fontSize, fontFamily, letterSpacing, width) => {
|
|
434
|
+
await CacheWorker.setCacheStorageJsonItem(getKey$2(fontWeight, fontSize, fontFamily, letterSpacing), width, cacheName$1);
|
|
435
|
+
};
|
|
436
|
+
const has$1 = async (fontWeight, fontSize, fontFamily, letterSpacing) => {
|
|
437
|
+
try {
|
|
438
|
+
return (await get$b(fontWeight, fontSize, fontFamily, letterSpacing)) !== undefined;
|
|
439
|
+
} catch {
|
|
440
|
+
return false;
|
|
441
|
+
}
|
|
442
|
+
};
|
|
443
|
+
|
|
420
444
|
const codeGeneratorAccept = state => {
|
|
421
445
|
// TODO close code generator widget
|
|
422
446
|
return state;
|
|
@@ -448,19 +472,19 @@ const {
|
|
|
448
472
|
wrapCommand: wrapCommand$2,
|
|
449
473
|
wrapGetter
|
|
450
474
|
} = editorStates;
|
|
451
|
-
const get$
|
|
475
|
+
const get$a = id => {
|
|
452
476
|
return editorStates.get(id);
|
|
453
477
|
};
|
|
454
478
|
const getKeys$2 = () => {
|
|
455
479
|
const keys = editorStates.getKeys();
|
|
456
480
|
return keys.map(String);
|
|
457
481
|
};
|
|
458
|
-
const set$
|
|
482
|
+
const set$b = (id, oldEditor, newEditor) => {
|
|
459
483
|
editorStates.set(id, oldEditor, newEditor);
|
|
460
484
|
};
|
|
461
485
|
|
|
462
486
|
const getEditor$1 = editorUid => {
|
|
463
|
-
const instance = get$
|
|
487
|
+
const instance = get$a(editorUid);
|
|
464
488
|
if (!instance) {
|
|
465
489
|
throw new Error(`editor ${editorUid} not found`);
|
|
466
490
|
}
|
|
@@ -506,15 +530,15 @@ const ToggleBlockComment$1 = 'toggleBlockComment';
|
|
|
506
530
|
const Unknown$2 = 'unknown';
|
|
507
531
|
|
|
508
532
|
const map$1 = Object.create(null);
|
|
509
|
-
const set$
|
|
533
|
+
const set$a = (id, widget) => {
|
|
510
534
|
map$1[id] = widget;
|
|
511
535
|
};
|
|
512
|
-
const get$
|
|
536
|
+
const get$9 = id => {
|
|
513
537
|
return map$1[id];
|
|
514
538
|
};
|
|
515
539
|
|
|
516
540
|
const getModule = id => {
|
|
517
|
-
return get$
|
|
541
|
+
return get$9(id);
|
|
518
542
|
};
|
|
519
543
|
|
|
520
544
|
const applyWidgetChange = async (editor, widget, changes) => {
|
|
@@ -2580,7 +2604,7 @@ const getEnabled$1 = () => {
|
|
|
2580
2604
|
};
|
|
2581
2605
|
|
|
2582
2606
|
const invoke$c = (...args) => SyntaxHighlightingWorker.invoke(...args);
|
|
2583
|
-
const set$
|
|
2607
|
+
const set$9 = (...args) => SyntaxHighlightingWorker.set(...args);
|
|
2584
2608
|
|
|
2585
2609
|
const state$d = {
|
|
2586
2610
|
pending: Object.create(null),
|
|
@@ -2590,10 +2614,10 @@ const state$d = {
|
|
|
2590
2614
|
const has = languageId => {
|
|
2591
2615
|
return Object.hasOwn(state$d.tokenizers, languageId);
|
|
2592
2616
|
};
|
|
2593
|
-
const set$
|
|
2617
|
+
const set$8 = (languageId, tokenizer) => {
|
|
2594
2618
|
state$d.tokenizers[languageId] = tokenizer;
|
|
2595
2619
|
};
|
|
2596
|
-
const get$
|
|
2620
|
+
const get$8 = languageId => {
|
|
2597
2621
|
return state$d.tokenizers[languageId];
|
|
2598
2622
|
};
|
|
2599
2623
|
const setTokenizePath = (languageId, tokenizePath) => {
|
|
@@ -2615,10 +2639,10 @@ const isPending = languageId => {
|
|
|
2615
2639
|
const getTokenizePaths = () => [...new Set(Object.values(state$d.tokenizePaths))].toSorted((a, b) => a.localeCompare(b));
|
|
2616
2640
|
|
|
2617
2641
|
const tokenMaps = Object.create(null);
|
|
2618
|
-
const set$
|
|
2642
|
+
const set$7 = (languageId, tokenMap) => {
|
|
2619
2643
|
tokenMaps[languageId] = tokenMap;
|
|
2620
2644
|
};
|
|
2621
|
-
const get$
|
|
2645
|
+
const get$7 = languageId => {
|
|
2622
2646
|
return tokenMaps[languageId] || {};
|
|
2623
2647
|
};
|
|
2624
2648
|
|
|
@@ -2631,7 +2655,7 @@ const loadTokenizer = async (languageId, tokenizePath) => {
|
|
|
2631
2655
|
if (getEnabled$1()) {
|
|
2632
2656
|
// @ts-ignore
|
|
2633
2657
|
const tokenMap = await invoke$c('Tokenizer.load', languageId, tokenizePath);
|
|
2634
|
-
set$
|
|
2658
|
+
set$7(languageId, tokenMap);
|
|
2635
2659
|
return;
|
|
2636
2660
|
}
|
|
2637
2661
|
try {
|
|
@@ -2647,8 +2671,8 @@ const loadTokenizer = async (languageId, tokenizePath) => {
|
|
|
2647
2671
|
console.warn(`tokenizer.TokenMap should be an object in "${tokenizePath}"`);
|
|
2648
2672
|
return;
|
|
2649
2673
|
}
|
|
2650
|
-
set$
|
|
2651
|
-
set$
|
|
2674
|
+
set$7(languageId, tokenizer.TokenMap);
|
|
2675
|
+
set$8(languageId, tokenizer);
|
|
2652
2676
|
} catch (error) {
|
|
2653
2677
|
// TODO better error handling
|
|
2654
2678
|
console.error(error);
|
|
@@ -2656,7 +2680,7 @@ const loadTokenizer = async (languageId, tokenizePath) => {
|
|
|
2656
2680
|
};
|
|
2657
2681
|
const getTokenizer = languageId => {
|
|
2658
2682
|
if (has(languageId)) {
|
|
2659
|
-
return get$
|
|
2683
|
+
return get$8(languageId);
|
|
2660
2684
|
}
|
|
2661
2685
|
if (isPending(languageId)) {
|
|
2662
2686
|
return TokenizePlainText;
|
|
@@ -2665,7 +2689,7 @@ const getTokenizer = languageId => {
|
|
|
2665
2689
|
};
|
|
2666
2690
|
|
|
2667
2691
|
const tokenizers = [TokenizePlainText];
|
|
2668
|
-
const get$
|
|
2692
|
+
const get$6 = id => {
|
|
2669
2693
|
return tokenizers[id] || TokenizePlainText;
|
|
2670
2694
|
};
|
|
2671
2695
|
const register$1 = tokenizer => {
|
|
@@ -2755,7 +2779,7 @@ const getTokensViewport = (editor, startLineIndex, endLineIndex) => {
|
|
|
2755
2779
|
lines,
|
|
2756
2780
|
tokenizerId
|
|
2757
2781
|
} = editor;
|
|
2758
|
-
const tokenizer = get$
|
|
2782
|
+
const tokenizer = get$6(tokenizerId);
|
|
2759
2783
|
const {
|
|
2760
2784
|
hasArrayReturn,
|
|
2761
2785
|
initialLineState,
|
|
@@ -3192,7 +3216,7 @@ const execute$1 = (command, ...args) => {
|
|
|
3192
3216
|
|
|
3193
3217
|
const Two$1 = '2.0';
|
|
3194
3218
|
const callbacks = Object.create(null);
|
|
3195
|
-
const get$
|
|
3219
|
+
const get$5 = id => {
|
|
3196
3220
|
return callbacks[id];
|
|
3197
3221
|
};
|
|
3198
3222
|
const remove$8 = id => {
|
|
@@ -3413,7 +3437,7 @@ const warn$1 = (...args) => {
|
|
|
3413
3437
|
console.warn(...args);
|
|
3414
3438
|
};
|
|
3415
3439
|
const resolve = (id, response) => {
|
|
3416
|
-
const fn = get$
|
|
3440
|
+
const fn = get$5(id);
|
|
3417
3441
|
if (!fn) {
|
|
3418
3442
|
console.log(response);
|
|
3419
3443
|
warn$1(`callback ${id} may already be disposed`);
|
|
@@ -3915,7 +3939,7 @@ const decode = (buffer, lineLengths, now) => {
|
|
|
3915
3939
|
if (total !== lineLengths[i]) {
|
|
3916
3940
|
return undefined;
|
|
3917
3941
|
}
|
|
3918
|
-
if (line.embeddedResultIndex !== undefined && (!embeddedResults[line.embeddedResultIndex] || line.embeddedLanguageStart === undefined || line.embeddedLanguageEnd === undefined || line.embeddedLanguageStart > line.embeddedLanguageEnd || line.embeddedLanguageEnd > lineLengths[i])) {
|
|
3942
|
+
if (line.embeddedResultIndex !== undefined && (!embeddedResults[line.embeddedResultIndex] || line.embeddedLanguageStart === undefined || line.embeddedLanguageEnd === undefined || line.embeddedLanguageStart > lineLengths[i] || line.embeddedLanguageStart > line.embeddedLanguageEnd && (embeddedResults[line.embeddedResultIndex].isFull || embeddedResults[line.embeddedResultIndex].result.tokens.length > 0) || line.embeddedLanguageEnd > lineLengths[i])) {
|
|
3919
3943
|
return undefined;
|
|
3920
3944
|
}
|
|
3921
3945
|
}
|
|
@@ -10701,7 +10725,7 @@ const getFingerprint = async (paths, readApplicationSource) => {
|
|
|
10701
10725
|
return Array.from(new Uint8Array(digest), value => value.toString(16).padStart(2, '0')).join('');
|
|
10702
10726
|
};
|
|
10703
10727
|
|
|
10704
|
-
const cacheName
|
|
10728
|
+
const cacheName = 'lvce-editor-syntax-highlighting-v1';
|
|
10705
10729
|
const lifetime = 90 * 24 * 60 * 60 * 1000;
|
|
10706
10730
|
const fingerprints = new Map();
|
|
10707
10731
|
// Editor line arrays are immutable snapshots; edits replace the array. Weak
|
|
@@ -10711,7 +10735,7 @@ const hash = async value => {
|
|
|
10711
10735
|
const digest = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(JSON.stringify(value)));
|
|
10712
10736
|
return Array.from(new Uint8Array(digest), value => value.toString(16).padStart(2, '0')).join('');
|
|
10713
10737
|
};
|
|
10714
|
-
const getKey$
|
|
10738
|
+
const getKey$1 = async (editor, start, end) => {
|
|
10715
10739
|
if (editor.syntaxHighlightingCacheEnabled !== true || editor.largeFile || !getTokenizePath$1(editor.languageId)) {
|
|
10716
10740
|
return '';
|
|
10717
10741
|
}
|
|
@@ -10748,26 +10772,26 @@ const getKey$2 = async (editor, start, end) => {
|
|
|
10748
10772
|
return '';
|
|
10749
10773
|
}
|
|
10750
10774
|
};
|
|
10751
|
-
const get$
|
|
10775
|
+
const get$4 = async (key, lineLengths) => {
|
|
10752
10776
|
try {
|
|
10753
|
-
const item = await CacheWorker.getCacheStorageItem(key, cacheName
|
|
10777
|
+
const item = await CacheWorker.getCacheStorageItem(key, cacheName);
|
|
10754
10778
|
if (!item) {
|
|
10755
10779
|
return undefined;
|
|
10756
10780
|
}
|
|
10757
10781
|
const result = decode(item.body, lineLengths, Date.now());
|
|
10758
10782
|
if (!result) {
|
|
10759
|
-
await CacheWorker.removeCacheStorageItem(key, cacheName
|
|
10783
|
+
await CacheWorker.removeCacheStorageItem(key, cacheName);
|
|
10760
10784
|
}
|
|
10761
10785
|
return result;
|
|
10762
10786
|
} catch {
|
|
10763
10787
|
return undefined;
|
|
10764
10788
|
}
|
|
10765
10789
|
};
|
|
10766
|
-
const set$
|
|
10790
|
+
const set$6 = async (key, result) => {
|
|
10767
10791
|
try {
|
|
10768
10792
|
const buffer = encode(result, Date.now() + lifetime);
|
|
10769
10793
|
if (buffer) {
|
|
10770
|
-
await CacheWorker.setCacheStorageItem(key, buffer, cacheName
|
|
10794
|
+
await CacheWorker.setCacheStorageItem(key, buffer, cacheName, {
|
|
10771
10795
|
'content-type': 'application/octet-stream'
|
|
10772
10796
|
});
|
|
10773
10797
|
}
|
|
@@ -10834,7 +10858,7 @@ const getTokensViewport2 = async (editor, start, end, syncIncremental) => {
|
|
|
10834
10858
|
if (editor.syntaxHighlightingCacheEnabled !== true) {
|
|
10835
10859
|
return getFreshTokensViewport(editor, start, end, syncIncremental);
|
|
10836
10860
|
}
|
|
10837
|
-
const key = await getKey$
|
|
10861
|
+
const key = await getKey$1(editor, start, end);
|
|
10838
10862
|
if (editor.lifecycle?.disposed) {
|
|
10839
10863
|
return {
|
|
10840
10864
|
embeddedResults: [],
|
|
@@ -10843,7 +10867,7 @@ const getTokensViewport2 = async (editor, start, end, syncIncremental) => {
|
|
|
10843
10867
|
};
|
|
10844
10868
|
}
|
|
10845
10869
|
if (key) {
|
|
10846
|
-
const cached = await get$
|
|
10870
|
+
const cached = await get$4(key, editor.lines.slice(start, end).map(line => line.length));
|
|
10847
10871
|
if (editor.lifecycle?.disposed) {
|
|
10848
10872
|
return {
|
|
10849
10873
|
embeddedResults: [],
|
|
@@ -10862,7 +10886,7 @@ const getTokensViewport2 = async (editor, start, end, syncIncremental) => {
|
|
|
10862
10886
|
}
|
|
10863
10887
|
const result = await getFreshTokensViewport(editor, start, end, syncIncremental);
|
|
10864
10888
|
if (key && !editor.lifecycle?.disposed) {
|
|
10865
|
-
await set$
|
|
10889
|
+
await set$6(key, result);
|
|
10866
10890
|
}
|
|
10867
10891
|
return result;
|
|
10868
10892
|
};
|
|
@@ -11456,7 +11480,7 @@ const getLineInfosViewport = async (editor, tokens, embeddedResults, minLineY, m
|
|
|
11456
11480
|
languageId,
|
|
11457
11481
|
lines
|
|
11458
11482
|
} = editor;
|
|
11459
|
-
const tokenMap = get$
|
|
11483
|
+
const tokenMap = get$7(languageId);
|
|
11460
11484
|
let offset = minLineOffset;
|
|
11461
11485
|
const tabSize = editor.tabSize ?? 2;
|
|
11462
11486
|
const visibleLines = lines.slice(minLineY, maxLineY);
|
|
@@ -12184,7 +12208,7 @@ const transformDiagnostics = (diagnostics, changes) => {
|
|
|
12184
12208
|
|
|
12185
12209
|
const queues$1 = {};
|
|
12186
12210
|
const enqueue = async (uid, callback) => {
|
|
12187
|
-
const instance = get$
|
|
12211
|
+
const instance = get$a(uid);
|
|
12188
12212
|
if (!instance) {
|
|
12189
12213
|
return undefined;
|
|
12190
12214
|
}
|
|
@@ -12278,7 +12302,7 @@ const isConnected = () => {
|
|
|
12278
12302
|
} = state$9;
|
|
12279
12303
|
return rpc !== undefined;
|
|
12280
12304
|
};
|
|
12281
|
-
const set$
|
|
12305
|
+
const set$5 = value => {
|
|
12282
12306
|
state$9.rpc = value;
|
|
12283
12307
|
};
|
|
12284
12308
|
const invoke$8 = (method, ...params) => {
|
|
@@ -12474,7 +12498,7 @@ const mergeDiagnostics = (editor, editorWithDiagnostics) => ({
|
|
|
12474
12498
|
});
|
|
12475
12499
|
const commitDiagnostics = async (editor, generation, diagnostics, onAccepted) => {
|
|
12476
12500
|
return (await enqueue(editor.id, async () => {
|
|
12477
|
-
let latest = get$
|
|
12501
|
+
let latest = get$a(editor.id);
|
|
12478
12502
|
if (!isApplicable(latest, editor, generation)) {
|
|
12479
12503
|
return editor;
|
|
12480
12504
|
}
|
|
@@ -12487,11 +12511,11 @@ const commitDiagnostics = async (editor, generation, diagnostics, onAccepted) =>
|
|
|
12487
12511
|
}
|
|
12488
12512
|
let calculationState = latest.newState;
|
|
12489
12513
|
let editorWithDiagnostics = await addDiagnostics(calculationState, diagnostics);
|
|
12490
|
-
latest = get$
|
|
12514
|
+
latest = get$a(editor.id);
|
|
12491
12515
|
while (isApplicable(latest, editor, generation) && !diagnosticLayoutEqual(calculationState, latest.newState)) {
|
|
12492
12516
|
calculationState = latest.newState;
|
|
12493
12517
|
editorWithDiagnostics = await addDiagnostics(calculationState, diagnostics);
|
|
12494
|
-
latest = get$
|
|
12518
|
+
latest = get$a(editor.id);
|
|
12495
12519
|
}
|
|
12496
12520
|
if (!isApplicable(latest, editor, generation)) {
|
|
12497
12521
|
return editor;
|
|
@@ -12500,7 +12524,7 @@ const commitDiagnostics = async (editor, generation, diagnostics, onAccepted) =>
|
|
|
12500
12524
|
return latest.newState;
|
|
12501
12525
|
}
|
|
12502
12526
|
const newEditor = mergeDiagnostics(latest.newState, editorWithDiagnostics);
|
|
12503
|
-
set$
|
|
12527
|
+
set$b(editor.id, latest.oldState, newEditor);
|
|
12504
12528
|
requestDiagnosticSnapshots.set(editor.id, diagnostics);
|
|
12505
12529
|
onAccepted?.();
|
|
12506
12530
|
await invoke$7('Editor.renderPending', newEditor.id);
|
|
@@ -12531,7 +12555,7 @@ const updateDiagnostics = async (editor, timeoutMs = 0) => {
|
|
|
12531
12555
|
}
|
|
12532
12556
|
const generation = (requestGenerations.get(editor.id) ?? 0) + 1;
|
|
12533
12557
|
requestGenerations.set(editor.id, generation);
|
|
12534
|
-
requestDiagnosticSnapshots.set(editor.id, get$
|
|
12558
|
+
requestDiagnosticSnapshots.set(editor.id, get$a(editor.id)?.newState.diagnostics ?? editor.diagnostics);
|
|
12535
12559
|
const providers = new Map();
|
|
12536
12560
|
const previous = previousProviderResults.get(editor.id);
|
|
12537
12561
|
if (previous && previous.languageId === editor.languageId && previous.uri === editor.uri) {
|
|
@@ -12645,7 +12669,7 @@ const updateDiagnostics = async (editor, timeoutMs = 0) => {
|
|
|
12645
12669
|
};
|
|
12646
12670
|
try {
|
|
12647
12671
|
await Promise.all([request(), completed.promise]);
|
|
12648
|
-
const latest = get$
|
|
12672
|
+
const latest = get$a(editor.id);
|
|
12649
12673
|
if (strict && !isApplicable(latest, editor, generation)) {
|
|
12650
12674
|
throw new Error('Editor changed or closed while waiting for diagnostics');
|
|
12651
12675
|
}
|
|
@@ -12698,7 +12722,7 @@ const transformCachedDiagnostics = (editorId, changes) => {
|
|
|
12698
12722
|
};
|
|
12699
12723
|
const updateDiagnosticsAll = async () => {
|
|
12700
12724
|
for (const key of getKeys$2()) {
|
|
12701
|
-
const editor = get$
|
|
12725
|
+
const editor = get$a(Number(key))?.newState;
|
|
12702
12726
|
if (editor) {
|
|
12703
12727
|
await updateDiagnostics(editor);
|
|
12704
12728
|
}
|
|
@@ -12710,7 +12734,7 @@ const waitForDiagnostics = async (editorId, timeoutMs = 30_000) => {
|
|
|
12710
12734
|
if (!Number.isFinite(timeoutMs) || timeoutMs <= 0 || timeoutMs > 300_000) {
|
|
12711
12735
|
throw new Error('Diagnostics timeout must be between 1 and 300000ms');
|
|
12712
12736
|
}
|
|
12713
|
-
const editor = get$
|
|
12737
|
+
const editor = get$a(editorId)?.newState;
|
|
12714
12738
|
if (!editor || editor.initial) {
|
|
12715
12739
|
throw new Error(`Editor is not ready: ${editorId}`);
|
|
12716
12740
|
}
|
|
@@ -13386,7 +13410,7 @@ const scheduleDocumentAndCursorsSelections = async (editor, changes, selectionCh
|
|
|
13386
13410
|
...newEditor,
|
|
13387
13411
|
decorations: linkDecorations
|
|
13388
13412
|
};
|
|
13389
|
-
set$
|
|
13413
|
+
set$b(editor.uid, editor, newEditorWithDecorations);
|
|
13390
13414
|
|
|
13391
13415
|
// Notify main-area-worker about modified status change
|
|
13392
13416
|
if (!editor.modified && options.notifyModifiedStatusChange !== false) {
|
|
@@ -13858,7 +13882,7 @@ const getMinimapLines = async (editor, syncIncremental) => {
|
|
|
13858
13882
|
await loadTokenizers(result.tokenizersToLoad);
|
|
13859
13883
|
result = await getTokensViewport2(editor, 0, lines.length, syncIncremental);
|
|
13860
13884
|
}
|
|
13861
|
-
const tokenMap = get$
|
|
13885
|
+
const tokenMap = get$7(languageId);
|
|
13862
13886
|
return result.tokens.map((lineState, index) => getLine(lineState, result.embeddedResults, tokenMap, lines[index].length));
|
|
13863
13887
|
};
|
|
13864
13888
|
|
|
@@ -14363,7 +14387,7 @@ const updateColorPickerValue = async (editorUid, value) => {
|
|
|
14363
14387
|
return;
|
|
14364
14388
|
}
|
|
14365
14389
|
const newEditorWithDerivedState = await updateDerivedState(editor, newEditor);
|
|
14366
|
-
set$
|
|
14390
|
+
set$b(editorUid, editor, newEditorWithDerivedState);
|
|
14367
14391
|
};
|
|
14368
14392
|
|
|
14369
14393
|
const getColorPickerWorkerCommandMap = () => ({
|
|
@@ -14576,7 +14600,7 @@ const createEditor2 = (id, uri, x, y, width, height, platform, assetDir, _langua
|
|
|
14576
14600
|
x,
|
|
14577
14601
|
y
|
|
14578
14602
|
};
|
|
14579
|
-
set$
|
|
14603
|
+
set$b(id, editor, editor);
|
|
14580
14604
|
};
|
|
14581
14605
|
|
|
14582
14606
|
const emptyEditor = {
|
|
@@ -14718,26 +14742,9 @@ const getLanguages = async (platform, assetDir, applicationId) => {
|
|
|
14718
14742
|
return invoke$9(applicationId, 'Extensions.getLanguages', platform, assetDir);
|
|
14719
14743
|
};
|
|
14720
14744
|
|
|
14721
|
-
const cacheName = 'lvce-editor-character-widths-v1';
|
|
14722
|
-
const character = 'a';
|
|
14723
|
-
const getKey$1 = (fontWeight, fontSize, fontFamily, letterSpacing) => {
|
|
14724
|
-
return `/character-width/${encodeURIComponent(JSON.stringify([character, fontWeight, fontSize, fontFamily, letterSpacing]))}`;
|
|
14725
|
-
};
|
|
14726
|
-
const get$4 = async (fontWeight, fontSize, fontFamily, letterSpacing) => {
|
|
14727
|
-
const item = await CacheWorker.getCacheStorageJsonItem(getKey$1(fontWeight, fontSize, fontFamily, letterSpacing), cacheName);
|
|
14728
|
-
const width = item?.value;
|
|
14729
|
-
if (typeof width !== 'number' || !Number.isFinite(width) || width < 0) {
|
|
14730
|
-
return undefined;
|
|
14731
|
-
}
|
|
14732
|
-
return width;
|
|
14733
|
-
};
|
|
14734
|
-
const set$5 = async (fontWeight, fontSize, fontFamily, letterSpacing, width) => {
|
|
14735
|
-
await CacheWorker.setCacheStorageJsonItem(getKey$1(fontWeight, fontSize, fontFamily, letterSpacing), width, cacheName);
|
|
14736
|
-
};
|
|
14737
|
-
|
|
14738
14745
|
const measureCharacterWidth = async (fontWeight, fontSize, fontFamily, letterSpacing) => {
|
|
14739
14746
|
try {
|
|
14740
|
-
const cachedWidth = await get$
|
|
14747
|
+
const cachedWidth = await get$b(fontWeight, fontSize, fontFamily, letterSpacing);
|
|
14741
14748
|
if (cachedWidth !== undefined) {
|
|
14742
14749
|
return cachedWidth;
|
|
14743
14750
|
}
|
|
@@ -14746,7 +14753,7 @@ const measureCharacterWidth = async (fontWeight, fontSize, fontFamily, letterSpa
|
|
|
14746
14753
|
}
|
|
14747
14754
|
const width = await measureTextWidth('a', fontWeight, fontSize, fontFamily, letterSpacing, false, 0);
|
|
14748
14755
|
try {
|
|
14749
|
-
await set$
|
|
14756
|
+
await set$c(fontWeight, fontSize, fontFamily, letterSpacing, width);
|
|
14750
14757
|
} catch {
|
|
14751
14758
|
// Cache failures must not prevent editor creation.
|
|
14752
14759
|
}
|
|
@@ -14950,10 +14957,10 @@ const createEditor = async ({
|
|
|
14950
14957
|
focused: true,
|
|
14951
14958
|
textInfos
|
|
14952
14959
|
};
|
|
14953
|
-
set$
|
|
14960
|
+
set$b(id, emptyEditor, newEditor4);
|
|
14954
14961
|
const completionsOnTypeRaw = await get$3('editor.completionsOnType');
|
|
14955
14962
|
const completionsOnType = Boolean(completionsOnTypeRaw);
|
|
14956
|
-
set$
|
|
14963
|
+
set$b(id, emptyEditor, {
|
|
14957
14964
|
...newEditor4,
|
|
14958
14965
|
completionsOnType
|
|
14959
14966
|
});
|
|
@@ -14982,7 +14989,7 @@ const createStandaloneEditor = async ({
|
|
|
14982
14989
|
y
|
|
14983
14990
|
}) => {
|
|
14984
14991
|
createEditor2(id, uri, x, y, width, height, platform, assetDir, undefined, undefined, undefined, applicationId);
|
|
14985
|
-
const createdEditor = get$
|
|
14992
|
+
const createdEditor = get$a(id).newState;
|
|
14986
14993
|
await loadTokenizer(languageId, tokenizePath);
|
|
14987
14994
|
const tokenizerId = register$1(getTokenizer(languageId));
|
|
14988
14995
|
const configuredEditor = {
|
|
@@ -15029,7 +15036,7 @@ const createStandaloneEditor = async ({
|
|
|
15029
15036
|
selectionInfos
|
|
15030
15037
|
};
|
|
15031
15038
|
if (!createdEditor.lifecycle?.disposed) {
|
|
15032
|
-
set$
|
|
15039
|
+
set$b(id, createdEditor, finalEditor);
|
|
15033
15040
|
}
|
|
15034
15041
|
};
|
|
15035
15042
|
|
|
@@ -15092,7 +15099,7 @@ const diff = (oldState, newState) => {
|
|
|
15092
15099
|
};
|
|
15093
15100
|
|
|
15094
15101
|
const diff2 = uid => {
|
|
15095
|
-
const editor = get$
|
|
15102
|
+
const editor = get$a(uid);
|
|
15096
15103
|
if (!editor) {
|
|
15097
15104
|
return [];
|
|
15098
15105
|
}
|
|
@@ -15248,7 +15255,7 @@ const initializeListener = async rpcId => {
|
|
|
15248
15255
|
if (!getListeners(EditorSelection$1).includes(rpcId)) {
|
|
15249
15256
|
return;
|
|
15250
15257
|
}
|
|
15251
|
-
const editor = getKeys$2().map(uid => get$
|
|
15258
|
+
const editor = getKeys$2().map(uid => get$a(Number(uid))?.newState).find(state => {
|
|
15252
15259
|
const {
|
|
15253
15260
|
focused,
|
|
15254
15261
|
initial
|
|
@@ -15284,7 +15291,7 @@ const invoke$5 = async (method, ...params) => {
|
|
|
15284
15291
|
return await worker.invoke(method, ...params);
|
|
15285
15292
|
};
|
|
15286
15293
|
const dispose$3 = async () => {
|
|
15287
|
-
if (getKeys$2().some(uid => get$
|
|
15294
|
+
if (getKeys$2().some(uid => get$a(Number(uid))?.newState.widgets?.some(widget => widget.id === Rename$1))) {
|
|
15288
15295
|
return;
|
|
15289
15296
|
}
|
|
15290
15297
|
const promise = workerPromise;
|
|
@@ -15321,14 +15328,14 @@ const dispose$2 = uid => {
|
|
|
15321
15328
|
};
|
|
15322
15329
|
|
|
15323
15330
|
const addWidget$1 = widget => {
|
|
15324
|
-
const module = get$
|
|
15331
|
+
const module = get$9(widget.id);
|
|
15325
15332
|
if (!module) {
|
|
15326
15333
|
throw new Error('unsupported widget');
|
|
15327
15334
|
}
|
|
15328
15335
|
return module.add(widget);
|
|
15329
15336
|
};
|
|
15330
15337
|
const renderWidget = widget => {
|
|
15331
|
-
const module = get$
|
|
15338
|
+
const module = get$9(widget.id);
|
|
15332
15339
|
if (!module) {
|
|
15333
15340
|
throw new Error('unsupported widget');
|
|
15334
15341
|
}
|
|
@@ -15397,7 +15404,7 @@ const renderWidgets$1 = (oldState, newState) => {
|
|
|
15397
15404
|
};
|
|
15398
15405
|
|
|
15399
15406
|
const disposeEditor = async editorUid => {
|
|
15400
|
-
const editor = get$
|
|
15407
|
+
const editor = get$a(editorUid)?.newState;
|
|
15401
15408
|
if (!editor) {
|
|
15402
15409
|
return [];
|
|
15403
15410
|
}
|
|
@@ -15500,7 +15507,7 @@ const hydrateWidget = (editor, widgetId, uid, newState) => {
|
|
|
15500
15507
|
};
|
|
15501
15508
|
};
|
|
15502
15509
|
const getLatestEditor = (uid, fallback) => {
|
|
15503
|
-
const instance = get$
|
|
15510
|
+
const instance = get$a(uid);
|
|
15504
15511
|
return instance?.newState || fallback;
|
|
15505
15512
|
};
|
|
15506
15513
|
const addWidgetToEditor = async (widgetId, focusKey, editor, factory, newStateGenerator, fullFocus) => {
|
|
@@ -15532,7 +15539,7 @@ const addWidgetToEditor = async (widgetId, focusKey, editor, factory, newStateGe
|
|
|
15532
15539
|
};
|
|
15533
15540
|
if (fullFocus) {
|
|
15534
15541
|
// Staging changes pending state; only rendering may advance the mounted baseline.
|
|
15535
|
-
set$
|
|
15542
|
+
set$b(editor.uid, get$a(editor.uid)?.oldState || editor, stagedEditor);
|
|
15536
15543
|
}
|
|
15537
15544
|
const newState = await newStateGenerator(initialState, editor.uid);
|
|
15538
15545
|
if (!newState) {
|
|
@@ -15542,7 +15549,7 @@ const addWidgetToEditor = async (widgetId, focusKey, editor, factory, newStateGe
|
|
|
15542
15549
|
if (fullFocus) {
|
|
15543
15550
|
const latestEditor = getLatestEditor(editor.uid, stagedEditor);
|
|
15544
15551
|
if (latestEditor === stagedEditor) {
|
|
15545
|
-
set$
|
|
15552
|
+
set$b(editor.uid, get$a(editor.uid)?.oldState || editor, editor);
|
|
15546
15553
|
}
|
|
15547
15554
|
return latestEditor === stagedEditor ? editor : latestEditor;
|
|
15548
15555
|
}
|
|
@@ -15563,7 +15570,7 @@ const addWidgetToEditor = async (widgetId, focusKey, editor, factory, newStateGe
|
|
|
15563
15570
|
} : currentEditor;
|
|
15564
15571
|
const hydratedEditor = hydrateWidget(latestEditor, widgetId, widgetUid, latestState);
|
|
15565
15572
|
if (hydratedEditor !== latestEditor) {
|
|
15566
|
-
set$
|
|
15573
|
+
set$b(editor.uid, get$a(editor.uid)?.oldState || editor, hydratedEditor);
|
|
15567
15574
|
}
|
|
15568
15575
|
return hydratedEditor;
|
|
15569
15576
|
}
|
|
@@ -15721,7 +15728,7 @@ const newStateGenerator$4 = async (state, parentUid, markCreated, automatic) =>
|
|
|
15721
15728
|
} = state;
|
|
15722
15729
|
const {
|
|
15723
15730
|
newState
|
|
15724
|
-
} = get$
|
|
15731
|
+
} = get$a(parentUid);
|
|
15725
15732
|
const {
|
|
15726
15733
|
applicationId,
|
|
15727
15734
|
languageId
|
|
@@ -15747,8 +15754,8 @@ const openCompletion = async (editor, automatic = false) => {
|
|
|
15747
15754
|
uid
|
|
15748
15755
|
} = widget.newState;
|
|
15749
15756
|
await invoke$4('Completions.loadContent', uid, automatic);
|
|
15750
|
-
if (!isCurrent$1(editor, get$
|
|
15751
|
-
return get$
|
|
15757
|
+
if (!isCurrent$1(editor, get$a(editor.uid)?.newState)) {
|
|
15758
|
+
return get$a(editor.uid)?.newState || editor;
|
|
15752
15759
|
}
|
|
15753
15760
|
if (automatic && !(await invoke$4('Completions.hasItems', uid))) {
|
|
15754
15761
|
return closeCompletion(editor);
|
|
@@ -15780,7 +15787,7 @@ const openCompletion = async (editor, automatic = false) => {
|
|
|
15780
15787
|
const fullFocus = false;
|
|
15781
15788
|
const result = await addWidgetToEditor(Completion, EditorCompletion, editor, create$7, generateState, fullFocus);
|
|
15782
15789
|
const wasAdded = (result?.widgets || []).some(widget => widget.id === Completion && widget.newState.uid === completionUid);
|
|
15783
|
-
const currentEditor = get$
|
|
15790
|
+
const currentEditor = get$a(editor.uid)?.newState;
|
|
15784
15791
|
if (created && (!wasAdded || !isCurrent$1(editor, currentEditor))) {
|
|
15785
15792
|
await disposeCompletion(completionUid);
|
|
15786
15793
|
}
|
|
@@ -16659,7 +16666,7 @@ const editorShowMessage = async (editor, rowIndex, columnIndex, message, _isErro
|
|
|
16659
16666
|
if (typeof editor.uid === 'number') {
|
|
16660
16667
|
const timeout = setTimeout(async () => {
|
|
16661
16668
|
clear$1(editor.uid);
|
|
16662
|
-
const latestInstance = get$
|
|
16669
|
+
const latestInstance = get$a(editor.uid);
|
|
16663
16670
|
if (!latestInstance) {
|
|
16664
16671
|
return;
|
|
16665
16672
|
}
|
|
@@ -16673,7 +16680,7 @@ const editorShowMessage = async (editor, rowIndex, columnIndex, message, _isErro
|
|
|
16673
16680
|
widgetRevision: next(editor.uid),
|
|
16674
16681
|
widgets: removeEditorWidget(latestEditor.widgets, Message)
|
|
16675
16682
|
};
|
|
16676
|
-
set$
|
|
16683
|
+
set$b(editor.uid, latestEditor, editorWithoutMessage);
|
|
16677
16684
|
await RendererWorker.invoke('Editor.renderPending', editor.uid);
|
|
16678
16685
|
}, editor.messageDelay ?? defaultMessageDelay);
|
|
16679
16686
|
set$2(editor.uid, {
|
|
@@ -16872,7 +16879,7 @@ const refresh = async request => {
|
|
|
16872
16879
|
}
|
|
16873
16880
|
const gutterDecorations = await getEditorGutterDecorations(snapshot);
|
|
16874
16881
|
const changed = await enqueue(snapshot.uid, async () => {
|
|
16875
|
-
const current = get$
|
|
16882
|
+
const current = get$a(snapshot.uid)?.newState;
|
|
16876
16883
|
if (!isCurrent(current, snapshot) || current.gutterDecorations.length === gutterDecorations.length && gutterDecorations.every((item, index) => item.rowIndex === current.gutterDecorations[index].rowIndex && item.type === current.gutterDecorations[index].type)) {
|
|
16877
16884
|
return false;
|
|
16878
16885
|
}
|
|
@@ -16881,11 +16888,11 @@ const refresh = async request => {
|
|
|
16881
16888
|
gutterDecorations
|
|
16882
16889
|
});
|
|
16883
16890
|
// Derived state may await layout RPCs while an asynchronous render consumes the baseline.
|
|
16884
|
-
const latest = get$
|
|
16891
|
+
const latest = get$a(snapshot.uid);
|
|
16885
16892
|
if (!isCurrent(latest?.newState, snapshot)) {
|
|
16886
16893
|
return false;
|
|
16887
16894
|
}
|
|
16888
|
-
set$
|
|
16895
|
+
set$b(snapshot.uid, latest.oldState, next);
|
|
16889
16896
|
return true;
|
|
16890
16897
|
});
|
|
16891
16898
|
if (changed) {
|
|
@@ -16970,7 +16977,7 @@ const selectionsEqual = (left, right) => {
|
|
|
16970
16977
|
return true;
|
|
16971
16978
|
};
|
|
16972
16979
|
const saveAfterDelay = async (uid, token) => {
|
|
16973
|
-
if (!get$
|
|
16980
|
+
if (!get$a(uid)) {
|
|
16974
16981
|
consume(uid, token);
|
|
16975
16982
|
return;
|
|
16976
16983
|
}
|
|
@@ -17000,7 +17007,7 @@ const saveAfterDelay = async (uid, token) => {
|
|
|
17000
17007
|
const wrapCommand$1 = (fn, preservesTypingCoalescing = false, returnState = true) => {
|
|
17001
17008
|
const command = async (uid, ...args) => {
|
|
17002
17009
|
return enqueue(uid, async () => {
|
|
17003
|
-
const oldInstance = get$
|
|
17010
|
+
const oldInstance = get$a(uid);
|
|
17004
17011
|
if (!oldInstance) {
|
|
17005
17012
|
return undefined;
|
|
17006
17013
|
}
|
|
@@ -17048,18 +17055,18 @@ const wrapCommand$1 = (fn, preservesTypingCoalescing = false, returnState = true
|
|
|
17048
17055
|
cursorUndoStack: [...previousCursorUndoStack.slice(1 - cursorUndoLimit), new Uint32Array(selections)]
|
|
17049
17056
|
};
|
|
17050
17057
|
}
|
|
17051
|
-
if (state === newEditor || !get$
|
|
17058
|
+
if (state === newEditor || !get$a(uid) || lifecycle?.disposed || get$a(uid).newState.lifecycle !== lifecycle) {
|
|
17052
17059
|
return returnState ? newEditor : undefined;
|
|
17053
17060
|
}
|
|
17054
17061
|
const deferGutterDecorations = !initial && uri === newEditor.uri && lines !== newEditor.lines && Boolean(newEditor.lifecycle);
|
|
17055
17062
|
const newEditorWithDerivedState = await updateDerivedState(state, newEditor, deferGutterDecorations);
|
|
17056
|
-
if (!get$
|
|
17063
|
+
if (!get$a(uid) || lifecycle?.disposed || get$a(uid).newState.lifecycle !== lifecycle) {
|
|
17057
17064
|
return returnState ? newEditorWithDerivedState : undefined;
|
|
17058
17065
|
}
|
|
17059
17066
|
// Another command can commit before the renderer consumes this edit.
|
|
17060
17067
|
// Keep its last rendered baseline, including renders completed while we awaited derived state.
|
|
17061
|
-
const renderedState = get$
|
|
17062
|
-
set$
|
|
17068
|
+
const renderedState = get$a(uid)?.oldState ?? oldInstance.oldState;
|
|
17069
|
+
set$b(uid, renderedState, newEditorWithDerivedState);
|
|
17063
17070
|
await dispose$3();
|
|
17064
17071
|
if (editorDiagnosticEffect.isActive(state, newEditorWithDerivedState)) {
|
|
17065
17072
|
void editorDiagnosticEffect.apply(newEditorWithDerivedState);
|
|
@@ -17072,7 +17079,7 @@ const wrapCommand$1 = (fn, preservesTypingCoalescing = false, returnState = true
|
|
|
17072
17079
|
if (!initial && uri === finalEditor.uri && (endOfLine !== finalEditor.endOfLine || insertSpaces !== finalEditor.insertSpaces || lines !== finalEditor.lines || modified !== finalEditor.modified || redoStack !== finalEditor.redoStack || undoStack !== finalEditor.undoStack)) {
|
|
17073
17080
|
for (const key of getKeys$2()) {
|
|
17074
17081
|
const otherUid = Number(key);
|
|
17075
|
-
const instance = get$
|
|
17082
|
+
const instance = get$a(otherUid);
|
|
17076
17083
|
const editor = instance?.newState;
|
|
17077
17084
|
if (otherUid === uid || !instance || !editor || editor.initial || editor.uri !== finalEditor.uri || editor.applicationId !== finalEditor.applicationId) {
|
|
17078
17085
|
continue;
|
|
@@ -17091,11 +17098,11 @@ const wrapCommand$1 = (fn, preservesTypingCoalescing = false, returnState = true
|
|
|
17091
17098
|
undoStack: finalEditor.undoStack,
|
|
17092
17099
|
visualDecorations: finalEditor.visualDecorations
|
|
17093
17100
|
}, deferGutterDecorations);
|
|
17094
|
-
const latest = get$
|
|
17101
|
+
const latest = get$a(otherUid);
|
|
17095
17102
|
if (!latest || editor.lifecycle?.disposed || latest.newState.lifecycle !== editor.lifecycle) {
|
|
17096
17103
|
continue;
|
|
17097
17104
|
}
|
|
17098
|
-
set$
|
|
17105
|
+
set$b(otherUid, latest.oldState, synchronizedEditor);
|
|
17099
17106
|
if (deferGutterDecorations) {
|
|
17100
17107
|
schedule(synchronizedEditor);
|
|
17101
17108
|
}
|
|
@@ -17127,7 +17134,7 @@ const wrapFocusCommand$1 = (fn, returnState = true) => {
|
|
|
17127
17134
|
}, false, returnState);
|
|
17128
17135
|
const focusCommand = uid => {
|
|
17129
17136
|
// DOM focus events can arrive while a queued command is still opening a widget.
|
|
17130
|
-
const widgetRevision = get$
|
|
17137
|
+
const widgetRevision = get$a(uid)?.newState.widgetRevision;
|
|
17131
17138
|
return command(uid, widgetRevision);
|
|
17132
17139
|
};
|
|
17133
17140
|
stateCommands?.add(focusCommand);
|
|
@@ -17160,7 +17167,7 @@ const wrapLatestCommand$1 = (fn, returnState = true) => {
|
|
|
17160
17167
|
const wrapDeferredCommand$1 = (fn, returnState = true) => {
|
|
17161
17168
|
const apply = wrapCommand$1((editor, snapshot, result) => merge(editor, snapshot, result), false, returnState);
|
|
17162
17169
|
const deferredCommand = async (uid, ...args) => {
|
|
17163
|
-
const snapshot = await enqueue(uid, async () => get$
|
|
17170
|
+
const snapshot = await enqueue(uid, async () => get$a(uid)?.newState);
|
|
17164
17171
|
if (!snapshot) {
|
|
17165
17172
|
return undefined;
|
|
17166
17173
|
}
|
|
@@ -17220,7 +17227,7 @@ const getOpenEditor = (currentEditor, uri) => {
|
|
|
17220
17227
|
return currentEditor;
|
|
17221
17228
|
}
|
|
17222
17229
|
for (const key of getKeys$2()) {
|
|
17223
|
-
const editor = get$
|
|
17230
|
+
const editor = get$a(Number(key))?.newState;
|
|
17224
17231
|
if (editor && !editor.initial && editor.uri === uri && editor.applicationId === currentEditor.applicationId) {
|
|
17225
17232
|
return editor;
|
|
17226
17233
|
}
|
|
@@ -17725,7 +17732,7 @@ const closeRename = async editor => {
|
|
|
17725
17732
|
}
|
|
17726
17733
|
const renameWidget = widgets[renameWidgetIndex];
|
|
17727
17734
|
await invoke$5('Rename.close', renameWidget.newState.uid);
|
|
17728
|
-
const latest = get$
|
|
17735
|
+
const latest = get$a(uid);
|
|
17729
17736
|
const {
|
|
17730
17737
|
newState
|
|
17731
17738
|
} = latest;
|
|
@@ -19813,7 +19820,7 @@ const editorHoverDismissDelay = 500;
|
|
|
19813
19820
|
const handleMouseLeave = (viewletUid, editorUidValue) => {
|
|
19814
19821
|
const targetEditorUid = editorUidValue ?? viewletUid;
|
|
19815
19822
|
const editorUid = Number(targetEditorUid);
|
|
19816
|
-
const instance = get$
|
|
19823
|
+
const instance = get$a(editorUid);
|
|
19817
19824
|
if (!instance) {
|
|
19818
19825
|
return;
|
|
19819
19826
|
}
|
|
@@ -19828,7 +19835,7 @@ const handleMouseLeave = (viewletUid, editorUidValue) => {
|
|
|
19828
19835
|
}
|
|
19829
19836
|
const timeout = setTimeout(async () => {
|
|
19830
19837
|
clear$3(editorUid);
|
|
19831
|
-
const latestInstance = get$
|
|
19838
|
+
const latestInstance = get$a(editorUid);
|
|
19832
19839
|
if (!latestInstance) {
|
|
19833
19840
|
return;
|
|
19834
19841
|
}
|
|
@@ -19845,7 +19852,7 @@ const handleMouseLeave = (viewletUid, editorUidValue) => {
|
|
|
19845
19852
|
widgetRevision: next(editorUid),
|
|
19846
19853
|
widgets: removeEditorWidget(latestEditor.widgets, Hover)
|
|
19847
19854
|
};
|
|
19848
|
-
set$
|
|
19855
|
+
set$b(editorUid, latestEditor, newEditor);
|
|
19849
19856
|
await RendererWorker.invoke('Editor.renderPending', editorUid);
|
|
19850
19857
|
}, editorHoverDismissDelay);
|
|
19851
19858
|
set$4(editorUid, {
|
|
@@ -19946,6 +19953,7 @@ const measureTextBlockHeight = async (text, fontFamily, fontSize, lineHeight, wi
|
|
|
19946
19953
|
};
|
|
19947
19954
|
|
|
19948
19955
|
const maximumWidth = 600;
|
|
19956
|
+
const maximumHeight$1 = 300;
|
|
19949
19957
|
const horizontalPadding = 18;
|
|
19950
19958
|
const getDiagnosticHoverInfo = async (editor, diagnostic) => {
|
|
19951
19959
|
const {
|
|
@@ -19957,7 +19965,7 @@ const getDiagnosticHoverInfo = async (editor, diagnostic) => {
|
|
|
19957
19965
|
const detail = getDiagnosticHoverDetail(diagnostic);
|
|
19958
19966
|
const diagnosticText = detail ? `${message} ${detail}` : message;
|
|
19959
19967
|
const measuredHeight = await measureTextBlockHeight(diagnosticText, editor.fontFamily, editor.fontSize, `${editor.rowHeight}px`, width - horizontalPadding);
|
|
19960
|
-
const height = Math.min(measuredHeight + 10, editor.height);
|
|
19968
|
+
const height = Math.min(measuredHeight + 10, maximumHeight$1, editor.height);
|
|
19961
19969
|
const positionX = editor.x + columnIndex * editor.columnWidth - (editor.deltaX || 0);
|
|
19962
19970
|
const x = Math.max(editor.x, Math.min(positionX, editor.x + editor.width - width));
|
|
19963
19971
|
const rowBottom = editor.y + (rowIndex + 1) * editor.rowHeight - (editor.deltaY || 0);
|
|
@@ -20105,10 +20113,11 @@ const hoverDocumentationFontSize = 15;
|
|
|
20105
20113
|
const hoverDocumentationFontFamily = 'Fira Code';
|
|
20106
20114
|
const hoverDocumentationLineHeight = '1.33333';
|
|
20107
20115
|
const hoverWidth = 600;
|
|
20116
|
+
const maximumHeight = 300;
|
|
20108
20117
|
const hoverDocumentationWidth = hoverWidth - 18;
|
|
20109
20118
|
const getEditorHoverInfo = async (editorUid, position) => {
|
|
20110
20119
|
number(editorUid);
|
|
20111
|
-
const instance = get$
|
|
20120
|
+
const instance = get$a(editorUid);
|
|
20112
20121
|
const editor = instance.newState;
|
|
20113
20122
|
const {
|
|
20114
20123
|
selections
|
|
@@ -20151,7 +20160,7 @@ const getEditorHoverInfo = async (editorUid, position) => {
|
|
|
20151
20160
|
diagnosticText += `${diagnosticText ? '\n' : ''}${diagnostic.message} ${diagnostic.source} (${diagnostic.code})`;
|
|
20152
20161
|
}
|
|
20153
20162
|
const diagnosticsHeight = diagnosticText ? (await measureTextBlockHeight(diagnosticText, editor.fontFamily, editor.fontSize, `${editor.rowHeight}px`, hoverDocumentationWidth)) + 10 : 0;
|
|
20154
|
-
const height = Math.min(diagnosticsHeight + displayStringHeight + (documentation ? documentationHeight + 11 : 0) || 20, editor.height);
|
|
20163
|
+
const height = Math.min(diagnosticsHeight + displayStringHeight + (documentation ? documentationHeight + 11 : 0) || 20, maximumHeight, editor.height);
|
|
20155
20164
|
const x$1 = Math.max(editor.x, Math.min(x(editor, rowIndex, wordStart), editor.x + editor.width - hoverWidth));
|
|
20156
20165
|
const rowBottom = y(editor, rowIndex);
|
|
20157
20166
|
const y$1 = rowBottom + height <= editor.y + editor.height ? rowBottom : Math.max(editor.y, rowBottom - editor.rowHeight - height);
|
|
@@ -20242,7 +20251,7 @@ const showDiagnostic = async (editor, diagnostic) => {
|
|
|
20242
20251
|
};
|
|
20243
20252
|
|
|
20244
20253
|
const showHover = async (editor, position, token) => {
|
|
20245
|
-
const instance = get$
|
|
20254
|
+
const instance = get$a(editor.uid);
|
|
20246
20255
|
if (!instance) {
|
|
20247
20256
|
return;
|
|
20248
20257
|
}
|
|
@@ -20251,11 +20260,11 @@ const showHover = async (editor, position, token) => {
|
|
|
20251
20260
|
return;
|
|
20252
20261
|
}
|
|
20253
20262
|
const newEditor = await showHover$1(latestEditor, position);
|
|
20254
|
-
const latestInstance = get$
|
|
20263
|
+
const latestInstance = get$a(editor.uid);
|
|
20255
20264
|
if (latestEditor === newEditor || !latestInstance || latestInstance.newState !== latestEditor || get$2().token !== token) {
|
|
20256
20265
|
return;
|
|
20257
20266
|
}
|
|
20258
|
-
set$
|
|
20267
|
+
set$b(editor.uid, latestInstance.oldState, newEditor);
|
|
20259
20268
|
await RendererWorker.invoke('Editor.renderPending', editor.uid);
|
|
20260
20269
|
};
|
|
20261
20270
|
|
|
@@ -20278,7 +20287,7 @@ const onHoverIdle = async token => {
|
|
|
20278
20287
|
if (latestToken !== token || !editor) {
|
|
20279
20288
|
return;
|
|
20280
20289
|
}
|
|
20281
|
-
const instance = get$
|
|
20290
|
+
const instance = get$a(editor.uid);
|
|
20282
20291
|
if (!instance || !instance.newState.hoverEnabled) {
|
|
20283
20292
|
return;
|
|
20284
20293
|
}
|
|
@@ -20506,20 +20515,20 @@ const advanceSelectionAutoScroll = async editor => {
|
|
|
20506
20515
|
return editorMoveSelection(scrolledEditor, position, false);
|
|
20507
20516
|
};
|
|
20508
20517
|
const continueScrollingAndMovingSelection = async editorUid => {
|
|
20509
|
-
const editor = get$
|
|
20518
|
+
const editor = get$a(editorUid)?.newState;
|
|
20510
20519
|
if (!editor?.isSelecting || !editor.hasListener) {
|
|
20511
20520
|
return;
|
|
20512
20521
|
}
|
|
20513
20522
|
const nextEditor = await advanceSelectionAutoScroll(editor);
|
|
20514
20523
|
const derivedEditor = await updateDerivedState(editor, nextEditor);
|
|
20515
|
-
const currentEditor = get$
|
|
20524
|
+
const currentEditor = get$a(editorUid)?.newState;
|
|
20516
20525
|
if (currentEditor !== editor) {
|
|
20517
20526
|
if (currentEditor?.isSelecting && currentEditor.hasListener) {
|
|
20518
20527
|
requestAnimationFrame(() => continueScrollingAndMovingSelection(editorUid));
|
|
20519
20528
|
}
|
|
20520
20529
|
return;
|
|
20521
20530
|
}
|
|
20522
|
-
set$
|
|
20531
|
+
set$b(editor.uid, editor, derivedEditor);
|
|
20523
20532
|
await RendererWorker.invoke('Editor.renderPending', editor.uid);
|
|
20524
20533
|
if (derivedEditor.hasListener) {
|
|
20525
20534
|
requestAnimationFrame(() => continueScrollingAndMovingSelection(editorUid));
|
|
@@ -21232,7 +21241,7 @@ const updateEditor = async (editorUid, editor, newEditor) => {
|
|
|
21232
21241
|
return;
|
|
21233
21242
|
}
|
|
21234
21243
|
const newEditorWithDerivedState = await updateDerivedState(editor, newEditor);
|
|
21235
|
-
set$
|
|
21244
|
+
set$b(editorUid, editor, newEditorWithDerivedState);
|
|
21236
21245
|
};
|
|
21237
21246
|
const applyDocumentEdits = async (editorUid, edits) => {
|
|
21238
21247
|
const editor = getEditor$1(editorUid);
|
|
@@ -21364,7 +21373,7 @@ const Close = 'Close';
|
|
|
21364
21373
|
|
|
21365
21374
|
const getEditorByWidgetUid = (widgetUid, widgetId) => {
|
|
21366
21375
|
for (const key of getKeys$2()) {
|
|
21367
|
-
const editor = get$
|
|
21376
|
+
const editor = get$a(Number(key)).newState;
|
|
21368
21377
|
const widgets = editor.widgets || [];
|
|
21369
21378
|
for (const widget of widgets) {
|
|
21370
21379
|
if (widget.id === widgetId && widget.newState.uid === widgetUid) {
|
|
@@ -21378,7 +21387,7 @@ const getEditor = (editorOrUid, widgetId) => {
|
|
|
21378
21387
|
if (editorOrUid && editorOrUid.widgets) {
|
|
21379
21388
|
return editorOrUid;
|
|
21380
21389
|
}
|
|
21381
|
-
const instance = get$
|
|
21390
|
+
const instance = get$a(editorOrUid);
|
|
21382
21391
|
if (instance && instance.newState && instance.newState.widgets) {
|
|
21383
21392
|
return instance.newState;
|
|
21384
21393
|
}
|
|
@@ -21410,16 +21419,16 @@ const createFn = (key, name, widgetId) => {
|
|
|
21410
21419
|
} = state;
|
|
21411
21420
|
const invoke = getWidgetInvoke(widgetId);
|
|
21412
21421
|
await invoke(`${name}.${key}`, uid, ...args);
|
|
21413
|
-
const latestAfterInvoke = get$
|
|
21422
|
+
const latestAfterInvoke = get$a(editor.uid).newState;
|
|
21414
21423
|
const latestChildIndex = latestAfterInvoke.widgets.findIndex(isWidget);
|
|
21415
21424
|
if (latestChildIndex === -1) {
|
|
21416
|
-
set$
|
|
21425
|
+
set$b(editor.uid, editor, latestAfterInvoke);
|
|
21417
21426
|
await dispose$3();
|
|
21418
21427
|
return latestAfterInvoke;
|
|
21419
21428
|
}
|
|
21420
21429
|
const diff = await invoke(`${name}.diff2`, uid);
|
|
21421
21430
|
const commands = await invoke(`${name}.render2`, uid, diff);
|
|
21422
|
-
const latest = get$
|
|
21431
|
+
const latest = get$a(editor.uid).newState;
|
|
21423
21432
|
if (shouldClose) {
|
|
21424
21433
|
const newEditor = {
|
|
21425
21434
|
...latest,
|
|
@@ -21427,7 +21436,7 @@ const createFn = (key, name, widgetId) => {
|
|
|
21427
21436
|
widgetRevision,
|
|
21428
21437
|
widgets: removeEditorWidget(latest.widgets, widgetId)
|
|
21429
21438
|
};
|
|
21430
|
-
set$
|
|
21439
|
+
set$b(editor.uid, latest, newEditor);
|
|
21431
21440
|
return newEditor;
|
|
21432
21441
|
}
|
|
21433
21442
|
const newState = {
|
|
@@ -21435,7 +21444,7 @@ const createFn = (key, name, widgetId) => {
|
|
|
21435
21444
|
commands
|
|
21436
21445
|
};
|
|
21437
21446
|
const newEditor = updateWidget(latest, widgetId, newState);
|
|
21438
|
-
set$
|
|
21447
|
+
set$b(editor.uid, editor, newEditor);
|
|
21439
21448
|
return newEditor;
|
|
21440
21449
|
};
|
|
21441
21450
|
return fn;
|
|
@@ -21696,7 +21705,7 @@ const newStateGenerator$1 = async (state, parentUid) => {
|
|
|
21696
21705
|
} = state;
|
|
21697
21706
|
const {
|
|
21698
21707
|
newState
|
|
21699
|
-
} = get$
|
|
21708
|
+
} = get$a(parentUid);
|
|
21700
21709
|
const {
|
|
21701
21710
|
applicationId,
|
|
21702
21711
|
languageId
|
|
@@ -21721,7 +21730,7 @@ const openRename = async editor => {
|
|
|
21721
21730
|
if (!word) {
|
|
21722
21731
|
return editor;
|
|
21723
21732
|
}
|
|
21724
|
-
const editorState = get$
|
|
21733
|
+
const editorState = get$a(editor.uid);
|
|
21725
21734
|
if (!editorState) {
|
|
21726
21735
|
return editor;
|
|
21727
21736
|
}
|
|
@@ -21735,7 +21744,7 @@ const openRename = async editor => {
|
|
|
21735
21744
|
if (!prepareRenameResult || typeof prepareRenameResult !== 'object') {
|
|
21736
21745
|
return editor;
|
|
21737
21746
|
}
|
|
21738
|
-
const latestEditor = get$
|
|
21747
|
+
const latestEditor = get$a(editor.uid)?.newState;
|
|
21739
21748
|
if (latestEditor !== editor) {
|
|
21740
21749
|
return latestEditor || editor;
|
|
21741
21750
|
}
|
|
@@ -21872,7 +21881,7 @@ const paste = async (editor, pastedText) => {
|
|
|
21872
21881
|
cause: error
|
|
21873
21882
|
});
|
|
21874
21883
|
}
|
|
21875
|
-
const currentEditor = get$
|
|
21884
|
+
const currentEditor = get$a(editor.uid)?.newState;
|
|
21876
21885
|
if (!currentEditor || currentEditor.uri !== editor.uri || currentEditor.languageId !== 'markdown') {
|
|
21877
21886
|
try {
|
|
21878
21887
|
await invoke$a(editor.applicationId, 'FileSystem.remove', savedImage.uri);
|
|
@@ -22636,7 +22645,7 @@ const paddingLeft = 8;
|
|
|
22636
22645
|
const paddingRight = 8;
|
|
22637
22646
|
const getSignatureHelpInfo = async editorUid => {
|
|
22638
22647
|
number(editorUid);
|
|
22639
|
-
const instance = get$
|
|
22648
|
+
const instance = get$a(editorUid);
|
|
22640
22649
|
const editor = instance.newState;
|
|
22641
22650
|
const {
|
|
22642
22651
|
selections
|
|
@@ -22754,7 +22763,7 @@ const newStateGenerator = async (state, parentUid) => {
|
|
|
22754
22763
|
} = state;
|
|
22755
22764
|
const {
|
|
22756
22765
|
newState
|
|
22757
|
-
} = get$
|
|
22766
|
+
} = get$a(parentUid);
|
|
22758
22767
|
const {
|
|
22759
22768
|
languageId
|
|
22760
22769
|
} = newState;
|
|
@@ -24495,7 +24504,7 @@ const getEditorSourceActions = async editorId => {
|
|
|
24495
24504
|
}
|
|
24496
24505
|
const {
|
|
24497
24506
|
newState
|
|
24498
|
-
} = get$
|
|
24507
|
+
} = get$a(editorId);
|
|
24499
24508
|
const extensions = await invoke$9(newState.applicationId, 'Extensions.getAllExtensions', newState.assetDir, newState.platform);
|
|
24500
24509
|
return extensions.filter(extension => !extension.disabled).flatMap(extension => extension.codeActions || []).filter(action => action.languageId === newState.languageId);
|
|
24501
24510
|
};
|
|
@@ -24589,13 +24598,13 @@ const getSelections2 = editorUid => {
|
|
|
24589
24598
|
return selections;
|
|
24590
24599
|
};
|
|
24591
24600
|
const setSelections2 = async (editorUid, selections, reveal = true) => {
|
|
24592
|
-
const requested = get$
|
|
24601
|
+
const requested = get$a(editorUid);
|
|
24593
24602
|
if (!requested || requested.newState.lifecycle?.disposed) {
|
|
24594
24603
|
return;
|
|
24595
24604
|
}
|
|
24596
24605
|
const requestedLifecycle = requested.newState.lifecycle;
|
|
24597
24606
|
await enqueue(editorUid, async () => {
|
|
24598
|
-
const instance = get$
|
|
24607
|
+
const instance = get$a(editorUid);
|
|
24599
24608
|
if (!instance || instance.newState.lifecycle?.disposed || instance.newState.lifecycle !== requestedLifecycle) {
|
|
24600
24609
|
return;
|
|
24601
24610
|
}
|
|
@@ -24608,11 +24617,11 @@ const setSelections2 = async (editorUid, selections, reveal = true) => {
|
|
|
24608
24617
|
selections
|
|
24609
24618
|
};
|
|
24610
24619
|
const newEditorWithDerivedState = await updateDerivedState(editor, newEditor);
|
|
24611
|
-
const current = get$
|
|
24620
|
+
const current = get$a(editorUid);
|
|
24612
24621
|
if (!current || lifecycle?.disposed || current.newState.lifecycle !== lifecycle) {
|
|
24613
24622
|
return;
|
|
24614
24623
|
}
|
|
24615
|
-
set$
|
|
24624
|
+
set$b(editorUid, current.oldState, newEditorWithDerivedState);
|
|
24616
24625
|
});
|
|
24617
24626
|
};
|
|
24618
24627
|
const closeWidget2 = async (editorUid, widgetId, widgetName, unsetAdditionalFocus$1) => {
|
|
@@ -24637,7 +24646,7 @@ const closeWidget2 = async (editorUid, widgetId, widgetName, unsetAdditionalFocu
|
|
|
24637
24646
|
widgets: newWidgets
|
|
24638
24647
|
};
|
|
24639
24648
|
const newEditorWithDerivedState = await updateDerivedState(editor, newEditor);
|
|
24640
|
-
set$
|
|
24649
|
+
set$b(editorUid, editor, newEditorWithDerivedState);
|
|
24641
24650
|
await setFocus(FocusEditorText);
|
|
24642
24651
|
if (unsetAdditionalFocus$1) {
|
|
24643
24652
|
await unsetAdditionalFocus(unsetAdditionalFocus$1);
|
|
@@ -24668,7 +24677,7 @@ const ensure = async (fontName, fontUrl) => {
|
|
|
24668
24677
|
const getComponentState = uid => {
|
|
24669
24678
|
const {
|
|
24670
24679
|
newState
|
|
24671
|
-
} = get$
|
|
24680
|
+
} = get$a(uid);
|
|
24672
24681
|
return {
|
|
24673
24682
|
...newState,
|
|
24674
24683
|
cursorUndoStack: newState.cursorUndoStack?.map(selection => [...selection]),
|
|
@@ -25172,7 +25181,7 @@ const getProblems = async () => {
|
|
|
25172
25181
|
const keys = getKeys$2();
|
|
25173
25182
|
const diagnostics = keys.flatMap(key => {
|
|
25174
25183
|
const numericKey = Number(key);
|
|
25175
|
-
const editor = get$
|
|
25184
|
+
const editor = get$a(numericKey);
|
|
25176
25185
|
if (!editor?.newState) {
|
|
25177
25186
|
return [];
|
|
25178
25187
|
}
|
|
@@ -25344,10 +25353,10 @@ const createCommandMap = commands => ({
|
|
|
25344
25353
|
if (typeof fn !== 'function') {
|
|
25345
25354
|
throw new TypeError(`Editor event command not found: ${command}`);
|
|
25346
25355
|
}
|
|
25347
|
-
const editor = get$
|
|
25356
|
+
const editor = get$a(uid)?.newState;
|
|
25348
25357
|
if (!editor) return;
|
|
25349
25358
|
await fn(uid, ...args);
|
|
25350
|
-
const current = get$
|
|
25359
|
+
const current = get$a(uid)?.newState;
|
|
25351
25360
|
if (!current || editor.lifecycle?.disposed || current.lifecycle !== editor.lifecycle) return;
|
|
25352
25361
|
// The wrapped command has released the document queue before requesting a
|
|
25353
25362
|
// render; a diff can now run without waiting on its own command.
|
|
@@ -25372,7 +25381,7 @@ const handleDirectMessagePort = async (port, commands) => {
|
|
|
25372
25381
|
commandMap: createCommandMap(commands),
|
|
25373
25382
|
messagePort: port
|
|
25374
25383
|
});
|
|
25375
|
-
set$
|
|
25384
|
+
set$5(rpc);
|
|
25376
25385
|
};
|
|
25377
25386
|
|
|
25378
25387
|
const getBreadcrumbFileIcon = async (uri, applicationId) => {
|
|
@@ -25755,7 +25764,7 @@ const restoreWidgetState = async (keys, savedStates) => {
|
|
|
25755
25764
|
const newEditors = [];
|
|
25756
25765
|
for (const key of keys) {
|
|
25757
25766
|
const editorUid = parseInt(key);
|
|
25758
|
-
const editor = get$
|
|
25767
|
+
const editor = get$a(editorUid);
|
|
25759
25768
|
if (!editor?.newState || !Array.isArray(editor.newState.widgets)) {
|
|
25760
25769
|
continue;
|
|
25761
25770
|
}
|
|
@@ -25808,7 +25817,7 @@ const saveSingleWidgetState = async (savedStates, key, widget) => {
|
|
|
25808
25817
|
const saveWidgetState = async keys => {
|
|
25809
25818
|
const savedStates = Object.create(null);
|
|
25810
25819
|
for (const key of keys) {
|
|
25811
|
-
const editor = get$
|
|
25820
|
+
const editor = get$a(parseInt(key));
|
|
25812
25821
|
if (!editor?.newState || !Array.isArray(editor.newState.widgets)) {
|
|
25813
25822
|
continue;
|
|
25814
25823
|
}
|
|
@@ -25837,7 +25846,7 @@ const hotReload = async () => {
|
|
|
25837
25846
|
await relaunchWorkers();
|
|
25838
25847
|
const newEditors = await restoreWidgetState(keys, savedStates);
|
|
25839
25848
|
for (const editor of newEditors) {
|
|
25840
|
-
set$
|
|
25849
|
+
set$b(editor.newState.uid, editor.oldState, editor.newState);
|
|
25841
25850
|
}
|
|
25842
25851
|
|
|
25843
25852
|
// TODO ask renderer worker to rerender all editors
|
|
@@ -25875,7 +25884,7 @@ const initializeSyntaxHighlighting = async (syntaxHighlightingEnabled, syncIncre
|
|
|
25875
25884
|
if (syntaxHighlightingEnabled) {
|
|
25876
25885
|
setEnabled$1(true);
|
|
25877
25886
|
const syntaxRpc = await createSyntaxHighlightingWorkerRpc();
|
|
25878
|
-
set$
|
|
25887
|
+
set$9(syntaxRpc);
|
|
25879
25888
|
}
|
|
25880
25889
|
if (syncIncremental) {
|
|
25881
25890
|
setEnabled(true);
|
|
@@ -26151,7 +26160,7 @@ const loadContent = async (state, savedState, largeFile = false, focus = true, f
|
|
|
26151
26160
|
let existingEditor;
|
|
26152
26161
|
if (!forceReload) {
|
|
26153
26162
|
for (const key of getKeys$2()) {
|
|
26154
|
-
const editor = get$
|
|
26163
|
+
const editor = get$a(Number(key))?.newState;
|
|
26155
26164
|
if (editor && editor.id !== id && !editor.initial && editor.uri === uri && editor.applicationId === state.applicationId) {
|
|
26156
26165
|
existingEditor = editor;
|
|
26157
26166
|
break;
|
|
@@ -26336,14 +26345,14 @@ const refreshGutterDecorations = async editor => {
|
|
|
26336
26345
|
};
|
|
26337
26346
|
const refreshGutterDecorationsAll = async () => {
|
|
26338
26347
|
for (const key of getKeys$2()) {
|
|
26339
|
-
const editor = get$
|
|
26348
|
+
const editor = get$a(Number(key))?.newState;
|
|
26340
26349
|
if (editor) {
|
|
26341
26350
|
const refreshedEditor = await refreshGutterDecorations(editor);
|
|
26342
|
-
const latest = get$
|
|
26351
|
+
const latest = get$a(editor.id);
|
|
26343
26352
|
if (!latest) {
|
|
26344
26353
|
continue;
|
|
26345
26354
|
}
|
|
26346
|
-
set$
|
|
26355
|
+
set$b(editor.id, latest.oldState, {
|
|
26347
26356
|
...latest.newState,
|
|
26348
26357
|
gutterDecorations: refreshedEditor.gutterDecorations
|
|
26349
26358
|
});
|
|
@@ -27720,7 +27729,7 @@ const applyRender = (oldState, newState, diffResult) => {
|
|
|
27720
27729
|
};
|
|
27721
27730
|
|
|
27722
27731
|
const render2 = (uid, _diffResult) => {
|
|
27723
|
-
const editor = get$
|
|
27732
|
+
const editor = get$a(uid);
|
|
27724
27733
|
if (!editor) {
|
|
27725
27734
|
return [];
|
|
27726
27735
|
}
|
|
@@ -27730,7 +27739,7 @@ const render2 = (uid, _diffResult) => {
|
|
|
27730
27739
|
} = editor;
|
|
27731
27740
|
// Diagnostics can change after the caller calculated its diff in a separate RPC.
|
|
27732
27741
|
const diffResult = diff(oldState, newState);
|
|
27733
|
-
set$
|
|
27742
|
+
set$b(uid, newState, newState);
|
|
27734
27743
|
const commands = applyRender(oldState, newState, diffResult);
|
|
27735
27744
|
return commands;
|
|
27736
27745
|
};
|
|
@@ -27738,7 +27747,7 @@ const render2 = (uid, _diffResult) => {
|
|
|
27738
27747
|
const queues = new Map();
|
|
27739
27748
|
const focusCommands = new Set(['Viewlet.focus', 'Viewlet.focusSelector', 'Viewlet.setFocusContext', 'Viewlet.setAdditionalFocus', 'Viewlet.unsetAdditionalFocus']);
|
|
27740
27749
|
const renderDirect = async (uid, preserveFocus) => {
|
|
27741
|
-
const instance = get$
|
|
27750
|
+
const instance = get$a(uid);
|
|
27742
27751
|
if (!instance) return [];
|
|
27743
27752
|
const {
|
|
27744
27753
|
newState,
|
|
@@ -27762,17 +27771,17 @@ const renderDirect = async (uid, preserveFocus) => {
|
|
|
27762
27771
|
}
|
|
27763
27772
|
return result;
|
|
27764
27773
|
} catch (error) {
|
|
27765
|
-
const latest = get$
|
|
27774
|
+
const latest = get$a(uid);
|
|
27766
27775
|
if (latest?.newState.lifecycle === newState.lifecycle && latest.oldState === newState) {
|
|
27767
27776
|
// A rejected queue RPC must not acknowledge patches that never arrived.
|
|
27768
|
-
set$
|
|
27777
|
+
set$b(uid, oldState, latest.newState);
|
|
27769
27778
|
if (oldDom) set$1(uid, oldDom, oldPaths);else dispose$2(uid);
|
|
27770
27779
|
}
|
|
27771
27780
|
throw error;
|
|
27772
27781
|
}
|
|
27773
27782
|
};
|
|
27774
27783
|
const renderDirect2 = async (uid, preserveFocus = false) => {
|
|
27775
|
-
const lifecycle = get$
|
|
27784
|
+
const lifecycle = get$a(uid)?.newState.lifecycle;
|
|
27776
27785
|
const previous = queues.get(uid);
|
|
27777
27786
|
const {
|
|
27778
27787
|
promise,
|
|
@@ -27781,7 +27790,7 @@ const renderDirect2 = async (uid, preserveFocus = false) => {
|
|
|
27781
27790
|
queues.set(uid, promise);
|
|
27782
27791
|
if (previous) await previous;
|
|
27783
27792
|
try {
|
|
27784
|
-
if (get$
|
|
27793
|
+
if (get$a(uid)?.newState.lifecycle !== lifecycle) return [];
|
|
27785
27794
|
return await renderDirect(uid, preserveFocus);
|
|
27786
27795
|
} finally {
|
|
27787
27796
|
resolve();
|
|
@@ -27886,7 +27895,7 @@ const renderWidgets = {
|
|
|
27886
27895
|
};
|
|
27887
27896
|
const render$7 = [renderLines, renderSelections, renderCss, renderFocus$1, renderDecorations, renderGutterInfo, renderWidgets, renderFocusContext, renderAdditionalFocusContext];
|
|
27888
27897
|
const renderEditor = async id => {
|
|
27889
|
-
const instance = get$
|
|
27898
|
+
const instance = get$a(id);
|
|
27890
27899
|
if (!instance) {
|
|
27891
27900
|
return [];
|
|
27892
27901
|
}
|
|
@@ -27895,7 +27904,7 @@ const renderEditor = async id => {
|
|
|
27895
27904
|
oldState
|
|
27896
27905
|
} = instance;
|
|
27897
27906
|
const commands = [];
|
|
27898
|
-
set$
|
|
27907
|
+
set$b(id, newState, newState);
|
|
27899
27908
|
for (const item of render$7) {
|
|
27900
27909
|
if (item.isEqual(oldState, newState)) {
|
|
27901
27910
|
continue;
|
|
@@ -28226,7 +28235,7 @@ const getKey = () => {
|
|
|
28226
28235
|
const updateDebugInfo = async debugId => {
|
|
28227
28236
|
const newInfo = await getDebugHighlight(debugId);
|
|
28228
28237
|
const key = getKey();
|
|
28229
|
-
const instance = get$
|
|
28238
|
+
const instance = get$a(key);
|
|
28230
28239
|
if (!instance) {
|
|
28231
28240
|
return;
|
|
28232
28241
|
}
|
|
@@ -28238,7 +28247,7 @@ const updateDebugInfo = async debugId => {
|
|
|
28238
28247
|
...newState,
|
|
28239
28248
|
highlightedLine: newInfo.rowIndex
|
|
28240
28249
|
};
|
|
28241
|
-
set$
|
|
28250
|
+
set$b(key, oldState, newEditor);
|
|
28242
28251
|
// @ts-ignore
|
|
28243
28252
|
await RendererWorker.invoke('Editor.rerender', key);
|
|
28244
28253
|
};
|
|
@@ -28292,7 +28301,7 @@ const wrapTypingCommand = (fn, shouldOpenCompletion, shouldDismissHover, preserv
|
|
|
28292
28301
|
clear$3(uid);
|
|
28293
28302
|
}
|
|
28294
28303
|
await command(uid, ...args);
|
|
28295
|
-
const editor = get$
|
|
28304
|
+
const editor = get$a(uid)?.newState;
|
|
28296
28305
|
if (editor && (shouldOpenCompletion(...args) && shouldOpenAutomaticCompletion(editor) || editor.widgets?.some(widget => widget.id === Completion && widget.newState.automatic))) {
|
|
28297
28306
|
void updateAutomaticCompletionDeferred(uid).then(() => RendererWorker.invoke('Editor.renderPending', uid)).catch(error => handleError$1(error, 'Failed to open completion widget: '));
|
|
28298
28307
|
}
|
|
@@ -28445,6 +28454,7 @@ const commandMap = {
|
|
|
28445
28454
|
'Editor.handleTripleClick': wrapCommand(handleTripleClick),
|
|
28446
28455
|
'Editor.handleUriChange': wrapCommand(handleUriChange),
|
|
28447
28456
|
'Editor.handleWheel': wrapCommand(handleWheel$2),
|
|
28457
|
+
'Editor.hasCachedCharacterWidth': has$1,
|
|
28448
28458
|
'Editor.hotReload': hotReload,
|
|
28449
28459
|
'Editor.incrementSelection': wrapCommand(incrementSelection),
|
|
28450
28460
|
'Editor.indendLess': wrapCommand(indentLess),
|
|
@@ -28948,15 +28958,15 @@ const EditorMessageWidget = {
|
|
|
28948
28958
|
};
|
|
28949
28959
|
|
|
28950
28960
|
const registerWidgets = () => {
|
|
28951
|
-
set$
|
|
28952
|
-
set$
|
|
28953
|
-
set$
|
|
28954
|
-
set$
|
|
28955
|
-
set$
|
|
28956
|
-
set$
|
|
28957
|
-
set$
|
|
28958
|
-
set$
|
|
28959
|
-
set$
|
|
28961
|
+
set$a(ColorPicker$2, EditorColorPickerWidget);
|
|
28962
|
+
set$a(Completion, EditorCompletionWidget);
|
|
28963
|
+
set$a(CompletionDetail, EditorCompletionDetailWidget);
|
|
28964
|
+
set$a(Find, EditorFindWidget);
|
|
28965
|
+
set$a(Hover, EditorHoverWidget);
|
|
28966
|
+
set$a(Message, EditorMessageWidget);
|
|
28967
|
+
set$a(Rename$1, EditorRenameWidget);
|
|
28968
|
+
set$a(SourceAction$1, EditorSourceActionWidget);
|
|
28969
|
+
set$a(CodeGenerator, EditorCodeGeneratorWidget);
|
|
28960
28970
|
};
|
|
28961
28971
|
|
|
28962
28972
|
const reservedIds = new Set();
|
|
@@ -28970,7 +28980,7 @@ const createEmbeddedEditor = async options => {
|
|
|
28970
28980
|
const {
|
|
28971
28981
|
id
|
|
28972
28982
|
} = options;
|
|
28973
|
-
if (reservedIds.has(id) || get$
|
|
28983
|
+
if (reservedIds.has(id) || get$a(id)) {
|
|
28974
28984
|
throw new Error(`Editor already exists: ${id}`);
|
|
28975
28985
|
}
|
|
28976
28986
|
reservedIds.add(id);
|
|
@@ -28989,7 +28999,7 @@ const createEmbeddedEditor = async options => {
|
|
|
28989
28999
|
if (closed) {
|
|
28990
29000
|
throw new Error(`Editor is disposed: ${id}`);
|
|
28991
29001
|
}
|
|
28992
|
-
return get$
|
|
29002
|
+
return get$a(id).newState;
|
|
28993
29003
|
};
|
|
28994
29004
|
const ignoreFailure = async command => {
|
|
28995
29005
|
try {
|
|
@@ -29001,7 +29011,7 @@ const createEmbeddedEditor = async options => {
|
|
|
29001
29011
|
const run = async (previous, fn, args) => {
|
|
29002
29012
|
await previous;
|
|
29003
29013
|
await fn(id, ...args);
|
|
29004
|
-
return get$
|
|
29014
|
+
return get$a(id).newState;
|
|
29005
29015
|
};
|
|
29006
29016
|
const execute = (command, ...args) => {
|
|
29007
29017
|
if (closed) {
|