@lvce-editor/editor-worker 19.78.2 → 19.78.4
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 +180 -170
- package/dist/editorWorkerMain.js +174 -164
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -1791,6 +1791,30 @@ const activateByEvent = async (event, assetDir, platform) => {
|
|
|
1791
1791
|
await invoke$h('Extensions.activateByEvent', event);
|
|
1792
1792
|
};
|
|
1793
1793
|
|
|
1794
|
+
const cacheName$1 = 'lvce-editor-character-widths-v1';
|
|
1795
|
+
const character = 'a';
|
|
1796
|
+
const getKey$2 = (fontWeight, fontSize, fontFamily, letterSpacing) => {
|
|
1797
|
+
return `https://cache.invalid/character-width/${encodeURIComponent(JSON.stringify([character, fontWeight, fontSize, fontFamily, letterSpacing]))}`;
|
|
1798
|
+
};
|
|
1799
|
+
const get$a = async (fontWeight, fontSize, fontFamily, letterSpacing) => {
|
|
1800
|
+
const item = await getCacheStorageJsonItem(getKey$2(fontWeight, fontSize, fontFamily, letterSpacing), cacheName$1);
|
|
1801
|
+
const width = item?.value;
|
|
1802
|
+
if (typeof width !== 'number' || !Number.isFinite(width) || width < 0) {
|
|
1803
|
+
return undefined;
|
|
1804
|
+
}
|
|
1805
|
+
return width;
|
|
1806
|
+
};
|
|
1807
|
+
const set$c = async (fontWeight, fontSize, fontFamily, letterSpacing, width) => {
|
|
1808
|
+
await setCacheStorageJsonItem(getKey$2(fontWeight, fontSize, fontFamily, letterSpacing), width, cacheName$1);
|
|
1809
|
+
};
|
|
1810
|
+
const has$1 = async (fontWeight, fontSize, fontFamily, letterSpacing) => {
|
|
1811
|
+
try {
|
|
1812
|
+
return (await get$a(fontWeight, fontSize, fontFamily, letterSpacing)) !== undefined;
|
|
1813
|
+
} catch {
|
|
1814
|
+
return false;
|
|
1815
|
+
}
|
|
1816
|
+
};
|
|
1817
|
+
|
|
1794
1818
|
const codeGeneratorAccept = state => {
|
|
1795
1819
|
// TODO close code generator widget
|
|
1796
1820
|
return state;
|
|
@@ -1823,19 +1847,19 @@ const {
|
|
|
1823
1847
|
wrapCommand: wrapCommand$2,
|
|
1824
1848
|
wrapGetter
|
|
1825
1849
|
} = editorStates;
|
|
1826
|
-
const get$
|
|
1850
|
+
const get$9 = id => {
|
|
1827
1851
|
return editorStates.get(id);
|
|
1828
1852
|
};
|
|
1829
1853
|
const getKeys$2 = () => {
|
|
1830
1854
|
const keys = editorStates.getKeys();
|
|
1831
1855
|
return keys.map(String);
|
|
1832
1856
|
};
|
|
1833
|
-
const set$
|
|
1857
|
+
const set$b = (id, oldEditor, newEditor) => {
|
|
1834
1858
|
editorStates.set(id, oldEditor, newEditor);
|
|
1835
1859
|
};
|
|
1836
1860
|
|
|
1837
1861
|
const getEditor$1 = editorUid => {
|
|
1838
|
-
const instance = get$
|
|
1862
|
+
const instance = get$9(editorUid);
|
|
1839
1863
|
if (!instance) {
|
|
1840
1864
|
throw new Error(`editor ${editorUid} not found`);
|
|
1841
1865
|
}
|
|
@@ -1881,15 +1905,15 @@ const ToggleBlockComment$1 = 'toggleBlockComment';
|
|
|
1881
1905
|
const Unknown$2 = 'unknown';
|
|
1882
1906
|
|
|
1883
1907
|
const map$1 = Object.create(null);
|
|
1884
|
-
const set$
|
|
1908
|
+
const set$a = (id, widget) => {
|
|
1885
1909
|
map$1[id] = widget;
|
|
1886
1910
|
};
|
|
1887
|
-
const get$
|
|
1911
|
+
const get$8 = id => {
|
|
1888
1912
|
return map$1[id];
|
|
1889
1913
|
};
|
|
1890
1914
|
|
|
1891
1915
|
const getModule = id => {
|
|
1892
|
-
return get$
|
|
1916
|
+
return get$8(id);
|
|
1893
1917
|
};
|
|
1894
1918
|
|
|
1895
1919
|
const applyWidgetChange = async (editor, widget, changes) => {
|
|
@@ -3955,7 +3979,7 @@ const getEnabled$1 = () => {
|
|
|
3955
3979
|
};
|
|
3956
3980
|
|
|
3957
3981
|
const invoke$c = (...args) => invoke$d(...args);
|
|
3958
|
-
const set$
|
|
3982
|
+
const set$9 = (...args) => set$d(...args);
|
|
3959
3983
|
|
|
3960
3984
|
const state$d = {
|
|
3961
3985
|
pending: Object.create(null),
|
|
@@ -3965,10 +3989,10 @@ const state$d = {
|
|
|
3965
3989
|
const has = languageId => {
|
|
3966
3990
|
return Object.hasOwn(state$d.tokenizers, languageId);
|
|
3967
3991
|
};
|
|
3968
|
-
const set$
|
|
3992
|
+
const set$8 = (languageId, tokenizer) => {
|
|
3969
3993
|
state$d.tokenizers[languageId] = tokenizer;
|
|
3970
3994
|
};
|
|
3971
|
-
const get$
|
|
3995
|
+
const get$7 = languageId => {
|
|
3972
3996
|
return state$d.tokenizers[languageId];
|
|
3973
3997
|
};
|
|
3974
3998
|
const setTokenizePath = (languageId, tokenizePath) => {
|
|
@@ -3990,10 +4014,10 @@ const isPending = languageId => {
|
|
|
3990
4014
|
const getTokenizePaths = () => [...new Set(Object.values(state$d.tokenizePaths))].toSorted((a, b) => a.localeCompare(b));
|
|
3991
4015
|
|
|
3992
4016
|
const tokenMaps = Object.create(null);
|
|
3993
|
-
const set$
|
|
4017
|
+
const set$7 = (languageId, tokenMap) => {
|
|
3994
4018
|
tokenMaps[languageId] = tokenMap;
|
|
3995
4019
|
};
|
|
3996
|
-
const get$
|
|
4020
|
+
const get$6 = languageId => {
|
|
3997
4021
|
return tokenMaps[languageId] || {};
|
|
3998
4022
|
};
|
|
3999
4023
|
|
|
@@ -4006,7 +4030,7 @@ const loadTokenizer = async (languageId, tokenizePath) => {
|
|
|
4006
4030
|
if (getEnabled$1()) {
|
|
4007
4031
|
// @ts-ignore
|
|
4008
4032
|
const tokenMap = await invoke$c('Tokenizer.load', languageId, tokenizePath);
|
|
4009
|
-
set$
|
|
4033
|
+
set$7(languageId, tokenMap);
|
|
4010
4034
|
return;
|
|
4011
4035
|
}
|
|
4012
4036
|
try {
|
|
@@ -4022,8 +4046,8 @@ const loadTokenizer = async (languageId, tokenizePath) => {
|
|
|
4022
4046
|
console.warn(`tokenizer.TokenMap should be an object in "${tokenizePath}"`);
|
|
4023
4047
|
return;
|
|
4024
4048
|
}
|
|
4025
|
-
set$
|
|
4026
|
-
set$
|
|
4049
|
+
set$7(languageId, tokenizer.TokenMap);
|
|
4050
|
+
set$8(languageId, tokenizer);
|
|
4027
4051
|
} catch (error) {
|
|
4028
4052
|
// TODO better error handling
|
|
4029
4053
|
console.error(error);
|
|
@@ -4031,7 +4055,7 @@ const loadTokenizer = async (languageId, tokenizePath) => {
|
|
|
4031
4055
|
};
|
|
4032
4056
|
const getTokenizer = languageId => {
|
|
4033
4057
|
if (has(languageId)) {
|
|
4034
|
-
return get$
|
|
4058
|
+
return get$7(languageId);
|
|
4035
4059
|
}
|
|
4036
4060
|
if (isPending(languageId)) {
|
|
4037
4061
|
return TokenizePlainText;
|
|
@@ -4040,7 +4064,7 @@ const getTokenizer = languageId => {
|
|
|
4040
4064
|
};
|
|
4041
4065
|
|
|
4042
4066
|
const tokenizers = [TokenizePlainText];
|
|
4043
|
-
const get$
|
|
4067
|
+
const get$5 = id => {
|
|
4044
4068
|
return tokenizers[id] || TokenizePlainText;
|
|
4045
4069
|
};
|
|
4046
4070
|
const register = tokenizer => {
|
|
@@ -4130,7 +4154,7 @@ const getTokensViewport = (editor, startLineIndex, endLineIndex) => {
|
|
|
4130
4154
|
lines,
|
|
4131
4155
|
tokenizerId
|
|
4132
4156
|
} = editor;
|
|
4133
|
-
const tokenizer = get$
|
|
4157
|
+
const tokenizer = get$5(tokenizerId);
|
|
4134
4158
|
const {
|
|
4135
4159
|
hasArrayReturn,
|
|
4136
4160
|
initialLineState,
|
|
@@ -11135,7 +11159,7 @@ const getFingerprint = async (paths, readApplicationSource) => {
|
|
|
11135
11159
|
return Array.from(new Uint8Array(digest), value => value.toString(16).padStart(2, '0')).join('');
|
|
11136
11160
|
};
|
|
11137
11161
|
|
|
11138
|
-
const cacheName
|
|
11162
|
+
const cacheName = 'lvce-editor-syntax-highlighting-v1';
|
|
11139
11163
|
const lifetime = 90 * 24 * 60 * 60 * 1000;
|
|
11140
11164
|
const fingerprints = new Map();
|
|
11141
11165
|
// Editor line arrays are immutable snapshots; edits replace the array. Weak
|
|
@@ -11145,7 +11169,7 @@ const hash = async value => {
|
|
|
11145
11169
|
const digest = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(JSON.stringify(value)));
|
|
11146
11170
|
return Array.from(new Uint8Array(digest), value => value.toString(16).padStart(2, '0')).join('');
|
|
11147
11171
|
};
|
|
11148
|
-
const getKey$
|
|
11172
|
+
const getKey$1 = async (editor, start, end) => {
|
|
11149
11173
|
if (editor.syntaxHighlightingCacheEnabled !== true || editor.largeFile || !getTokenizePath$1(editor.languageId)) {
|
|
11150
11174
|
return '';
|
|
11151
11175
|
}
|
|
@@ -11182,26 +11206,26 @@ const getKey$2 = async (editor, start, end) => {
|
|
|
11182
11206
|
return '';
|
|
11183
11207
|
}
|
|
11184
11208
|
};
|
|
11185
|
-
const get$
|
|
11209
|
+
const get$4 = async (key, lineLengths) => {
|
|
11186
11210
|
try {
|
|
11187
|
-
const item = await getCacheStorageItem(key, cacheName
|
|
11211
|
+
const item = await getCacheStorageItem(key, cacheName);
|
|
11188
11212
|
if (!item) {
|
|
11189
11213
|
return undefined;
|
|
11190
11214
|
}
|
|
11191
11215
|
const result = decode(item.body, lineLengths, Date.now());
|
|
11192
11216
|
if (!result) {
|
|
11193
|
-
await removeCacheStorageItem(key, cacheName
|
|
11217
|
+
await removeCacheStorageItem(key, cacheName);
|
|
11194
11218
|
}
|
|
11195
11219
|
return result;
|
|
11196
11220
|
} catch {
|
|
11197
11221
|
return undefined;
|
|
11198
11222
|
}
|
|
11199
11223
|
};
|
|
11200
|
-
const set$
|
|
11224
|
+
const set$6 = async (key, result) => {
|
|
11201
11225
|
try {
|
|
11202
11226
|
const buffer = encode(result, Date.now() + lifetime);
|
|
11203
11227
|
if (buffer) {
|
|
11204
|
-
await setCacheStorageItem(key, buffer, cacheName
|
|
11228
|
+
await setCacheStorageItem(key, buffer, cacheName, {
|
|
11205
11229
|
'content-type': 'application/octet-stream'
|
|
11206
11230
|
});
|
|
11207
11231
|
}
|
|
@@ -11268,7 +11292,7 @@ const getTokensViewport2 = async (editor, start, end, syncIncremental) => {
|
|
|
11268
11292
|
if (editor.syntaxHighlightingCacheEnabled !== true) {
|
|
11269
11293
|
return getFreshTokensViewport(editor, start, end, syncIncremental);
|
|
11270
11294
|
}
|
|
11271
|
-
const key = await getKey$
|
|
11295
|
+
const key = await getKey$1(editor, start, end);
|
|
11272
11296
|
if (editor.lifecycle?.disposed) {
|
|
11273
11297
|
return {
|
|
11274
11298
|
embeddedResults: [],
|
|
@@ -11277,7 +11301,7 @@ const getTokensViewport2 = async (editor, start, end, syncIncremental) => {
|
|
|
11277
11301
|
};
|
|
11278
11302
|
}
|
|
11279
11303
|
if (key) {
|
|
11280
|
-
const cached = await get$
|
|
11304
|
+
const cached = await get$4(key, editor.lines.slice(start, end).map(line => line.length));
|
|
11281
11305
|
if (editor.lifecycle?.disposed) {
|
|
11282
11306
|
return {
|
|
11283
11307
|
embeddedResults: [],
|
|
@@ -11296,7 +11320,7 @@ const getTokensViewport2 = async (editor, start, end, syncIncremental) => {
|
|
|
11296
11320
|
}
|
|
11297
11321
|
const result = await getFreshTokensViewport(editor, start, end, syncIncremental);
|
|
11298
11322
|
if (key && !editor.lifecycle?.disposed) {
|
|
11299
|
-
await set$
|
|
11323
|
+
await set$6(key, result);
|
|
11300
11324
|
}
|
|
11301
11325
|
return result;
|
|
11302
11326
|
};
|
|
@@ -11890,7 +11914,7 @@ const getLineInfosViewport = async (editor, tokens, embeddedResults, minLineY, m
|
|
|
11890
11914
|
languageId,
|
|
11891
11915
|
lines
|
|
11892
11916
|
} = editor;
|
|
11893
|
-
const tokenMap = get$
|
|
11917
|
+
const tokenMap = get$6(languageId);
|
|
11894
11918
|
let offset = minLineOffset;
|
|
11895
11919
|
const tabSize = editor.tabSize ?? 2;
|
|
11896
11920
|
const visibleLines = lines.slice(minLineY, maxLineY);
|
|
@@ -12618,7 +12642,7 @@ const transformDiagnostics = (diagnostics, changes) => {
|
|
|
12618
12642
|
|
|
12619
12643
|
const queues$1 = {};
|
|
12620
12644
|
const enqueue = async (uid, callback) => {
|
|
12621
|
-
const instance = get$
|
|
12645
|
+
const instance = get$9(uid);
|
|
12622
12646
|
if (!instance) {
|
|
12623
12647
|
return undefined;
|
|
12624
12648
|
}
|
|
@@ -12712,7 +12736,7 @@ const isConnected = () => {
|
|
|
12712
12736
|
} = state$9;
|
|
12713
12737
|
return rpc !== undefined;
|
|
12714
12738
|
};
|
|
12715
|
-
const set$
|
|
12739
|
+
const set$5 = value => {
|
|
12716
12740
|
state$9.rpc = value;
|
|
12717
12741
|
};
|
|
12718
12742
|
const invoke$8 = (method, ...params) => {
|
|
@@ -12908,7 +12932,7 @@ const mergeDiagnostics = (editor, editorWithDiagnostics) => ({
|
|
|
12908
12932
|
});
|
|
12909
12933
|
const commitDiagnostics = async (editor, generation, diagnostics, onAccepted) => {
|
|
12910
12934
|
return (await enqueue(editor.id, async () => {
|
|
12911
|
-
let latest = get$
|
|
12935
|
+
let latest = get$9(editor.id);
|
|
12912
12936
|
if (!isApplicable(latest, editor, generation)) {
|
|
12913
12937
|
return editor;
|
|
12914
12938
|
}
|
|
@@ -12921,11 +12945,11 @@ const commitDiagnostics = async (editor, generation, diagnostics, onAccepted) =>
|
|
|
12921
12945
|
}
|
|
12922
12946
|
let calculationState = latest.newState;
|
|
12923
12947
|
let editorWithDiagnostics = await addDiagnostics(calculationState, diagnostics);
|
|
12924
|
-
latest = get$
|
|
12948
|
+
latest = get$9(editor.id);
|
|
12925
12949
|
while (isApplicable(latest, editor, generation) && !diagnosticLayoutEqual(calculationState, latest.newState)) {
|
|
12926
12950
|
calculationState = latest.newState;
|
|
12927
12951
|
editorWithDiagnostics = await addDiagnostics(calculationState, diagnostics);
|
|
12928
|
-
latest = get$
|
|
12952
|
+
latest = get$9(editor.id);
|
|
12929
12953
|
}
|
|
12930
12954
|
if (!isApplicable(latest, editor, generation)) {
|
|
12931
12955
|
return editor;
|
|
@@ -12934,7 +12958,7 @@ const commitDiagnostics = async (editor, generation, diagnostics, onAccepted) =>
|
|
|
12934
12958
|
return latest.newState;
|
|
12935
12959
|
}
|
|
12936
12960
|
const newEditor = mergeDiagnostics(latest.newState, editorWithDiagnostics);
|
|
12937
|
-
set$
|
|
12961
|
+
set$b(editor.id, latest.oldState, newEditor);
|
|
12938
12962
|
requestDiagnosticSnapshots.set(editor.id, diagnostics);
|
|
12939
12963
|
onAccepted?.();
|
|
12940
12964
|
await invoke$7('Editor.renderPending', newEditor.id);
|
|
@@ -12965,7 +12989,7 @@ const updateDiagnostics = async (editor, timeoutMs = 0) => {
|
|
|
12965
12989
|
}
|
|
12966
12990
|
const generation = (requestGenerations.get(editor.id) ?? 0) + 1;
|
|
12967
12991
|
requestGenerations.set(editor.id, generation);
|
|
12968
|
-
requestDiagnosticSnapshots.set(editor.id, get$
|
|
12992
|
+
requestDiagnosticSnapshots.set(editor.id, get$9(editor.id)?.newState.diagnostics ?? editor.diagnostics);
|
|
12969
12993
|
const providers = new Map();
|
|
12970
12994
|
const previous = previousProviderResults.get(editor.id);
|
|
12971
12995
|
if (previous && previous.languageId === editor.languageId && previous.uri === editor.uri) {
|
|
@@ -13079,7 +13103,7 @@ const updateDiagnostics = async (editor, timeoutMs = 0) => {
|
|
|
13079
13103
|
};
|
|
13080
13104
|
try {
|
|
13081
13105
|
await Promise.all([request(), completed.promise]);
|
|
13082
|
-
const latest = get$
|
|
13106
|
+
const latest = get$9(editor.id);
|
|
13083
13107
|
if (strict && !isApplicable(latest, editor, generation)) {
|
|
13084
13108
|
throw new Error('Editor changed or closed while waiting for diagnostics');
|
|
13085
13109
|
}
|
|
@@ -13132,7 +13156,7 @@ const transformCachedDiagnostics = (editorId, changes) => {
|
|
|
13132
13156
|
};
|
|
13133
13157
|
const updateDiagnosticsAll = async () => {
|
|
13134
13158
|
for (const key of getKeys$2()) {
|
|
13135
|
-
const editor = get$
|
|
13159
|
+
const editor = get$9(Number(key))?.newState;
|
|
13136
13160
|
if (editor) {
|
|
13137
13161
|
await updateDiagnostics(editor);
|
|
13138
13162
|
}
|
|
@@ -13144,7 +13168,7 @@ const waitForDiagnostics = async (editorId, timeoutMs = 30_000) => {
|
|
|
13144
13168
|
if (!Number.isFinite(timeoutMs) || timeoutMs <= 0 || timeoutMs > 300_000) {
|
|
13145
13169
|
throw new Error('Diagnostics timeout must be between 1 and 300000ms');
|
|
13146
13170
|
}
|
|
13147
|
-
const editor = get$
|
|
13171
|
+
const editor = get$9(editorId)?.newState;
|
|
13148
13172
|
if (!editor || editor.initial) {
|
|
13149
13173
|
throw new Error(`Editor is not ready: ${editorId}`);
|
|
13150
13174
|
}
|
|
@@ -13820,7 +13844,7 @@ const scheduleDocumentAndCursorsSelections = async (editor, changes, selectionCh
|
|
|
13820
13844
|
...newEditor,
|
|
13821
13845
|
decorations: linkDecorations
|
|
13822
13846
|
};
|
|
13823
|
-
set$
|
|
13847
|
+
set$b(editor.uid, editor, newEditorWithDecorations);
|
|
13824
13848
|
|
|
13825
13849
|
// Notify main-area-worker about modified status change
|
|
13826
13850
|
if (!editor.modified && options.notifyModifiedStatusChange !== false) {
|
|
@@ -14292,7 +14316,7 @@ const getMinimapLines = async (editor, syncIncremental) => {
|
|
|
14292
14316
|
await loadTokenizers(result.tokenizersToLoad);
|
|
14293
14317
|
result = await getTokensViewport2(editor, 0, lines.length, syncIncremental);
|
|
14294
14318
|
}
|
|
14295
|
-
const tokenMap = get$
|
|
14319
|
+
const tokenMap = get$6(languageId);
|
|
14296
14320
|
return result.tokens.map((lineState, index) => getLine(lineState, result.embeddedResults, tokenMap, lines[index].length));
|
|
14297
14321
|
};
|
|
14298
14322
|
|
|
@@ -14797,7 +14821,7 @@ const updateColorPickerValue = async (editorUid, value) => {
|
|
|
14797
14821
|
return;
|
|
14798
14822
|
}
|
|
14799
14823
|
const newEditorWithDerivedState = await updateDerivedState(editor, newEditor);
|
|
14800
|
-
set$
|
|
14824
|
+
set$b(editorUid, editor, newEditorWithDerivedState);
|
|
14801
14825
|
};
|
|
14802
14826
|
|
|
14803
14827
|
const getColorPickerWorkerCommandMap = () => ({
|
|
@@ -15010,7 +15034,7 @@ const createEditor2 = (id, uri, x, y, width, height, platform, assetDir, _langua
|
|
|
15010
15034
|
x,
|
|
15011
15035
|
y
|
|
15012
15036
|
};
|
|
15013
|
-
set$
|
|
15037
|
+
set$b(id, editor, editor);
|
|
15014
15038
|
};
|
|
15015
15039
|
|
|
15016
15040
|
const emptyEditor = {
|
|
@@ -15152,26 +15176,9 @@ const getLanguages = async (platform, assetDir, applicationId) => {
|
|
|
15152
15176
|
return invoke$9(applicationId, 'Extensions.getLanguages', platform, assetDir);
|
|
15153
15177
|
};
|
|
15154
15178
|
|
|
15155
|
-
const cacheName = 'lvce-editor-character-widths-v1';
|
|
15156
|
-
const character = 'a';
|
|
15157
|
-
const getKey$1 = (fontWeight, fontSize, fontFamily, letterSpacing) => {
|
|
15158
|
-
return `/character-width/${encodeURIComponent(JSON.stringify([character, fontWeight, fontSize, fontFamily, letterSpacing]))}`;
|
|
15159
|
-
};
|
|
15160
|
-
const get$4 = async (fontWeight, fontSize, fontFamily, letterSpacing) => {
|
|
15161
|
-
const item = await getCacheStorageJsonItem(getKey$1(fontWeight, fontSize, fontFamily, letterSpacing), cacheName);
|
|
15162
|
-
const width = item?.value;
|
|
15163
|
-
if (typeof width !== 'number' || !Number.isFinite(width) || width < 0) {
|
|
15164
|
-
return undefined;
|
|
15165
|
-
}
|
|
15166
|
-
return width;
|
|
15167
|
-
};
|
|
15168
|
-
const set$5 = async (fontWeight, fontSize, fontFamily, letterSpacing, width) => {
|
|
15169
|
-
await setCacheStorageJsonItem(getKey$1(fontWeight, fontSize, fontFamily, letterSpacing), width, cacheName);
|
|
15170
|
-
};
|
|
15171
|
-
|
|
15172
15179
|
const measureCharacterWidth = async (fontWeight, fontSize, fontFamily, letterSpacing) => {
|
|
15173
15180
|
try {
|
|
15174
|
-
const cachedWidth = await get$
|
|
15181
|
+
const cachedWidth = await get$a(fontWeight, fontSize, fontFamily, letterSpacing);
|
|
15175
15182
|
if (cachedWidth !== undefined) {
|
|
15176
15183
|
return cachedWidth;
|
|
15177
15184
|
}
|
|
@@ -15180,7 +15187,7 @@ const measureCharacterWidth = async (fontWeight, fontSize, fontFamily, letterSpa
|
|
|
15180
15187
|
}
|
|
15181
15188
|
const width = await measureTextWidth('a', fontWeight, fontSize, fontFamily, letterSpacing, false, 0);
|
|
15182
15189
|
try {
|
|
15183
|
-
await set$
|
|
15190
|
+
await set$c(fontWeight, fontSize, fontFamily, letterSpacing, width);
|
|
15184
15191
|
} catch {
|
|
15185
15192
|
// Cache failures must not prevent editor creation.
|
|
15186
15193
|
}
|
|
@@ -15384,10 +15391,10 @@ const createEditor = async ({
|
|
|
15384
15391
|
focused: true,
|
|
15385
15392
|
textInfos
|
|
15386
15393
|
};
|
|
15387
|
-
set$
|
|
15394
|
+
set$b(id, emptyEditor, newEditor4);
|
|
15388
15395
|
const completionsOnTypeRaw = await get$3('editor.completionsOnType');
|
|
15389
15396
|
const completionsOnType = Boolean(completionsOnTypeRaw);
|
|
15390
|
-
set$
|
|
15397
|
+
set$b(id, emptyEditor, {
|
|
15391
15398
|
...newEditor4,
|
|
15392
15399
|
completionsOnType
|
|
15393
15400
|
});
|
|
@@ -15416,7 +15423,7 @@ const createStandaloneEditor = async ({
|
|
|
15416
15423
|
y
|
|
15417
15424
|
}) => {
|
|
15418
15425
|
createEditor2(id, uri, x, y, width, height, platform, assetDir, undefined, undefined, undefined, applicationId);
|
|
15419
|
-
const createdEditor = get$
|
|
15426
|
+
const createdEditor = get$9(id).newState;
|
|
15420
15427
|
await loadTokenizer(languageId, tokenizePath);
|
|
15421
15428
|
const tokenizerId = register(getTokenizer(languageId));
|
|
15422
15429
|
const configuredEditor = {
|
|
@@ -15463,7 +15470,7 @@ const createStandaloneEditor = async ({
|
|
|
15463
15470
|
selectionInfos
|
|
15464
15471
|
};
|
|
15465
15472
|
if (!createdEditor.lifecycle?.disposed) {
|
|
15466
|
-
set$
|
|
15473
|
+
set$b(id, createdEditor, finalEditor);
|
|
15467
15474
|
}
|
|
15468
15475
|
};
|
|
15469
15476
|
|
|
@@ -15526,7 +15533,7 @@ const diff = (oldState, newState) => {
|
|
|
15526
15533
|
};
|
|
15527
15534
|
|
|
15528
15535
|
const diff2 = uid => {
|
|
15529
|
-
const editor = get$
|
|
15536
|
+
const editor = get$9(uid);
|
|
15530
15537
|
if (!editor) {
|
|
15531
15538
|
return [];
|
|
15532
15539
|
}
|
|
@@ -15682,7 +15689,7 @@ const initializeListener = async rpcId => {
|
|
|
15682
15689
|
if (!getListeners(EditorSelection$1).includes(rpcId)) {
|
|
15683
15690
|
return;
|
|
15684
15691
|
}
|
|
15685
|
-
const editor = getKeys$2().map(uid => get$
|
|
15692
|
+
const editor = getKeys$2().map(uid => get$9(Number(uid))?.newState).find(state => {
|
|
15686
15693
|
const {
|
|
15687
15694
|
focused,
|
|
15688
15695
|
initial
|
|
@@ -15718,7 +15725,7 @@ const invoke$5 = async (method, ...params) => {
|
|
|
15718
15725
|
return await worker.invoke(method, ...params);
|
|
15719
15726
|
};
|
|
15720
15727
|
const dispose$3 = async () => {
|
|
15721
|
-
if (getKeys$2().some(uid => get$
|
|
15728
|
+
if (getKeys$2().some(uid => get$9(Number(uid))?.newState.widgets?.some(widget => widget.id === Rename$1))) {
|
|
15722
15729
|
return;
|
|
15723
15730
|
}
|
|
15724
15731
|
const promise = workerPromise;
|
|
@@ -15755,14 +15762,14 @@ const dispose$2 = uid => {
|
|
|
15755
15762
|
};
|
|
15756
15763
|
|
|
15757
15764
|
const addWidget$1 = widget => {
|
|
15758
|
-
const module = get$
|
|
15765
|
+
const module = get$8(widget.id);
|
|
15759
15766
|
if (!module) {
|
|
15760
15767
|
throw new Error('unsupported widget');
|
|
15761
15768
|
}
|
|
15762
15769
|
return module.add(widget);
|
|
15763
15770
|
};
|
|
15764
15771
|
const renderWidget = widget => {
|
|
15765
|
-
const module = get$
|
|
15772
|
+
const module = get$8(widget.id);
|
|
15766
15773
|
if (!module) {
|
|
15767
15774
|
throw new Error('unsupported widget');
|
|
15768
15775
|
}
|
|
@@ -15831,7 +15838,7 @@ const renderWidgets$1 = (oldState, newState) => {
|
|
|
15831
15838
|
};
|
|
15832
15839
|
|
|
15833
15840
|
const disposeEditor = async editorUid => {
|
|
15834
|
-
const editor = get$
|
|
15841
|
+
const editor = get$9(editorUid)?.newState;
|
|
15835
15842
|
if (!editor) {
|
|
15836
15843
|
return [];
|
|
15837
15844
|
}
|
|
@@ -15934,7 +15941,7 @@ const hydrateWidget = (editor, widgetId, uid, newState) => {
|
|
|
15934
15941
|
};
|
|
15935
15942
|
};
|
|
15936
15943
|
const getLatestEditor = (uid, fallback) => {
|
|
15937
|
-
const instance = get$
|
|
15944
|
+
const instance = get$9(uid);
|
|
15938
15945
|
return instance?.newState || fallback;
|
|
15939
15946
|
};
|
|
15940
15947
|
const addWidgetToEditor = async (widgetId, focusKey, editor, factory, newStateGenerator, fullFocus) => {
|
|
@@ -15966,7 +15973,7 @@ const addWidgetToEditor = async (widgetId, focusKey, editor, factory, newStateGe
|
|
|
15966
15973
|
};
|
|
15967
15974
|
if (fullFocus) {
|
|
15968
15975
|
// Staging changes pending state; only rendering may advance the mounted baseline.
|
|
15969
|
-
set$
|
|
15976
|
+
set$b(editor.uid, get$9(editor.uid)?.oldState || editor, stagedEditor);
|
|
15970
15977
|
}
|
|
15971
15978
|
const newState = await newStateGenerator(initialState, editor.uid);
|
|
15972
15979
|
if (!newState) {
|
|
@@ -15976,7 +15983,7 @@ const addWidgetToEditor = async (widgetId, focusKey, editor, factory, newStateGe
|
|
|
15976
15983
|
if (fullFocus) {
|
|
15977
15984
|
const latestEditor = getLatestEditor(editor.uid, stagedEditor);
|
|
15978
15985
|
if (latestEditor === stagedEditor) {
|
|
15979
|
-
set$
|
|
15986
|
+
set$b(editor.uid, get$9(editor.uid)?.oldState || editor, editor);
|
|
15980
15987
|
}
|
|
15981
15988
|
return latestEditor === stagedEditor ? editor : latestEditor;
|
|
15982
15989
|
}
|
|
@@ -15997,7 +16004,7 @@ const addWidgetToEditor = async (widgetId, focusKey, editor, factory, newStateGe
|
|
|
15997
16004
|
} : currentEditor;
|
|
15998
16005
|
const hydratedEditor = hydrateWidget(latestEditor, widgetId, widgetUid, latestState);
|
|
15999
16006
|
if (hydratedEditor !== latestEditor) {
|
|
16000
|
-
set$
|
|
16007
|
+
set$b(editor.uid, get$9(editor.uid)?.oldState || editor, hydratedEditor);
|
|
16001
16008
|
}
|
|
16002
16009
|
return hydratedEditor;
|
|
16003
16010
|
}
|
|
@@ -16155,7 +16162,7 @@ const newStateGenerator$4 = async (state, parentUid, markCreated, automatic) =>
|
|
|
16155
16162
|
} = state;
|
|
16156
16163
|
const {
|
|
16157
16164
|
newState
|
|
16158
|
-
} = get$
|
|
16165
|
+
} = get$9(parentUid);
|
|
16159
16166
|
const {
|
|
16160
16167
|
applicationId,
|
|
16161
16168
|
languageId
|
|
@@ -16181,8 +16188,8 @@ const openCompletion = async (editor, automatic = false) => {
|
|
|
16181
16188
|
uid
|
|
16182
16189
|
} = widget.newState;
|
|
16183
16190
|
await invoke$4('Completions.loadContent', uid, automatic);
|
|
16184
|
-
if (!isCurrent$1(editor, get$
|
|
16185
|
-
return get$
|
|
16191
|
+
if (!isCurrent$1(editor, get$9(editor.uid)?.newState)) {
|
|
16192
|
+
return get$9(editor.uid)?.newState || editor;
|
|
16186
16193
|
}
|
|
16187
16194
|
if (automatic && !(await invoke$4('Completions.hasItems', uid))) {
|
|
16188
16195
|
return closeCompletion(editor);
|
|
@@ -16214,7 +16221,7 @@ const openCompletion = async (editor, automatic = false) => {
|
|
|
16214
16221
|
const fullFocus = false;
|
|
16215
16222
|
const result = await addWidgetToEditor(Completion, EditorCompletion, editor, create$7, generateState, fullFocus);
|
|
16216
16223
|
const wasAdded = (result?.widgets || []).some(widget => widget.id === Completion && widget.newState.uid === completionUid);
|
|
16217
|
-
const currentEditor = get$
|
|
16224
|
+
const currentEditor = get$9(editor.uid)?.newState;
|
|
16218
16225
|
if (created && (!wasAdded || !isCurrent$1(editor, currentEditor))) {
|
|
16219
16226
|
await disposeCompletion(completionUid);
|
|
16220
16227
|
}
|
|
@@ -17093,7 +17100,7 @@ const editorShowMessage = async (editor, rowIndex, columnIndex, message, _isErro
|
|
|
17093
17100
|
if (typeof editor.uid === 'number') {
|
|
17094
17101
|
const timeout = setTimeout(async () => {
|
|
17095
17102
|
clear$1(editor.uid);
|
|
17096
|
-
const latestInstance = get$
|
|
17103
|
+
const latestInstance = get$9(editor.uid);
|
|
17097
17104
|
if (!latestInstance) {
|
|
17098
17105
|
return;
|
|
17099
17106
|
}
|
|
@@ -17107,7 +17114,7 @@ const editorShowMessage = async (editor, rowIndex, columnIndex, message, _isErro
|
|
|
17107
17114
|
widgetRevision: next(editor.uid),
|
|
17108
17115
|
widgets: removeEditorWidget(latestEditor.widgets, Message)
|
|
17109
17116
|
};
|
|
17110
|
-
set$
|
|
17117
|
+
set$b(editor.uid, latestEditor, editorWithoutMessage);
|
|
17111
17118
|
await invoke$e('Editor.renderPending', editor.uid);
|
|
17112
17119
|
}, editor.messageDelay ?? defaultMessageDelay);
|
|
17113
17120
|
set$2(editor.uid, {
|
|
@@ -17306,7 +17313,7 @@ const refresh = async request => {
|
|
|
17306
17313
|
}
|
|
17307
17314
|
const gutterDecorations = await getEditorGutterDecorations(snapshot);
|
|
17308
17315
|
const changed = await enqueue(snapshot.uid, async () => {
|
|
17309
|
-
const current = get$
|
|
17316
|
+
const current = get$9(snapshot.uid)?.newState;
|
|
17310
17317
|
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)) {
|
|
17311
17318
|
return false;
|
|
17312
17319
|
}
|
|
@@ -17315,11 +17322,11 @@ const refresh = async request => {
|
|
|
17315
17322
|
gutterDecorations
|
|
17316
17323
|
});
|
|
17317
17324
|
// Derived state may await layout RPCs while an asynchronous render consumes the baseline.
|
|
17318
|
-
const latest = get$
|
|
17325
|
+
const latest = get$9(snapshot.uid);
|
|
17319
17326
|
if (!isCurrent(latest?.newState, snapshot)) {
|
|
17320
17327
|
return false;
|
|
17321
17328
|
}
|
|
17322
|
-
set$
|
|
17329
|
+
set$b(snapshot.uid, latest.oldState, next);
|
|
17323
17330
|
return true;
|
|
17324
17331
|
});
|
|
17325
17332
|
if (changed) {
|
|
@@ -17399,7 +17406,7 @@ const selectionsEqual = (left, right) => {
|
|
|
17399
17406
|
return true;
|
|
17400
17407
|
};
|
|
17401
17408
|
const saveAfterDelay = async (uid, token) => {
|
|
17402
|
-
if (!get$
|
|
17409
|
+
if (!get$9(uid)) {
|
|
17403
17410
|
consume(uid, token);
|
|
17404
17411
|
return;
|
|
17405
17412
|
}
|
|
@@ -17429,7 +17436,7 @@ const saveAfterDelay = async (uid, token) => {
|
|
|
17429
17436
|
const wrapCommand$1 = (fn, preservesTypingCoalescing = false, returnState = true) => {
|
|
17430
17437
|
const command = async (uid, ...args) => {
|
|
17431
17438
|
return enqueue(uid, async () => {
|
|
17432
|
-
const oldInstance = get$
|
|
17439
|
+
const oldInstance = get$9(uid);
|
|
17433
17440
|
if (!oldInstance) {
|
|
17434
17441
|
return undefined;
|
|
17435
17442
|
}
|
|
@@ -17477,18 +17484,18 @@ const wrapCommand$1 = (fn, preservesTypingCoalescing = false, returnState = true
|
|
|
17477
17484
|
cursorUndoStack: [...previousCursorUndoStack.slice(1 - cursorUndoLimit), new Uint32Array(selections)]
|
|
17478
17485
|
};
|
|
17479
17486
|
}
|
|
17480
|
-
if (state === newEditor || !get$
|
|
17487
|
+
if (state === newEditor || !get$9(uid) || lifecycle?.disposed || get$9(uid).newState.lifecycle !== lifecycle) {
|
|
17481
17488
|
return returnState ? newEditor : undefined;
|
|
17482
17489
|
}
|
|
17483
17490
|
const deferGutterDecorations = !initial && uri === newEditor.uri && lines !== newEditor.lines && Boolean(newEditor.lifecycle);
|
|
17484
17491
|
const newEditorWithDerivedState = await updateDerivedState(state, newEditor, deferGutterDecorations);
|
|
17485
|
-
if (!get$
|
|
17492
|
+
if (!get$9(uid) || lifecycle?.disposed || get$9(uid).newState.lifecycle !== lifecycle) {
|
|
17486
17493
|
return returnState ? newEditorWithDerivedState : undefined;
|
|
17487
17494
|
}
|
|
17488
17495
|
// Another command can commit before the renderer consumes this edit.
|
|
17489
17496
|
// Keep its last rendered baseline, including renders completed while we awaited derived state.
|
|
17490
|
-
const renderedState = get$
|
|
17491
|
-
set$
|
|
17497
|
+
const renderedState = get$9(uid)?.oldState ?? oldInstance.oldState;
|
|
17498
|
+
set$b(uid, renderedState, newEditorWithDerivedState);
|
|
17492
17499
|
await dispose$3();
|
|
17493
17500
|
if (editorDiagnosticEffect.isActive(state, newEditorWithDerivedState)) {
|
|
17494
17501
|
void editorDiagnosticEffect.apply(newEditorWithDerivedState);
|
|
@@ -17501,7 +17508,7 @@ const wrapCommand$1 = (fn, preservesTypingCoalescing = false, returnState = true
|
|
|
17501
17508
|
if (!initial && uri === finalEditor.uri && (endOfLine !== finalEditor.endOfLine || insertSpaces !== finalEditor.insertSpaces || lines !== finalEditor.lines || modified !== finalEditor.modified || redoStack !== finalEditor.redoStack || undoStack !== finalEditor.undoStack)) {
|
|
17502
17509
|
for (const key of getKeys$2()) {
|
|
17503
17510
|
const otherUid = Number(key);
|
|
17504
|
-
const instance = get$
|
|
17511
|
+
const instance = get$9(otherUid);
|
|
17505
17512
|
const editor = instance?.newState;
|
|
17506
17513
|
if (otherUid === uid || !instance || !editor || editor.initial || editor.uri !== finalEditor.uri || editor.applicationId !== finalEditor.applicationId) {
|
|
17507
17514
|
continue;
|
|
@@ -17520,11 +17527,11 @@ const wrapCommand$1 = (fn, preservesTypingCoalescing = false, returnState = true
|
|
|
17520
17527
|
undoStack: finalEditor.undoStack,
|
|
17521
17528
|
visualDecorations: finalEditor.visualDecorations
|
|
17522
17529
|
}, deferGutterDecorations);
|
|
17523
|
-
const latest = get$
|
|
17530
|
+
const latest = get$9(otherUid);
|
|
17524
17531
|
if (!latest || editor.lifecycle?.disposed || latest.newState.lifecycle !== editor.lifecycle) {
|
|
17525
17532
|
continue;
|
|
17526
17533
|
}
|
|
17527
|
-
set$
|
|
17534
|
+
set$b(otherUid, latest.oldState, synchronizedEditor);
|
|
17528
17535
|
if (deferGutterDecorations) {
|
|
17529
17536
|
schedule(synchronizedEditor);
|
|
17530
17537
|
}
|
|
@@ -17555,7 +17562,7 @@ const wrapFocusCommand$1 = (fn, returnState = true) => {
|
|
|
17555
17562
|
}, false, returnState);
|
|
17556
17563
|
const focusCommand = uid => {
|
|
17557
17564
|
// DOM focus events can arrive while a queued command is still opening a widget.
|
|
17558
|
-
const widgetRevision = get$
|
|
17565
|
+
const widgetRevision = get$9(uid)?.newState.widgetRevision;
|
|
17559
17566
|
return command(uid, widgetRevision);
|
|
17560
17567
|
};
|
|
17561
17568
|
return focusCommand;
|
|
@@ -17586,7 +17593,7 @@ const wrapLatestCommand$1 = (fn, returnState = true) => {
|
|
|
17586
17593
|
const wrapDeferredCommand$1 = (fn, returnState = true) => {
|
|
17587
17594
|
const apply = wrapCommand$1((editor, snapshot, result) => merge(editor, snapshot, result), false, returnState);
|
|
17588
17595
|
const deferredCommand = async (uid, ...args) => {
|
|
17589
|
-
const snapshot = await enqueue(uid, async () => get$
|
|
17596
|
+
const snapshot = await enqueue(uid, async () => get$9(uid)?.newState);
|
|
17590
17597
|
if (!snapshot) {
|
|
17591
17598
|
return undefined;
|
|
17592
17599
|
}
|
|
@@ -17645,7 +17652,7 @@ const getOpenEditor = (currentEditor, uri) => {
|
|
|
17645
17652
|
return currentEditor;
|
|
17646
17653
|
}
|
|
17647
17654
|
for (const key of getKeys$2()) {
|
|
17648
|
-
const editor = get$
|
|
17655
|
+
const editor = get$9(Number(key))?.newState;
|
|
17649
17656
|
if (editor && !editor.initial && editor.uri === uri && editor.applicationId === currentEditor.applicationId) {
|
|
17650
17657
|
return editor;
|
|
17651
17658
|
}
|
|
@@ -18150,7 +18157,7 @@ const closeRename = async editor => {
|
|
|
18150
18157
|
}
|
|
18151
18158
|
const renameWidget = widgets[renameWidgetIndex];
|
|
18152
18159
|
await invoke$5('Rename.close', renameWidget.newState.uid);
|
|
18153
|
-
const latest = get$
|
|
18160
|
+
const latest = get$9(uid);
|
|
18154
18161
|
const {
|
|
18155
18162
|
newState
|
|
18156
18163
|
} = latest;
|
|
@@ -20238,7 +20245,7 @@ const editorHoverDismissDelay = 500;
|
|
|
20238
20245
|
const handleMouseLeave = (viewletUid, editorUidValue) => {
|
|
20239
20246
|
const targetEditorUid = editorUidValue ?? viewletUid;
|
|
20240
20247
|
const editorUid = Number(targetEditorUid);
|
|
20241
|
-
const instance = get$
|
|
20248
|
+
const instance = get$9(editorUid);
|
|
20242
20249
|
if (!instance) {
|
|
20243
20250
|
return;
|
|
20244
20251
|
}
|
|
@@ -20253,7 +20260,7 @@ const handleMouseLeave = (viewletUid, editorUidValue) => {
|
|
|
20253
20260
|
}
|
|
20254
20261
|
const timeout = setTimeout(async () => {
|
|
20255
20262
|
clear$3(editorUid);
|
|
20256
|
-
const latestInstance = get$
|
|
20263
|
+
const latestInstance = get$9(editorUid);
|
|
20257
20264
|
if (!latestInstance) {
|
|
20258
20265
|
return;
|
|
20259
20266
|
}
|
|
@@ -20270,7 +20277,7 @@ const handleMouseLeave = (viewletUid, editorUidValue) => {
|
|
|
20270
20277
|
widgetRevision: next(editorUid),
|
|
20271
20278
|
widgets: removeEditorWidget(latestEditor.widgets, Hover)
|
|
20272
20279
|
};
|
|
20273
|
-
set$
|
|
20280
|
+
set$b(editorUid, latestEditor, newEditor);
|
|
20274
20281
|
await invoke$e('Editor.renderPending', editorUid);
|
|
20275
20282
|
}, editorHoverDismissDelay);
|
|
20276
20283
|
set$4(editorUid, {
|
|
@@ -20371,6 +20378,7 @@ const measureTextBlockHeight = async (text, fontFamily, fontSize, lineHeight, wi
|
|
|
20371
20378
|
};
|
|
20372
20379
|
|
|
20373
20380
|
const maximumWidth = 600;
|
|
20381
|
+
const maximumHeight$1 = 300;
|
|
20374
20382
|
const horizontalPadding = 18;
|
|
20375
20383
|
const getDiagnosticHoverInfo = async (editor, diagnostic) => {
|
|
20376
20384
|
const {
|
|
@@ -20382,7 +20390,7 @@ const getDiagnosticHoverInfo = async (editor, diagnostic) => {
|
|
|
20382
20390
|
const detail = getDiagnosticHoverDetail(diagnostic);
|
|
20383
20391
|
const diagnosticText = detail ? `${message} ${detail}` : message;
|
|
20384
20392
|
const measuredHeight = await measureTextBlockHeight(diagnosticText, editor.fontFamily, editor.fontSize, `${editor.rowHeight}px`, width - horizontalPadding);
|
|
20385
|
-
const height = Math.min(measuredHeight + 10, editor.height);
|
|
20393
|
+
const height = Math.min(measuredHeight + 10, maximumHeight$1, editor.height);
|
|
20386
20394
|
const positionX = editor.x + columnIndex * editor.columnWidth - (editor.deltaX || 0);
|
|
20387
20395
|
const x = Math.max(editor.x, Math.min(positionX, editor.x + editor.width - width));
|
|
20388
20396
|
const rowBottom = editor.y + (rowIndex + 1) * editor.rowHeight - (editor.deltaY || 0);
|
|
@@ -20530,10 +20538,11 @@ const hoverDocumentationFontSize = 15;
|
|
|
20530
20538
|
const hoverDocumentationFontFamily = 'Fira Code';
|
|
20531
20539
|
const hoverDocumentationLineHeight = '1.33333';
|
|
20532
20540
|
const hoverWidth = 600;
|
|
20541
|
+
const maximumHeight = 300;
|
|
20533
20542
|
const hoverDocumentationWidth = hoverWidth - 18;
|
|
20534
20543
|
const getEditorHoverInfo = async (editorUid, position) => {
|
|
20535
20544
|
number(editorUid);
|
|
20536
|
-
const instance = get$
|
|
20545
|
+
const instance = get$9(editorUid);
|
|
20537
20546
|
const editor = instance.newState;
|
|
20538
20547
|
const {
|
|
20539
20548
|
selections
|
|
@@ -20576,7 +20585,7 @@ const getEditorHoverInfo = async (editorUid, position) => {
|
|
|
20576
20585
|
diagnosticText += `${diagnosticText ? '\n' : ''}${diagnostic.message} ${diagnostic.source} (${diagnostic.code})`;
|
|
20577
20586
|
}
|
|
20578
20587
|
const diagnosticsHeight = diagnosticText ? (await measureTextBlockHeight(diagnosticText, editor.fontFamily, editor.fontSize, `${editor.rowHeight}px`, hoverDocumentationWidth)) + 10 : 0;
|
|
20579
|
-
const height = Math.min(diagnosticsHeight + displayStringHeight + (documentation ? documentationHeight + 11 : 0) || 20, editor.height);
|
|
20588
|
+
const height = Math.min(diagnosticsHeight + displayStringHeight + (documentation ? documentationHeight + 11 : 0) || 20, maximumHeight, editor.height);
|
|
20580
20589
|
const x$1 = Math.max(editor.x, Math.min(x(editor, rowIndex, wordStart), editor.x + editor.width - hoverWidth));
|
|
20581
20590
|
const rowBottom = y(editor, rowIndex);
|
|
20582
20591
|
const y$1 = rowBottom + height <= editor.y + editor.height ? rowBottom : Math.max(editor.y, rowBottom - editor.rowHeight - height);
|
|
@@ -20667,7 +20676,7 @@ const showDiagnostic = async (editor, diagnostic) => {
|
|
|
20667
20676
|
};
|
|
20668
20677
|
|
|
20669
20678
|
const showHover = async (editor, position, token) => {
|
|
20670
|
-
const instance = get$
|
|
20679
|
+
const instance = get$9(editor.uid);
|
|
20671
20680
|
if (!instance) {
|
|
20672
20681
|
return;
|
|
20673
20682
|
}
|
|
@@ -20676,11 +20685,11 @@ const showHover = async (editor, position, token) => {
|
|
|
20676
20685
|
return;
|
|
20677
20686
|
}
|
|
20678
20687
|
const newEditor = await showHover$1(latestEditor, position);
|
|
20679
|
-
const latestInstance = get$
|
|
20688
|
+
const latestInstance = get$9(editor.uid);
|
|
20680
20689
|
if (latestEditor === newEditor || !latestInstance || latestInstance.newState !== latestEditor || get$2().token !== token) {
|
|
20681
20690
|
return;
|
|
20682
20691
|
}
|
|
20683
|
-
set$
|
|
20692
|
+
set$b(editor.uid, latestInstance.oldState, newEditor);
|
|
20684
20693
|
await invoke$e('Editor.renderPending', editor.uid);
|
|
20685
20694
|
};
|
|
20686
20695
|
|
|
@@ -20703,7 +20712,7 @@ const onHoverIdle = async token => {
|
|
|
20703
20712
|
if (latestToken !== token || !editor) {
|
|
20704
20713
|
return;
|
|
20705
20714
|
}
|
|
20706
|
-
const instance = get$
|
|
20715
|
+
const instance = get$9(editor.uid);
|
|
20707
20716
|
if (!instance || !instance.newState.hoverEnabled) {
|
|
20708
20717
|
return;
|
|
20709
20718
|
}
|
|
@@ -20931,20 +20940,20 @@ const advanceSelectionAutoScroll = async editor => {
|
|
|
20931
20940
|
return editorMoveSelection(scrolledEditor, position, false);
|
|
20932
20941
|
};
|
|
20933
20942
|
const continueScrollingAndMovingSelection = async editorUid => {
|
|
20934
|
-
const editor = get$
|
|
20943
|
+
const editor = get$9(editorUid)?.newState;
|
|
20935
20944
|
if (!editor?.isSelecting || !editor.hasListener) {
|
|
20936
20945
|
return;
|
|
20937
20946
|
}
|
|
20938
20947
|
const nextEditor = await advanceSelectionAutoScroll(editor);
|
|
20939
20948
|
const derivedEditor = await updateDerivedState(editor, nextEditor);
|
|
20940
|
-
const currentEditor = get$
|
|
20949
|
+
const currentEditor = get$9(editorUid)?.newState;
|
|
20941
20950
|
if (currentEditor !== editor) {
|
|
20942
20951
|
if (currentEditor?.isSelecting && currentEditor.hasListener) {
|
|
20943
20952
|
requestAnimationFrame(() => continueScrollingAndMovingSelection(editorUid));
|
|
20944
20953
|
}
|
|
20945
20954
|
return;
|
|
20946
20955
|
}
|
|
20947
|
-
set$
|
|
20956
|
+
set$b(editor.uid, editor, derivedEditor);
|
|
20948
20957
|
await invoke$e('Editor.renderPending', editor.uid);
|
|
20949
20958
|
if (derivedEditor.hasListener) {
|
|
20950
20959
|
requestAnimationFrame(() => continueScrollingAndMovingSelection(editorUid));
|
|
@@ -21657,7 +21666,7 @@ const updateEditor = async (editorUid, editor, newEditor) => {
|
|
|
21657
21666
|
return;
|
|
21658
21667
|
}
|
|
21659
21668
|
const newEditorWithDerivedState = await updateDerivedState(editor, newEditor);
|
|
21660
|
-
set$
|
|
21669
|
+
set$b(editorUid, editor, newEditorWithDerivedState);
|
|
21661
21670
|
};
|
|
21662
21671
|
const applyDocumentEdits = async (editorUid, edits) => {
|
|
21663
21672
|
const editor = getEditor$1(editorUid);
|
|
@@ -21789,7 +21798,7 @@ const Close = 'Close';
|
|
|
21789
21798
|
|
|
21790
21799
|
const getEditorByWidgetUid = (widgetUid, widgetId) => {
|
|
21791
21800
|
for (const key of getKeys$2()) {
|
|
21792
|
-
const editor = get$
|
|
21801
|
+
const editor = get$9(Number(key)).newState;
|
|
21793
21802
|
const widgets = editor.widgets || [];
|
|
21794
21803
|
for (const widget of widgets) {
|
|
21795
21804
|
if (widget.id === widgetId && widget.newState.uid === widgetUid) {
|
|
@@ -21803,7 +21812,7 @@ const getEditor = (editorOrUid, widgetId) => {
|
|
|
21803
21812
|
if (editorOrUid && editorOrUid.widgets) {
|
|
21804
21813
|
return editorOrUid;
|
|
21805
21814
|
}
|
|
21806
|
-
const instance = get$
|
|
21815
|
+
const instance = get$9(editorOrUid);
|
|
21807
21816
|
if (instance && instance.newState && instance.newState.widgets) {
|
|
21808
21817
|
return instance.newState;
|
|
21809
21818
|
}
|
|
@@ -21835,16 +21844,16 @@ const createFn = (key, name, widgetId) => {
|
|
|
21835
21844
|
} = state;
|
|
21836
21845
|
const invoke = getWidgetInvoke(widgetId);
|
|
21837
21846
|
await invoke(`${name}.${key}`, uid, ...args);
|
|
21838
|
-
const latestAfterInvoke = get$
|
|
21847
|
+
const latestAfterInvoke = get$9(editor.uid).newState;
|
|
21839
21848
|
const latestChildIndex = latestAfterInvoke.widgets.findIndex(isWidget);
|
|
21840
21849
|
if (latestChildIndex === -1) {
|
|
21841
|
-
set$
|
|
21850
|
+
set$b(editor.uid, editor, latestAfterInvoke);
|
|
21842
21851
|
await dispose$3();
|
|
21843
21852
|
return latestAfterInvoke;
|
|
21844
21853
|
}
|
|
21845
21854
|
const diff = await invoke(`${name}.diff2`, uid);
|
|
21846
21855
|
const commands = await invoke(`${name}.render2`, uid, diff);
|
|
21847
|
-
const latest = get$
|
|
21856
|
+
const latest = get$9(editor.uid).newState;
|
|
21848
21857
|
if (shouldClose) {
|
|
21849
21858
|
const newEditor = {
|
|
21850
21859
|
...latest,
|
|
@@ -21852,7 +21861,7 @@ const createFn = (key, name, widgetId) => {
|
|
|
21852
21861
|
widgetRevision,
|
|
21853
21862
|
widgets: removeEditorWidget(latest.widgets, widgetId)
|
|
21854
21863
|
};
|
|
21855
|
-
set$
|
|
21864
|
+
set$b(editor.uid, latest, newEditor);
|
|
21856
21865
|
return newEditor;
|
|
21857
21866
|
}
|
|
21858
21867
|
const newState = {
|
|
@@ -21860,7 +21869,7 @@ const createFn = (key, name, widgetId) => {
|
|
|
21860
21869
|
commands
|
|
21861
21870
|
};
|
|
21862
21871
|
const newEditor = updateWidget(latest, widgetId, newState);
|
|
21863
|
-
set$
|
|
21872
|
+
set$b(editor.uid, editor, newEditor);
|
|
21864
21873
|
return newEditor;
|
|
21865
21874
|
};
|
|
21866
21875
|
return fn;
|
|
@@ -22121,7 +22130,7 @@ const newStateGenerator$1 = async (state, parentUid) => {
|
|
|
22121
22130
|
} = state;
|
|
22122
22131
|
const {
|
|
22123
22132
|
newState
|
|
22124
|
-
} = get$
|
|
22133
|
+
} = get$9(parentUid);
|
|
22125
22134
|
const {
|
|
22126
22135
|
applicationId,
|
|
22127
22136
|
languageId
|
|
@@ -22146,7 +22155,7 @@ const openRename = async editor => {
|
|
|
22146
22155
|
if (!word) {
|
|
22147
22156
|
return editor;
|
|
22148
22157
|
}
|
|
22149
|
-
const editorState = get$
|
|
22158
|
+
const editorState = get$9(editor.uid);
|
|
22150
22159
|
if (!editorState) {
|
|
22151
22160
|
return editor;
|
|
22152
22161
|
}
|
|
@@ -22160,7 +22169,7 @@ const openRename = async editor => {
|
|
|
22160
22169
|
if (!prepareRenameResult || typeof prepareRenameResult !== 'object') {
|
|
22161
22170
|
return editor;
|
|
22162
22171
|
}
|
|
22163
|
-
const latestEditor = get$
|
|
22172
|
+
const latestEditor = get$9(editor.uid)?.newState;
|
|
22164
22173
|
if (latestEditor !== editor) {
|
|
22165
22174
|
return latestEditor || editor;
|
|
22166
22175
|
}
|
|
@@ -22297,7 +22306,7 @@ const paste = async (editor, pastedText) => {
|
|
|
22297
22306
|
cause: error
|
|
22298
22307
|
});
|
|
22299
22308
|
}
|
|
22300
|
-
const currentEditor = get$
|
|
22309
|
+
const currentEditor = get$9(editor.uid)?.newState;
|
|
22301
22310
|
if (!currentEditor || currentEditor.uri !== editor.uri || currentEditor.languageId !== 'markdown') {
|
|
22302
22311
|
try {
|
|
22303
22312
|
await invoke$a(editor.applicationId, 'FileSystem.remove', savedImage.uri);
|
|
@@ -23061,7 +23070,7 @@ const paddingLeft = 8;
|
|
|
23061
23070
|
const paddingRight = 8;
|
|
23062
23071
|
const getSignatureHelpInfo = async editorUid => {
|
|
23063
23072
|
number(editorUid);
|
|
23064
|
-
const instance = get$
|
|
23073
|
+
const instance = get$9(editorUid);
|
|
23065
23074
|
const editor = instance.newState;
|
|
23066
23075
|
const {
|
|
23067
23076
|
selections
|
|
@@ -23179,7 +23188,7 @@ const newStateGenerator = async (state, parentUid) => {
|
|
|
23179
23188
|
} = state;
|
|
23180
23189
|
const {
|
|
23181
23190
|
newState
|
|
23182
|
-
} = get$
|
|
23191
|
+
} = get$9(parentUid);
|
|
23183
23192
|
const {
|
|
23184
23193
|
languageId
|
|
23185
23194
|
} = newState;
|
|
@@ -24920,7 +24929,7 @@ const getEditorSourceActions = async editorId => {
|
|
|
24920
24929
|
}
|
|
24921
24930
|
const {
|
|
24922
24931
|
newState
|
|
24923
|
-
} = get$
|
|
24932
|
+
} = get$9(editorId);
|
|
24924
24933
|
const extensions = await invoke$9(newState.applicationId, 'Extensions.getAllExtensions', newState.assetDir, newState.platform);
|
|
24925
24934
|
return extensions.filter(extension => !extension.disabled).flatMap(extension => extension.codeActions || []).filter(action => action.languageId === newState.languageId);
|
|
24926
24935
|
};
|
|
@@ -25014,13 +25023,13 @@ const getSelections2 = editorUid => {
|
|
|
25014
25023
|
return selections;
|
|
25015
25024
|
};
|
|
25016
25025
|
const setSelections2 = async (editorUid, selections, reveal = true) => {
|
|
25017
|
-
const requested = get$
|
|
25026
|
+
const requested = get$9(editorUid);
|
|
25018
25027
|
if (!requested || requested.newState.lifecycle?.disposed) {
|
|
25019
25028
|
return;
|
|
25020
25029
|
}
|
|
25021
25030
|
const requestedLifecycle = requested.newState.lifecycle;
|
|
25022
25031
|
await enqueue(editorUid, async () => {
|
|
25023
|
-
const instance = get$
|
|
25032
|
+
const instance = get$9(editorUid);
|
|
25024
25033
|
if (!instance || instance.newState.lifecycle?.disposed || instance.newState.lifecycle !== requestedLifecycle) {
|
|
25025
25034
|
return;
|
|
25026
25035
|
}
|
|
@@ -25033,11 +25042,11 @@ const setSelections2 = async (editorUid, selections, reveal = true) => {
|
|
|
25033
25042
|
selections
|
|
25034
25043
|
};
|
|
25035
25044
|
const newEditorWithDerivedState = await updateDerivedState(editor, newEditor);
|
|
25036
|
-
const current = get$
|
|
25045
|
+
const current = get$9(editorUid);
|
|
25037
25046
|
if (!current || lifecycle?.disposed || current.newState.lifecycle !== lifecycle) {
|
|
25038
25047
|
return;
|
|
25039
25048
|
}
|
|
25040
|
-
set$
|
|
25049
|
+
set$b(editorUid, current.oldState, newEditorWithDerivedState);
|
|
25041
25050
|
});
|
|
25042
25051
|
};
|
|
25043
25052
|
const closeWidget2 = async (editorUid, widgetId, widgetName, unsetAdditionalFocus$1) => {
|
|
@@ -25062,7 +25071,7 @@ const closeWidget2 = async (editorUid, widgetId, widgetName, unsetAdditionalFocu
|
|
|
25062
25071
|
widgets: newWidgets
|
|
25063
25072
|
};
|
|
25064
25073
|
const newEditorWithDerivedState = await updateDerivedState(editor, newEditor);
|
|
25065
|
-
set$
|
|
25074
|
+
set$b(editorUid, editor, newEditorWithDerivedState);
|
|
25066
25075
|
await setFocus(FocusEditorText);
|
|
25067
25076
|
if (unsetAdditionalFocus$1) {
|
|
25068
25077
|
await unsetAdditionalFocus(unsetAdditionalFocus$1);
|
|
@@ -25093,7 +25102,7 @@ const ensure = async (fontName, fontUrl) => {
|
|
|
25093
25102
|
const getComponentState = uid => {
|
|
25094
25103
|
const {
|
|
25095
25104
|
newState
|
|
25096
|
-
} = get$
|
|
25105
|
+
} = get$9(uid);
|
|
25097
25106
|
return {
|
|
25098
25107
|
...newState,
|
|
25099
25108
|
cursorUndoStack: newState.cursorUndoStack?.map(selection => [...selection]),
|
|
@@ -25597,7 +25606,7 @@ const getProblems = async () => {
|
|
|
25597
25606
|
const keys = getKeys$2();
|
|
25598
25607
|
const diagnostics = keys.flatMap(key => {
|
|
25599
25608
|
const numericKey = Number(key);
|
|
25600
|
-
const editor = get$
|
|
25609
|
+
const editor = get$9(numericKey);
|
|
25601
25610
|
if (!editor?.newState) {
|
|
25602
25611
|
return [];
|
|
25603
25612
|
}
|
|
@@ -25769,10 +25778,10 @@ const createCommandMap = commands => ({
|
|
|
25769
25778
|
if (typeof fn !== 'function') {
|
|
25770
25779
|
throw new TypeError(`Editor event command not found: ${command}`);
|
|
25771
25780
|
}
|
|
25772
|
-
const editor = get$
|
|
25781
|
+
const editor = get$9(uid)?.newState;
|
|
25773
25782
|
if (!editor) return;
|
|
25774
25783
|
await fn(uid, ...args);
|
|
25775
|
-
const current = get$
|
|
25784
|
+
const current = get$9(uid)?.newState;
|
|
25776
25785
|
if (!current || editor.lifecycle?.disposed || current.lifecycle !== editor.lifecycle) return;
|
|
25777
25786
|
// The wrapped command has released the document queue before requesting a
|
|
25778
25787
|
// render; a diff can now run without waiting on its own command.
|
|
@@ -25797,7 +25806,7 @@ const handleDirectMessagePort = async (port, commands) => {
|
|
|
25797
25806
|
commandMap: createCommandMap(commands),
|
|
25798
25807
|
messagePort: port
|
|
25799
25808
|
});
|
|
25800
|
-
set$
|
|
25809
|
+
set$5(rpc);
|
|
25801
25810
|
};
|
|
25802
25811
|
|
|
25803
25812
|
const getBreadcrumbFileIcon = async (uri, applicationId) => {
|
|
@@ -26180,7 +26189,7 @@ const restoreWidgetState = async (keys, savedStates) => {
|
|
|
26180
26189
|
const newEditors = [];
|
|
26181
26190
|
for (const key of keys) {
|
|
26182
26191
|
const editorUid = parseInt(key);
|
|
26183
|
-
const editor = get$
|
|
26192
|
+
const editor = get$9(editorUid);
|
|
26184
26193
|
if (!editor?.newState || !Array.isArray(editor.newState.widgets)) {
|
|
26185
26194
|
continue;
|
|
26186
26195
|
}
|
|
@@ -26233,7 +26242,7 @@ const saveSingleWidgetState = async (savedStates, key, widget) => {
|
|
|
26233
26242
|
const saveWidgetState = async keys => {
|
|
26234
26243
|
const savedStates = Object.create(null);
|
|
26235
26244
|
for (const key of keys) {
|
|
26236
|
-
const editor = get$
|
|
26245
|
+
const editor = get$9(parseInt(key));
|
|
26237
26246
|
if (!editor?.newState || !Array.isArray(editor.newState.widgets)) {
|
|
26238
26247
|
continue;
|
|
26239
26248
|
}
|
|
@@ -26262,7 +26271,7 @@ const hotReload = async () => {
|
|
|
26262
26271
|
await relaunchWorkers();
|
|
26263
26272
|
const newEditors = await restoreWidgetState(keys, savedStates);
|
|
26264
26273
|
for (const editor of newEditors) {
|
|
26265
|
-
set$
|
|
26274
|
+
set$b(editor.newState.uid, editor.oldState, editor.newState);
|
|
26266
26275
|
}
|
|
26267
26276
|
|
|
26268
26277
|
// TODO ask renderer worker to rerender all editors
|
|
@@ -26300,7 +26309,7 @@ const initializeSyntaxHighlighting = async (syntaxHighlightingEnabled, syncIncre
|
|
|
26300
26309
|
if (syntaxHighlightingEnabled) {
|
|
26301
26310
|
setEnabled$1(true);
|
|
26302
26311
|
const syntaxRpc = await createSyntaxHighlightingWorkerRpc();
|
|
26303
|
-
set$
|
|
26312
|
+
set$9(syntaxRpc);
|
|
26304
26313
|
}
|
|
26305
26314
|
if (syncIncremental) {
|
|
26306
26315
|
setEnabled(true);
|
|
@@ -26576,7 +26585,7 @@ const loadContent = async (state, savedState, largeFile = false, focus = true, f
|
|
|
26576
26585
|
let existingEditor;
|
|
26577
26586
|
if (!forceReload) {
|
|
26578
26587
|
for (const key of getKeys$2()) {
|
|
26579
|
-
const editor = get$
|
|
26588
|
+
const editor = get$9(Number(key))?.newState;
|
|
26580
26589
|
if (editor && editor.id !== id && !editor.initial && editor.uri === uri && editor.applicationId === state.applicationId) {
|
|
26581
26590
|
existingEditor = editor;
|
|
26582
26591
|
break;
|
|
@@ -26761,14 +26770,14 @@ const refreshGutterDecorations = async editor => {
|
|
|
26761
26770
|
};
|
|
26762
26771
|
const refreshGutterDecorationsAll = async () => {
|
|
26763
26772
|
for (const key of getKeys$2()) {
|
|
26764
|
-
const editor = get$
|
|
26773
|
+
const editor = get$9(Number(key))?.newState;
|
|
26765
26774
|
if (editor) {
|
|
26766
26775
|
const refreshedEditor = await refreshGutterDecorations(editor);
|
|
26767
|
-
const latest = get$
|
|
26776
|
+
const latest = get$9(editor.id);
|
|
26768
26777
|
if (!latest) {
|
|
26769
26778
|
continue;
|
|
26770
26779
|
}
|
|
26771
|
-
set$
|
|
26780
|
+
set$b(editor.id, latest.oldState, {
|
|
26772
26781
|
...latest.newState,
|
|
26773
26782
|
gutterDecorations: refreshedEditor.gutterDecorations
|
|
26774
26783
|
});
|
|
@@ -28145,7 +28154,7 @@ const applyRender = (oldState, newState, diffResult) => {
|
|
|
28145
28154
|
};
|
|
28146
28155
|
|
|
28147
28156
|
const render2 = (uid, _diffResult) => {
|
|
28148
|
-
const editor = get$
|
|
28157
|
+
const editor = get$9(uid);
|
|
28149
28158
|
if (!editor) {
|
|
28150
28159
|
return [];
|
|
28151
28160
|
}
|
|
@@ -28155,7 +28164,7 @@ const render2 = (uid, _diffResult) => {
|
|
|
28155
28164
|
} = editor;
|
|
28156
28165
|
// Diagnostics can change after the caller calculated its diff in a separate RPC.
|
|
28157
28166
|
const diffResult = diff(oldState, newState);
|
|
28158
|
-
set$
|
|
28167
|
+
set$b(uid, newState, newState);
|
|
28159
28168
|
const commands = applyRender(oldState, newState, diffResult);
|
|
28160
28169
|
return commands;
|
|
28161
28170
|
};
|
|
@@ -28163,7 +28172,7 @@ const render2 = (uid, _diffResult) => {
|
|
|
28163
28172
|
const queues = new Map();
|
|
28164
28173
|
const focusCommands = new Set(['Viewlet.focus', 'Viewlet.focusSelector', 'Viewlet.setFocusContext', 'Viewlet.setAdditionalFocus', 'Viewlet.unsetAdditionalFocus']);
|
|
28165
28174
|
const renderDirect = async (uid, preserveFocus) => {
|
|
28166
|
-
const instance = get$
|
|
28175
|
+
const instance = get$9(uid);
|
|
28167
28176
|
if (!instance) return [];
|
|
28168
28177
|
const {
|
|
28169
28178
|
newState,
|
|
@@ -28187,17 +28196,17 @@ const renderDirect = async (uid, preserveFocus) => {
|
|
|
28187
28196
|
}
|
|
28188
28197
|
return result;
|
|
28189
28198
|
} catch (error) {
|
|
28190
|
-
const latest = get$
|
|
28199
|
+
const latest = get$9(uid);
|
|
28191
28200
|
if (latest?.newState.lifecycle === newState.lifecycle && latest.oldState === newState) {
|
|
28192
28201
|
// A rejected queue RPC must not acknowledge patches that never arrived.
|
|
28193
|
-
set$
|
|
28202
|
+
set$b(uid, oldState, latest.newState);
|
|
28194
28203
|
if (oldDom) set$1(uid, oldDom, oldPaths);else dispose$2(uid);
|
|
28195
28204
|
}
|
|
28196
28205
|
throw error;
|
|
28197
28206
|
}
|
|
28198
28207
|
};
|
|
28199
28208
|
const renderDirect2 = async (uid, preserveFocus = false) => {
|
|
28200
|
-
const lifecycle = get$
|
|
28209
|
+
const lifecycle = get$9(uid)?.newState.lifecycle;
|
|
28201
28210
|
const previous = queues.get(uid);
|
|
28202
28211
|
const {
|
|
28203
28212
|
promise,
|
|
@@ -28206,7 +28215,7 @@ const renderDirect2 = async (uid, preserveFocus = false) => {
|
|
|
28206
28215
|
queues.set(uid, promise);
|
|
28207
28216
|
if (previous) await previous;
|
|
28208
28217
|
try {
|
|
28209
|
-
if (get$
|
|
28218
|
+
if (get$9(uid)?.newState.lifecycle !== lifecycle) return [];
|
|
28210
28219
|
return await renderDirect(uid, preserveFocus);
|
|
28211
28220
|
} finally {
|
|
28212
28221
|
resolve();
|
|
@@ -28311,7 +28320,7 @@ const renderWidgets = {
|
|
|
28311
28320
|
};
|
|
28312
28321
|
const render$7 = [renderLines, renderSelections, renderCss, renderFocus$1, renderDecorations, renderGutterInfo, renderWidgets, renderFocusContext, renderAdditionalFocusContext];
|
|
28313
28322
|
const renderEditor = async id => {
|
|
28314
|
-
const instance = get$
|
|
28323
|
+
const instance = get$9(id);
|
|
28315
28324
|
if (!instance) {
|
|
28316
28325
|
return [];
|
|
28317
28326
|
}
|
|
@@ -28320,7 +28329,7 @@ const renderEditor = async id => {
|
|
|
28320
28329
|
oldState
|
|
28321
28330
|
} = instance;
|
|
28322
28331
|
const commands = [];
|
|
28323
|
-
set$
|
|
28332
|
+
set$b(id, newState, newState);
|
|
28324
28333
|
for (const item of render$7) {
|
|
28325
28334
|
if (item.isEqual(oldState, newState)) {
|
|
28326
28335
|
continue;
|
|
@@ -28651,7 +28660,7 @@ const getKey = () => {
|
|
|
28651
28660
|
const updateDebugInfo = async debugId => {
|
|
28652
28661
|
const newInfo = await getDebugHighlight(debugId);
|
|
28653
28662
|
const key = getKey();
|
|
28654
|
-
const instance = get$
|
|
28663
|
+
const instance = get$9(key);
|
|
28655
28664
|
if (!instance) {
|
|
28656
28665
|
return;
|
|
28657
28666
|
}
|
|
@@ -28663,7 +28672,7 @@ const updateDebugInfo = async debugId => {
|
|
|
28663
28672
|
...newState,
|
|
28664
28673
|
highlightedLine: newInfo.rowIndex
|
|
28665
28674
|
};
|
|
28666
|
-
set$
|
|
28675
|
+
set$b(key, oldState, newEditor);
|
|
28667
28676
|
// @ts-ignore
|
|
28668
28677
|
await invoke$e('Editor.rerender', key);
|
|
28669
28678
|
};
|
|
@@ -28717,7 +28726,7 @@ const wrapTypingCommand = (fn, shouldOpenCompletion, shouldDismissHover, preserv
|
|
|
28717
28726
|
clear$3(uid);
|
|
28718
28727
|
}
|
|
28719
28728
|
await command(uid, ...args);
|
|
28720
|
-
const editor = get$
|
|
28729
|
+
const editor = get$9(uid)?.newState;
|
|
28721
28730
|
if (editor && (shouldOpenCompletion(...args) && shouldOpenAutomaticCompletion(editor) || editor.widgets?.some(widget => widget.id === Completion && widget.newState.automatic))) {
|
|
28722
28731
|
void updateAutomaticCompletionDeferred(uid).then(() => invoke$e('Editor.renderPending', uid)).catch(error => handleError$1(error, 'Failed to open completion widget: '));
|
|
28723
28732
|
}
|
|
@@ -28867,6 +28876,7 @@ const commandMap = {
|
|
|
28867
28876
|
'Editor.handleTripleClick': wrapCommand(handleTripleClick),
|
|
28868
28877
|
'Editor.handleUriChange': wrapCommand(handleUriChange),
|
|
28869
28878
|
'Editor.handleWheel': wrapCommand(handleWheel$2),
|
|
28879
|
+
'Editor.hasCachedCharacterWidth': has$1,
|
|
28870
28880
|
'Editor.hotReload': hotReload,
|
|
28871
28881
|
'Editor.incrementSelection': wrapCommand(incrementSelection),
|
|
28872
28882
|
'Editor.indendLess': wrapCommand(indentLess),
|
|
@@ -29466,15 +29476,15 @@ const EditorMessageWidget = {
|
|
|
29466
29476
|
};
|
|
29467
29477
|
|
|
29468
29478
|
const registerWidgets = () => {
|
|
29469
|
-
set$
|
|
29470
|
-
set$
|
|
29471
|
-
set$
|
|
29472
|
-
set$
|
|
29473
|
-
set$
|
|
29474
|
-
set$
|
|
29475
|
-
set$
|
|
29476
|
-
set$
|
|
29477
|
-
set$
|
|
29479
|
+
set$a(ColorPicker$2, EditorColorPickerWidget);
|
|
29480
|
+
set$a(Completion, EditorCompletionWidget);
|
|
29481
|
+
set$a(CompletionDetail, EditorCompletionDetailWidget);
|
|
29482
|
+
set$a(Find, EditorFindWidget);
|
|
29483
|
+
set$a(Hover, EditorHoverWidget);
|
|
29484
|
+
set$a(Message, EditorMessageWidget);
|
|
29485
|
+
set$a(Rename$1, EditorRenameWidget);
|
|
29486
|
+
set$a(SourceAction$1, EditorSourceActionWidget);
|
|
29487
|
+
set$a(CodeGenerator, EditorCodeGeneratorWidget);
|
|
29478
29488
|
};
|
|
29479
29489
|
|
|
29480
29490
|
const handleUnhandledRejection = event => {
|