@lvce-editor/editor-worker 19.70.5 → 19.70.7
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/editorWorkerMain.js +282 -207
- package/dist/settings.json +10 -0
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -1187,7 +1187,7 @@ const createMockRpc = ({
|
|
|
1187
1187
|
};
|
|
1188
1188
|
|
|
1189
1189
|
const rpcs = Object.create(null);
|
|
1190
|
-
const set$
|
|
1190
|
+
const set$j = (id, rpc) => {
|
|
1191
1191
|
rpcs[id] = rpc;
|
|
1192
1192
|
};
|
|
1193
1193
|
const get$9 = id => {
|
|
@@ -1220,7 +1220,7 @@ const create$c = rpcId => {
|
|
|
1220
1220
|
const mockRpc = createMockRpc({
|
|
1221
1221
|
commandMap
|
|
1222
1222
|
});
|
|
1223
|
-
set$
|
|
1223
|
+
set$j(rpcId, mockRpc);
|
|
1224
1224
|
// @ts-ignore
|
|
1225
1225
|
mockRpc[Symbol.dispose] = () => {
|
|
1226
1226
|
remove$8(rpcId);
|
|
@@ -1229,7 +1229,7 @@ const create$c = rpcId => {
|
|
|
1229
1229
|
return mockRpc;
|
|
1230
1230
|
},
|
|
1231
1231
|
set(rpc) {
|
|
1232
|
-
set$
|
|
1232
|
+
set$j(rpcId, rpc);
|
|
1233
1233
|
}
|
|
1234
1234
|
};
|
|
1235
1235
|
};
|
|
@@ -1328,23 +1328,23 @@ const FocusEditorText$1 = 12;
|
|
|
1328
1328
|
|
|
1329
1329
|
const {
|
|
1330
1330
|
invoke: invoke$j,
|
|
1331
|
-
set: set$
|
|
1331
|
+
set: set$i
|
|
1332
1332
|
} = create$c(DialogWorker);
|
|
1333
1333
|
|
|
1334
1334
|
const {
|
|
1335
1335
|
invoke: invoke$i,
|
|
1336
|
-
set: set$
|
|
1336
|
+
set: set$h
|
|
1337
1337
|
} = create$c(DragAndDropWorker);
|
|
1338
1338
|
|
|
1339
1339
|
const {
|
|
1340
1340
|
invoke: invoke$h,
|
|
1341
|
-
set: set$
|
|
1341
|
+
set: set$g
|
|
1342
1342
|
} = create$c(ErrorWorker);
|
|
1343
1343
|
|
|
1344
1344
|
const {
|
|
1345
1345
|
invoke: invoke$g,
|
|
1346
1346
|
invokeAndTransfer: invokeAndTransfer$2,
|
|
1347
|
-
set: set$
|
|
1347
|
+
set: set$f
|
|
1348
1348
|
} = create$c(ExtensionManagementWorker);
|
|
1349
1349
|
const getLanguages$1 = (platform, assetDir) => {
|
|
1350
1350
|
return invoke$g('Extensions.getLanguages', platform, assetDir);
|
|
@@ -1363,7 +1363,7 @@ const createLazyRpc = rpcId => {
|
|
|
1363
1363
|
throw new Error('Lazy RPC launch was superseded');
|
|
1364
1364
|
}
|
|
1365
1365
|
activeRpc = rpc;
|
|
1366
|
-
set$
|
|
1366
|
+
set$j(rpcId, rpc);
|
|
1367
1367
|
return rpc;
|
|
1368
1368
|
};
|
|
1369
1369
|
const ensureRpc = async () => {
|
|
@@ -1425,7 +1425,7 @@ const createLazyRpc = rpcId => {
|
|
|
1425
1425
|
|
|
1426
1426
|
const {
|
|
1427
1427
|
invoke: invoke$f,
|
|
1428
|
-
set: set$
|
|
1428
|
+
set: set$e
|
|
1429
1429
|
} = create$c(OpenerWorker);
|
|
1430
1430
|
const openUrl = async (url, platform) => {
|
|
1431
1431
|
return invoke$f('Open.openUrl', url, platform);
|
|
@@ -1433,13 +1433,13 @@ const openUrl = async (url, platform) => {
|
|
|
1433
1433
|
|
|
1434
1434
|
const {
|
|
1435
1435
|
invoke: invoke$e,
|
|
1436
|
-
set: set$
|
|
1436
|
+
set: set$d
|
|
1437
1437
|
} = create$c(TextMeasurementWorker);
|
|
1438
1438
|
|
|
1439
1439
|
const {
|
|
1440
1440
|
invoke: invoke$d,
|
|
1441
1441
|
invokeAndTransfer: invokeAndTransfer$1,
|
|
1442
|
-
set: set$
|
|
1442
|
+
set: set$c
|
|
1443
1443
|
} = create$c(RendererWorker);
|
|
1444
1444
|
const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
1445
1445
|
number(uid);
|
|
@@ -1494,13 +1494,13 @@ const sendMessagePortToSyntaxHighlightingWorker$1 = async port => {
|
|
|
1494
1494
|
|
|
1495
1495
|
const {
|
|
1496
1496
|
invoke: invoke$c,
|
|
1497
|
-
set: set$
|
|
1497
|
+
set: set$b
|
|
1498
1498
|
} = create$c(MarkdownWorker);
|
|
1499
1499
|
|
|
1500
1500
|
const SyntaxHighlightingWorker = {
|
|
1501
1501
|
__proto__: null,
|
|
1502
1502
|
invoke: invoke$c,
|
|
1503
|
-
set: set$
|
|
1503
|
+
set: set$b
|
|
1504
1504
|
};
|
|
1505
1505
|
|
|
1506
1506
|
const toCommandId = key => {
|
|
@@ -1811,7 +1811,7 @@ const getKeys$2 = () => {
|
|
|
1811
1811
|
const keys = editorStates.getKeys();
|
|
1812
1812
|
return keys.map(String);
|
|
1813
1813
|
};
|
|
1814
|
-
const set$
|
|
1814
|
+
const set$a = (id, oldEditor, newEditor) => {
|
|
1815
1815
|
editorStates.set(id, oldEditor, newEditor);
|
|
1816
1816
|
};
|
|
1817
1817
|
|
|
@@ -1862,7 +1862,7 @@ const ToggleBlockComment$1 = 'toggleBlockComment';
|
|
|
1862
1862
|
const Unknown$2 = 'unknown';
|
|
1863
1863
|
|
|
1864
1864
|
const map$1 = Object.create(null);
|
|
1865
|
-
const set$
|
|
1865
|
+
const set$9 = (id, widget) => {
|
|
1866
1866
|
map$1[id] = widget;
|
|
1867
1867
|
};
|
|
1868
1868
|
const get$7 = id => {
|
|
@@ -2506,7 +2506,7 @@ const getEnabled$1 = () => {
|
|
|
2506
2506
|
|
|
2507
2507
|
const {
|
|
2508
2508
|
invoke: invoke$b,
|
|
2509
|
-
set: set$
|
|
2509
|
+
set: set$8
|
|
2510
2510
|
} = SyntaxHighlightingWorker;
|
|
2511
2511
|
|
|
2512
2512
|
const state$c = {
|
|
@@ -2517,7 +2517,7 @@ const state$c = {
|
|
|
2517
2517
|
const has = languageId => {
|
|
2518
2518
|
return Object.hasOwn(state$c.tokenizers, languageId);
|
|
2519
2519
|
};
|
|
2520
|
-
const set$
|
|
2520
|
+
const set$7 = (languageId, tokenizer) => {
|
|
2521
2521
|
state$c.tokenizers[languageId] = tokenizer;
|
|
2522
2522
|
};
|
|
2523
2523
|
const get$6 = languageId => {
|
|
@@ -2541,7 +2541,7 @@ const isPending = languageId => {
|
|
|
2541
2541
|
};
|
|
2542
2542
|
|
|
2543
2543
|
const tokenMaps = Object.create(null);
|
|
2544
|
-
const set$
|
|
2544
|
+
const set$6 = (languageId, tokenMap) => {
|
|
2545
2545
|
tokenMaps[languageId] = tokenMap;
|
|
2546
2546
|
};
|
|
2547
2547
|
const get$5 = languageId => {
|
|
@@ -2557,7 +2557,7 @@ const loadTokenizer = async (languageId, tokenizePath) => {
|
|
|
2557
2557
|
if (getEnabled$1()) {
|
|
2558
2558
|
// @ts-ignore
|
|
2559
2559
|
const tokenMap = await invoke$b('Tokenizer.load', languageId, tokenizePath);
|
|
2560
|
-
set$
|
|
2560
|
+
set$6(languageId, tokenMap);
|
|
2561
2561
|
return;
|
|
2562
2562
|
}
|
|
2563
2563
|
try {
|
|
@@ -2573,8 +2573,8 @@ const loadTokenizer = async (languageId, tokenizePath) => {
|
|
|
2573
2573
|
console.warn(`tokenizer.TokenMap should be an object in "${tokenizePath}"`);
|
|
2574
2574
|
return;
|
|
2575
2575
|
}
|
|
2576
|
-
set$
|
|
2577
|
-
set$
|
|
2576
|
+
set$6(languageId, tokenizer.TokenMap);
|
|
2577
|
+
set$7(languageId, tokenizer);
|
|
2578
2578
|
} catch (error) {
|
|
2579
2579
|
// TODO better error handling
|
|
2580
2580
|
console.error(error);
|
|
@@ -2591,7 +2591,7 @@ const getTokenizer = languageId => {
|
|
|
2591
2591
|
};
|
|
2592
2592
|
|
|
2593
2593
|
const tokenizers = Object.create(null);
|
|
2594
|
-
const set$
|
|
2594
|
+
const set$5 = (id, value) => {
|
|
2595
2595
|
tokenizers[id] = value;
|
|
2596
2596
|
};
|
|
2597
2597
|
const get$4 = id => {
|
|
@@ -4390,7 +4390,7 @@ const scheduleDocumentAndCursorsSelections = async (editor, changes, selectionCh
|
|
|
4390
4390
|
...newEditor,
|
|
4391
4391
|
decorations: linkDecorations
|
|
4392
4392
|
};
|
|
4393
|
-
set$
|
|
4393
|
+
set$a(editor.uid, editor, newEditorWithDecorations);
|
|
4394
4394
|
|
|
4395
4395
|
// Notify main-area-worker about modified status change
|
|
4396
4396
|
if (!editor.modified) {
|
|
@@ -5273,7 +5273,7 @@ const updateColorPickerValue = async (editorUid, value) => {
|
|
|
5273
5273
|
return;
|
|
5274
5274
|
}
|
|
5275
5275
|
const newEditorWithDerivedState = await updateDerivedState(editor, newEditor);
|
|
5276
|
-
set$
|
|
5276
|
+
set$a(editorUid, editor, newEditorWithDerivedState);
|
|
5277
5277
|
};
|
|
5278
5278
|
|
|
5279
5279
|
const getColorPickerWorkerCommandMap = () => ({
|
|
@@ -5484,7 +5484,7 @@ const createEditor2 = (id, uri, x, y, width, height, platform, assetDir, _langua
|
|
|
5484
5484
|
x,
|
|
5485
5485
|
y
|
|
5486
5486
|
};
|
|
5487
|
-
set$
|
|
5487
|
+
set$a(id, editor, editor);
|
|
5488
5488
|
};
|
|
5489
5489
|
|
|
5490
5490
|
const emptyEditor = {
|
|
@@ -5827,10 +5827,10 @@ const createEditor = async ({
|
|
|
5827
5827
|
focused: true,
|
|
5828
5828
|
textInfos
|
|
5829
5829
|
};
|
|
5830
|
-
set$
|
|
5830
|
+
set$a(id, emptyEditor, newEditor4);
|
|
5831
5831
|
const completionsOnTypeRaw = await get$3('editor.completionsOnType');
|
|
5832
5832
|
const completionsOnType = Boolean(completionsOnTypeRaw);
|
|
5833
|
-
set$
|
|
5833
|
+
set$a(id, emptyEditor, {
|
|
5834
5834
|
...newEditor4,
|
|
5835
5835
|
completionsOnType
|
|
5836
5836
|
});
|
|
@@ -5861,7 +5861,7 @@ const createStandaloneEditor = async ({
|
|
|
5861
5861
|
const createdEditor = get$8(id).newState;
|
|
5862
5862
|
await loadTokenizer(languageId, tokenizePath);
|
|
5863
5863
|
const tokenizerId = createdEditor.tokenizerId + 1;
|
|
5864
|
-
set$
|
|
5864
|
+
set$5(tokenizerId, getTokenizer(languageId));
|
|
5865
5865
|
const configuredEditor = {
|
|
5866
5866
|
...createdEditor,
|
|
5867
5867
|
charWidth,
|
|
@@ -5906,7 +5906,7 @@ const createStandaloneEditor = async ({
|
|
|
5906
5906
|
selectionInfos
|
|
5907
5907
|
};
|
|
5908
5908
|
if (!createdEditor.lifecycle?.disposed) {
|
|
5909
|
-
set$
|
|
5909
|
+
set$a(id, createdEditor, finalEditor);
|
|
5910
5910
|
}
|
|
5911
5911
|
};
|
|
5912
5912
|
|
|
@@ -6019,17 +6019,17 @@ const dispose$4 = uid => {
|
|
|
6019
6019
|
pendingSaves.delete(uid);
|
|
6020
6020
|
};
|
|
6021
6021
|
|
|
6022
|
-
const dismissals = new Map();
|
|
6023
|
-
const clear$
|
|
6024
|
-
const dismissal = dismissals.get(editorUid);
|
|
6022
|
+
const dismissals$1 = new Map();
|
|
6023
|
+
const clear$3 = editorUid => {
|
|
6024
|
+
const dismissal = dismissals$1.get(editorUid);
|
|
6025
6025
|
if (dismissal) {
|
|
6026
6026
|
clearTimeout(dismissal.timeout);
|
|
6027
|
-
dismissals.delete(editorUid);
|
|
6027
|
+
dismissals$1.delete(editorUid);
|
|
6028
6028
|
}
|
|
6029
6029
|
};
|
|
6030
|
-
const set$
|
|
6031
|
-
clear$
|
|
6032
|
-
dismissals.set(editorUid, dismissal);
|
|
6030
|
+
const set$4 = (editorUid, dismissal) => {
|
|
6031
|
+
clear$3(editorUid);
|
|
6032
|
+
dismissals$1.set(editorUid, dismissal);
|
|
6033
6033
|
};
|
|
6034
6034
|
|
|
6035
6035
|
const state$6 = {
|
|
@@ -6042,14 +6042,14 @@ const state$6 = {
|
|
|
6042
6042
|
const get$2 = () => {
|
|
6043
6043
|
return state$6;
|
|
6044
6044
|
};
|
|
6045
|
-
const set$
|
|
6045
|
+
const set$3 = (editor, timeout, x, y, token) => {
|
|
6046
6046
|
state$6.editor = editor;
|
|
6047
6047
|
state$6.timeout = timeout;
|
|
6048
6048
|
state$6.token = token;
|
|
6049
6049
|
state$6.x = x;
|
|
6050
6050
|
state$6.y = y;
|
|
6051
6051
|
};
|
|
6052
|
-
const clear$
|
|
6052
|
+
const clear$2 = editorUid => {
|
|
6053
6053
|
const {
|
|
6054
6054
|
editor,
|
|
6055
6055
|
timeout
|
|
@@ -6065,6 +6065,20 @@ const clear$1 = editorUid => {
|
|
|
6065
6065
|
state$6.token++;
|
|
6066
6066
|
};
|
|
6067
6067
|
|
|
6068
|
+
const dismissals = new Map();
|
|
6069
|
+
const clear$1 = editorUid => {
|
|
6070
|
+
const dismissal = dismissals.get(editorUid);
|
|
6071
|
+
if (!dismissal) {
|
|
6072
|
+
return;
|
|
6073
|
+
}
|
|
6074
|
+
clearTimeout(dismissal.timeout);
|
|
6075
|
+
dismissals.delete(editorUid);
|
|
6076
|
+
};
|
|
6077
|
+
const set$2 = (editorUid, dismissal) => {
|
|
6078
|
+
clear$1(editorUid);
|
|
6079
|
+
dismissals.set(editorUid, dismissal);
|
|
6080
|
+
};
|
|
6081
|
+
|
|
6068
6082
|
const getOffset = (lines, rowIndex, columnIndex) => {
|
|
6069
6083
|
let offset = columnIndex;
|
|
6070
6084
|
for (let i = 0; i < rowIndex; i++) {
|
|
@@ -6436,7 +6450,7 @@ const commitDiagnostics = async (editor, generation, diagnostics, onAccepted) =>
|
|
|
6436
6450
|
return latest.newState;
|
|
6437
6451
|
}
|
|
6438
6452
|
const newEditor = mergeDiagnostics(latest.newState, editorWithDiagnostics);
|
|
6439
|
-
set$
|
|
6453
|
+
set$a(editor.id, latest.oldState, newEditor);
|
|
6440
6454
|
requestDiagnosticSnapshots.set(editor.id, diagnostics);
|
|
6441
6455
|
onAccepted?.();
|
|
6442
6456
|
await invoke$5('Editor.renderPending', newEditor.id);
|
|
@@ -6649,8 +6663,9 @@ const disposeEditor = async editorUid => {
|
|
|
6649
6663
|
}
|
|
6650
6664
|
dispose$2(editorUid);
|
|
6651
6665
|
dispose$4(editorUid);
|
|
6652
|
-
clear$1(editorUid);
|
|
6653
6666
|
clear$2(editorUid);
|
|
6667
|
+
clear$3(editorUid);
|
|
6668
|
+
clear$1(editorUid);
|
|
6654
6669
|
dispose$1(editorUid);
|
|
6655
6670
|
const pending = [];
|
|
6656
6671
|
if (getEnabled$1()) {
|
|
@@ -7308,6 +7323,20 @@ const create$8 = () => {
|
|
|
7308
7323
|
return state$5.nextId++;
|
|
7309
7324
|
};
|
|
7310
7325
|
|
|
7326
|
+
const getIndex = (widgets, id) => {
|
|
7327
|
+
for (const [i, widget] of widgets.entries()) {
|
|
7328
|
+
if (widget.id === id) {
|
|
7329
|
+
return i;
|
|
7330
|
+
}
|
|
7331
|
+
}
|
|
7332
|
+
return -1;
|
|
7333
|
+
};
|
|
7334
|
+
const removeEditorWidget = (widgets, id) => {
|
|
7335
|
+
const index = getIndex(widgets, id);
|
|
7336
|
+
const newWidgets = [...widgets.slice(0, index), ...widgets.slice(index + 1)];
|
|
7337
|
+
return newWidgets;
|
|
7338
|
+
};
|
|
7339
|
+
|
|
7311
7340
|
const Message = 9;
|
|
7312
7341
|
|
|
7313
7342
|
const getAccurateColumnIndexAscii = async (line, guess, averageCharWidth, eventX, fontWeight, fontSize, fontFamily, letterSpacing, isMonospaceFont, charWidth) => {
|
|
@@ -7452,21 +7481,32 @@ const at = async (editor, eventX, eventY) => {
|
|
|
7452
7481
|
};
|
|
7453
7482
|
|
|
7454
7483
|
/**
|
|
7455
|
-
* @deprecated this doesn't
|
|
7456
|
-
* Use position computation in renderer process instead
|
|
7457
|
-
*
|
|
7458
|
-
* @param {object} editor
|
|
7459
|
-
* @param {number} rowIndex
|
|
7460
|
-
* @param {number} columnIndex
|
|
7461
|
-
* @returns
|
|
7484
|
+
* @deprecated this doesn't account for variable-width characters, gutters, or horizontal scrolling.
|
|
7462
7485
|
*/
|
|
7463
7486
|
const x = (editor, rowIndex, columnIndex) => {
|
|
7464
7487
|
const {
|
|
7465
7488
|
columnWidth,
|
|
7466
7489
|
x
|
|
7467
7490
|
} = editor;
|
|
7468
|
-
|
|
7469
|
-
|
|
7491
|
+
return columnIndex * columnWidth + x;
|
|
7492
|
+
};
|
|
7493
|
+
const getCursorX = async (editor, rowIndex, columnIndex) => {
|
|
7494
|
+
const {
|
|
7495
|
+
charWidth,
|
|
7496
|
+
deltaX,
|
|
7497
|
+
fontFamily,
|
|
7498
|
+
fontSize,
|
|
7499
|
+
fontWeight,
|
|
7500
|
+
gutterWidth = 0,
|
|
7501
|
+
isMonospaceFont,
|
|
7502
|
+
letterSpacing,
|
|
7503
|
+
lines,
|
|
7504
|
+
tabSize,
|
|
7505
|
+
width,
|
|
7506
|
+
x
|
|
7507
|
+
} = editor;
|
|
7508
|
+
const textX = await getX(lines[rowIndex] || '', columnIndex, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, 0, width, charWidth);
|
|
7509
|
+
return x + gutterWidth + textX - deltaX;
|
|
7470
7510
|
};
|
|
7471
7511
|
const y = (editor, rowIndex) => {
|
|
7472
7512
|
const {
|
|
@@ -7478,6 +7518,8 @@ const y = (editor, rowIndex) => {
|
|
|
7478
7518
|
return offsetY;
|
|
7479
7519
|
};
|
|
7480
7520
|
|
|
7521
|
+
const defaultMessageDelay = 3000;
|
|
7522
|
+
|
|
7481
7523
|
/**
|
|
7482
7524
|
*
|
|
7483
7525
|
* @param {any} editor
|
|
@@ -7488,29 +7530,54 @@ const y = (editor, rowIndex) => {
|
|
|
7488
7530
|
* @returns
|
|
7489
7531
|
*/
|
|
7490
7532
|
// @ts-ignore
|
|
7491
|
-
const editorShowMessage = (editor, rowIndex, columnIndex, message, _isError) => {
|
|
7533
|
+
const editorShowMessage = async (editor, rowIndex, columnIndex, message, _isError) => {
|
|
7492
7534
|
object(editor);
|
|
7493
7535
|
number(rowIndex);
|
|
7494
7536
|
number(columnIndex);
|
|
7495
7537
|
string(message);
|
|
7496
|
-
const x
|
|
7538
|
+
const x = await getCursorX(editor, rowIndex, columnIndex);
|
|
7497
7539
|
const y$1 = y(editor, rowIndex);
|
|
7498
7540
|
const existingWidget = editor.widgets.find(widget => widget.id === Message);
|
|
7499
7541
|
const uid = existingWidget?.newState.uid ?? create$8();
|
|
7500
7542
|
const newState = {
|
|
7501
7543
|
message,
|
|
7502
7544
|
uid,
|
|
7503
|
-
x
|
|
7545
|
+
x,
|
|
7504
7546
|
y: y$1
|
|
7505
7547
|
};
|
|
7506
7548
|
const widget = {
|
|
7507
7549
|
id: Message,
|
|
7508
7550
|
newState
|
|
7509
7551
|
};
|
|
7510
|
-
|
|
7552
|
+
const newEditor = {
|
|
7511
7553
|
...editor,
|
|
7512
7554
|
widgets: [...editor.widgets.filter(item => item.id !== Message), widget]
|
|
7513
7555
|
};
|
|
7556
|
+
if (typeof editor.uid === 'number') {
|
|
7557
|
+
const timeout = setTimeout(async () => {
|
|
7558
|
+
clear$1(editor.uid);
|
|
7559
|
+
const latestInstance = get$8(editor.uid);
|
|
7560
|
+
if (!latestInstance) {
|
|
7561
|
+
return;
|
|
7562
|
+
}
|
|
7563
|
+
const latestEditor = latestInstance.newState;
|
|
7564
|
+
const latestWidget = latestEditor.widgets.find(item => item.id === Message);
|
|
7565
|
+
if (latestWidget?.newState.uid !== uid) {
|
|
7566
|
+
return;
|
|
7567
|
+
}
|
|
7568
|
+
const editorWithoutMessage = {
|
|
7569
|
+
...latestEditor,
|
|
7570
|
+
widgetRevision: next(editor.uid),
|
|
7571
|
+
widgets: removeEditorWidget(latestEditor.widgets, Message)
|
|
7572
|
+
};
|
|
7573
|
+
set$a(editor.uid, latestEditor, editorWithoutMessage);
|
|
7574
|
+
await invoke$d('Editor.renderPending', editor.uid);
|
|
7575
|
+
}, editor.messageDelay ?? defaultMessageDelay);
|
|
7576
|
+
set$2(editor.uid, {
|
|
7577
|
+
timeout
|
|
7578
|
+
});
|
|
7579
|
+
}
|
|
7580
|
+
return newEditor;
|
|
7514
7581
|
};
|
|
7515
7582
|
|
|
7516
7583
|
/**
|
|
@@ -7522,8 +7589,8 @@ const editorShowMessage = (editor, rowIndex, columnIndex, message, _isError) =>
|
|
|
7522
7589
|
* @returns
|
|
7523
7590
|
*/
|
|
7524
7591
|
// @ts-ignore
|
|
7525
|
-
const showErrorMessage = (editor, rowIndex, columnIndex, message) => {
|
|
7526
|
-
return editorShowMessage(editor, rowIndex, columnIndex, message);
|
|
7592
|
+
const showErrorMessage = async (editor, rowIndex, columnIndex, message) => {
|
|
7593
|
+
return await editorShowMessage(editor, rowIndex, columnIndex, message);
|
|
7527
7594
|
};
|
|
7528
7595
|
|
|
7529
7596
|
const expectedErrorMessage = 'Failed to execute formatting provider: FormattingError:';
|
|
@@ -7587,7 +7654,6 @@ const saveUntitledFile = async (uri, content, platform, applicationId) => {
|
|
|
7587
7654
|
}
|
|
7588
7655
|
await invoke$9(applicationId, 'FileSystem.writeFile', filePath, content);
|
|
7589
7656
|
await invoke$9(applicationId, 'Layout.handleWorkspaceRefresh');
|
|
7590
|
-
await invoke$9(applicationId, 'Main.handleUriChange', uri, filePath);
|
|
7591
7657
|
return filePath;
|
|
7592
7658
|
};
|
|
7593
7659
|
|
|
@@ -7616,7 +7682,7 @@ const showSaveErrorDialog = async error => {
|
|
|
7616
7682
|
});
|
|
7617
7683
|
};
|
|
7618
7684
|
|
|
7619
|
-
const save = async (editor, skipFormatting = false) => {
|
|
7685
|
+
const save$1 = async (editor, skipFormatting = false) => {
|
|
7620
7686
|
try {
|
|
7621
7687
|
const {
|
|
7622
7688
|
applicationId,
|
|
@@ -7692,7 +7758,7 @@ const handleBlur$1 = async editor => {
|
|
|
7692
7758
|
if (autoSave !== 'onFocusChange') {
|
|
7693
7759
|
return newEditor;
|
|
7694
7760
|
}
|
|
7695
|
-
return save(newEditor);
|
|
7761
|
+
return save$1(newEditor);
|
|
7696
7762
|
};
|
|
7697
7763
|
|
|
7698
7764
|
const replaceRange = (editor, ranges, replacement, origin) => {
|
|
@@ -7791,20 +7857,6 @@ const getCursorOffset = editor => {
|
|
|
7791
7857
|
return offsetAt(editor, editor.selections[0], editor.selections[1]);
|
|
7792
7858
|
};
|
|
7793
7859
|
|
|
7794
|
-
const getIndex = (widgets, id) => {
|
|
7795
|
-
for (const [i, widget] of widgets.entries()) {
|
|
7796
|
-
if (widget.id === id) {
|
|
7797
|
-
return i;
|
|
7798
|
-
}
|
|
7799
|
-
}
|
|
7800
|
-
return -1;
|
|
7801
|
-
};
|
|
7802
|
-
const removeEditorWidget = (widgets, id) => {
|
|
7803
|
-
const index = getIndex(widgets, id);
|
|
7804
|
-
const newWidgets = [...widgets.slice(0, index), ...widgets.slice(index + 1)];
|
|
7805
|
-
return newWidgets;
|
|
7806
|
-
};
|
|
7807
|
-
|
|
7808
7860
|
const cancelSelection = editor => {
|
|
7809
7861
|
const {
|
|
7810
7862
|
selections,
|
|
@@ -10193,14 +10245,14 @@ const handleMouseLeave = (viewletUid, editorUidValue) => {
|
|
|
10193
10245
|
const {
|
|
10194
10246
|
widgets = []
|
|
10195
10247
|
} = instance.newState;
|
|
10196
|
-
clear$1(editorUid);
|
|
10197
10248
|
clear$2(editorUid);
|
|
10249
|
+
clear$3(editorUid);
|
|
10198
10250
|
const hoverWidget = widgets.find(widget => widget.id === Hover);
|
|
10199
10251
|
if (!hoverWidget) {
|
|
10200
10252
|
return;
|
|
10201
10253
|
}
|
|
10202
10254
|
const timeout = setTimeout(async () => {
|
|
10203
|
-
clear$
|
|
10255
|
+
clear$3(editorUid);
|
|
10204
10256
|
const latestInstance = get$8(editorUid);
|
|
10205
10257
|
if (!latestInstance) {
|
|
10206
10258
|
return;
|
|
@@ -10218,16 +10270,16 @@ const handleMouseLeave = (viewletUid, editorUidValue) => {
|
|
|
10218
10270
|
widgetRevision: next(editorUid),
|
|
10219
10271
|
widgets: removeEditorWidget(latestEditor.widgets, Hover)
|
|
10220
10272
|
};
|
|
10221
|
-
set$
|
|
10273
|
+
set$a(editorUid, latestEditor, newEditor);
|
|
10222
10274
|
await invoke$d('Editor.renderPending', editorUid);
|
|
10223
10275
|
}, editorHoverDismissDelay);
|
|
10224
|
-
set$
|
|
10276
|
+
set$4(editorUid, {
|
|
10225
10277
|
timeout
|
|
10226
10278
|
});
|
|
10227
10279
|
};
|
|
10228
10280
|
const handleMouseEnter = (viewletUid, editorUidValue) => {
|
|
10229
10281
|
const targetEditorUid = editorUidValue ?? viewletUid;
|
|
10230
|
-
clear$
|
|
10282
|
+
clear$3(Number(targetEditorUid));
|
|
10231
10283
|
};
|
|
10232
10284
|
|
|
10233
10285
|
const RE_ALPHA_NUMERIC = /[a-zA-Z\d]/;
|
|
@@ -10651,7 +10703,7 @@ const showHover = async (editor, position, token) => {
|
|
|
10651
10703
|
if (latestEditor === newEditor || !latestInstance || latestInstance.newState !== latestEditor || get$2().token !== token) {
|
|
10652
10704
|
return;
|
|
10653
10705
|
}
|
|
10654
|
-
set$
|
|
10706
|
+
set$a(editor.uid, latestInstance.oldState, newEditor);
|
|
10655
10707
|
await invoke$d('Editor.renderPending', editor.uid);
|
|
10656
10708
|
};
|
|
10657
10709
|
|
|
@@ -10685,7 +10737,7 @@ const onHoverIdle = async token => {
|
|
|
10685
10737
|
}
|
|
10686
10738
|
};
|
|
10687
10739
|
const handleMouseMove = async (editor, x, y, altKey) => {
|
|
10688
|
-
clear$
|
|
10740
|
+
clear$2();
|
|
10689
10741
|
if (altKey) {
|
|
10690
10742
|
return handleMouseMoveWithAltKey(editor, x, y);
|
|
10691
10743
|
}
|
|
@@ -10695,7 +10747,7 @@ const handleMouseMove = async (editor, x, y, altKey) => {
|
|
|
10695
10747
|
}
|
|
10696
10748
|
const token = create$8();
|
|
10697
10749
|
const timeout = setTimeout(onHoverIdle, editorWithoutDefinitionLink.hoverDelay ?? 200, token);
|
|
10698
|
-
set$
|
|
10750
|
+
set$3(editorWithoutDefinitionLink, timeout, x, y, token);
|
|
10699
10751
|
return editorWithoutDefinitionLink;
|
|
10700
10752
|
};
|
|
10701
10753
|
|
|
@@ -10913,7 +10965,7 @@ const continueScrollingAndMovingSelection = async editorUid => {
|
|
|
10913
10965
|
}
|
|
10914
10966
|
return;
|
|
10915
10967
|
}
|
|
10916
|
-
set$
|
|
10968
|
+
set$a(editor.uid, editor, derivedEditor);
|
|
10917
10969
|
if (derivedEditor.hasListener) {
|
|
10918
10970
|
requestAnimationFrame(() => continueScrollingAndMovingSelection(editorUid));
|
|
10919
10971
|
}
|
|
@@ -11702,7 +11754,7 @@ const updateEditor = async (editorUid, editor, newEditor) => {
|
|
|
11702
11754
|
return;
|
|
11703
11755
|
}
|
|
11704
11756
|
const newEditorWithDerivedState = await updateDerivedState(editor, newEditor);
|
|
11705
|
-
set$
|
|
11757
|
+
set$a(editorUid, editor, newEditorWithDerivedState);
|
|
11706
11758
|
};
|
|
11707
11759
|
const applyDocumentEdits = async (editorUid, edits) => {
|
|
11708
11760
|
const editor = getEditor$1(editorUid);
|
|
@@ -11752,7 +11804,7 @@ const launch = async () => {
|
|
|
11752
11804
|
return;
|
|
11753
11805
|
}
|
|
11754
11806
|
const rpc = await launchFindWidgetWorker();
|
|
11755
|
-
set$
|
|
11807
|
+
set$j(rpcId, rpc);
|
|
11756
11808
|
};
|
|
11757
11809
|
const invoke$3 = async (method, ...params) => {
|
|
11758
11810
|
const rpc = get$9(rpcId);
|
|
@@ -11883,7 +11935,7 @@ const createFn = (key, name, widgetId) => {
|
|
|
11883
11935
|
const latestAfterInvoke = get$8(editor.uid).newState;
|
|
11884
11936
|
const latestChildIndex = latestAfterInvoke.widgets.findIndex(isWidget);
|
|
11885
11937
|
if (latestChildIndex === -1) {
|
|
11886
|
-
set$
|
|
11938
|
+
set$a(editor.uid, editor, latestAfterInvoke);
|
|
11887
11939
|
await dispose$3();
|
|
11888
11940
|
return latestAfterInvoke;
|
|
11889
11941
|
}
|
|
@@ -11897,7 +11949,7 @@ const createFn = (key, name, widgetId) => {
|
|
|
11897
11949
|
widgetRevision,
|
|
11898
11950
|
widgets: removeEditorWidget(latest.widgets, widgetId)
|
|
11899
11951
|
};
|
|
11900
|
-
set$
|
|
11952
|
+
set$a(editor.uid, latest, newEditor);
|
|
11901
11953
|
return newEditor;
|
|
11902
11954
|
}
|
|
11903
11955
|
const newState = {
|
|
@@ -11905,7 +11957,7 @@ const createFn = (key, name, widgetId) => {
|
|
|
11905
11957
|
commands
|
|
11906
11958
|
};
|
|
11907
11959
|
const newEditor = updateWidget(latest, widgetId, newState);
|
|
11908
|
-
set$
|
|
11960
|
+
set$a(editor.uid, editor, newEditor);
|
|
11909
11961
|
return newEditor;
|
|
11910
11962
|
};
|
|
11911
11963
|
return fn;
|
|
@@ -12935,7 +12987,7 @@ const setLanguageId = async (editor, languageId, tokenizePath, isExplicit = fals
|
|
|
12935
12987
|
await loadTokenizer(languageId, tokenizePath);
|
|
12936
12988
|
const tokenizer = getTokenizer(languageId);
|
|
12937
12989
|
const newTokenizerId = tokenizerId + 1;
|
|
12938
|
-
set$
|
|
12990
|
+
set$5(newTokenizerId, tokenizer);
|
|
12939
12991
|
return {
|
|
12940
12992
|
...editor,
|
|
12941
12993
|
explicitLanguageId: isExplicit ? languageId : editor.explicitLanguageId,
|
|
@@ -14940,7 +14992,7 @@ const setSelections2 = async (editorUid, selections) => {
|
|
|
14940
14992
|
const editor = getEditor$1(editorUid);
|
|
14941
14993
|
const newEditor = setSelections$2(editor, selections);
|
|
14942
14994
|
const newEditorWithDerivedState = await updateDerivedState(editor, newEditor);
|
|
14943
|
-
set$
|
|
14995
|
+
set$a(editorUid, editor, newEditorWithDerivedState);
|
|
14944
14996
|
};
|
|
14945
14997
|
const closeWidget2 = async (editorUid, widgetId, widgetName, unsetAdditionalFocus$1) => {
|
|
14946
14998
|
const editor = getEditor$1(editorUid);
|
|
@@ -14964,7 +15016,7 @@ const closeWidget2 = async (editorUid, widgetId, widgetName, unsetAdditionalFocu
|
|
|
14964
15016
|
widgets: newWidgets
|
|
14965
15017
|
};
|
|
14966
15018
|
const newEditorWithDerivedState = await updateDerivedState(editor, newEditor);
|
|
14967
|
-
set$
|
|
15019
|
+
set$a(editorUid, editor, newEditorWithDerivedState);
|
|
14968
15020
|
await setFocus(FocusEditorText);
|
|
14969
15021
|
if (unsetAdditionalFocus$1) {
|
|
14970
15022
|
await unsetAdditionalFocus(unsetAdditionalFocus$1);
|
|
@@ -14977,7 +15029,7 @@ const applyEdits2 = async (editorUid, edits, selectionChanges) => {
|
|
|
14977
15029
|
const editor = getEditor$1(editorUid);
|
|
14978
15030
|
const newEditor = await applyEdit(editor, edits, selectionChanges);
|
|
14979
15031
|
const newEditorWithDerivedState = await updateDerivedState(editor, newEditor);
|
|
14980
|
-
set$
|
|
15032
|
+
set$a(editorUid, editor, newEditorWithDerivedState);
|
|
14981
15033
|
};
|
|
14982
15034
|
const getSourceActions = async editorUid => {
|
|
14983
15035
|
const actions = await getEditorSourceActions(editorUid);
|
|
@@ -15651,7 +15703,7 @@ const handleMessagePort = async (port, rpcId) => {
|
|
|
15651
15703
|
messagePort: port
|
|
15652
15704
|
});
|
|
15653
15705
|
if (rpcId) {
|
|
15654
|
-
set$
|
|
15706
|
+
set$j(rpcId, rpc);
|
|
15655
15707
|
await initializeListener(rpcId);
|
|
15656
15708
|
}
|
|
15657
15709
|
};
|
|
@@ -15769,6 +15821,8 @@ const getMergeConflictActionsEnabled = async () => {
|
|
|
15769
15821
|
};
|
|
15770
15822
|
|
|
15771
15823
|
const DEFAULT_HOVER_DELAY = 200;
|
|
15824
|
+
const DEFAULT_MESSAGE_DELAY = 3000;
|
|
15825
|
+
const MAX_MESSAGE_DELAY = 10_000;
|
|
15772
15826
|
const getHoverDelay = value => {
|
|
15773
15827
|
const delay = typeof value === 'number' ? value : Number(value);
|
|
15774
15828
|
if (!Number.isFinite(delay) || delay < 0) {
|
|
@@ -15776,8 +15830,15 @@ const getHoverDelay = value => {
|
|
|
15776
15830
|
}
|
|
15777
15831
|
return delay;
|
|
15778
15832
|
};
|
|
15833
|
+
const getMessageDelay = value => {
|
|
15834
|
+
const delay = typeof value === 'number' ? value : Number(value);
|
|
15835
|
+
if (!Number.isFinite(delay) || delay < 0 || delay > MAX_MESSAGE_DELAY) {
|
|
15836
|
+
return DEFAULT_MESSAGE_DELAY;
|
|
15837
|
+
}
|
|
15838
|
+
return delay;
|
|
15839
|
+
};
|
|
15779
15840
|
const getEditorPreferences = async () => {
|
|
15780
|
-
const [diagnosticsEnabled, fontFamily, fontSize, fontWeight, formatOnSave, hoverEnabled, hoverDelay, isAutoClosingBracketsEnabled$1, isAutoClosingQuotesEnabled$1, isAutoClosingTagsEnabled$1, isQuickSuggestionsEnabled$1, lineNumbers, highlightActiveLineNumber, rowHeight, tabSize, letterSpacing, completionTriggerCharacters, minimapEnabled, mergeConflictActionsEnabled, breadcrumbsEnabled, insertSpaces, dragAndDropEnabled, roundedSelection, combineWhitespaceTokens] = await Promise.all([get$3('editor.diagnostics'), getFontFamily(), getFontSize(), getFontWeight(), get$3('editor.formatOnSave'), get$3('editor.hover'), get$3('editor.hoverDelay'), isAutoClosingBracketsEnabled(), isAutoClosingQuotesEnabled(), isAutoClosingTagsEnabled(), isQuickSuggestionsEnabled(), getLineNumbers(), getHighlightActiveLineNumber(), getRowHeight(), getTabSize(), getLetterSpacing(), getCompletionTriggerCharacters(), getMinimapEnabled(), getMergeConflictActionsEnabled(), get$3('breadcrumbs.enabled'), get$3('editor.insertSpaces'), get$3('editor.dragAndDrop'), get$3('editor.roundedSelection'), get$3('editor.combineWhitespaceTokens')]);
|
|
15841
|
+
const [diagnosticsEnabled, fontFamily, fontSize, fontWeight, formatOnSave, hoverEnabled, hoverDelay, messageDelay, isAutoClosingBracketsEnabled$1, isAutoClosingQuotesEnabled$1, isAutoClosingTagsEnabled$1, isQuickSuggestionsEnabled$1, lineNumbers, highlightActiveLineNumber, rowHeight, tabSize, letterSpacing, completionTriggerCharacters, minimapEnabled, mergeConflictActionsEnabled, breadcrumbsEnabled, insertSpaces, dragAndDropEnabled, roundedSelection, combineWhitespaceTokens] = await Promise.all([get$3('editor.diagnostics'), getFontFamily(), getFontSize(), getFontWeight(), get$3('editor.formatOnSave'), get$3('editor.hover'), get$3('editor.hoverDelay'), get$3('editor.messageDelay'), isAutoClosingBracketsEnabled(), isAutoClosingQuotesEnabled(), isAutoClosingTagsEnabled(), isQuickSuggestionsEnabled(), getLineNumbers(), getHighlightActiveLineNumber(), getRowHeight(), getTabSize(), getLetterSpacing(), getCompletionTriggerCharacters(), getMinimapEnabled(), getMergeConflictActionsEnabled(), get$3('breadcrumbs.enabled'), get$3('editor.insertSpaces'), get$3('editor.dragAndDrop'), get$3('editor.roundedSelection'), get$3('editor.combineWhitespaceTokens')]);
|
|
15781
15842
|
return {
|
|
15782
15843
|
breadcrumbsEnabled: breadcrumbsEnabled ?? false,
|
|
15783
15844
|
combineWhitespaceTokens: combineWhitespaceTokens ?? true,
|
|
@@ -15799,6 +15860,7 @@ const getEditorPreferences = async () => {
|
|
|
15799
15860
|
letterSpacing,
|
|
15800
15861
|
lineNumbers,
|
|
15801
15862
|
mergeConflictActionsEnabled,
|
|
15863
|
+
messageDelay: getMessageDelay(messageDelay),
|
|
15802
15864
|
minimapEnabled,
|
|
15803
15865
|
roundedSelection: roundedSelection === true,
|
|
15804
15866
|
rowHeight,
|
|
@@ -15873,7 +15935,7 @@ const handleSettingsChanged = async state => {
|
|
|
15873
15935
|
visualDecorations: diagnosticsEnabled ? state.visualDecorations : []
|
|
15874
15936
|
};
|
|
15875
15937
|
if (!editorWithUpdatedSettings.hoverEnabled) {
|
|
15876
|
-
clear$
|
|
15938
|
+
clear$2(state.uid);
|
|
15877
15939
|
}
|
|
15878
15940
|
let documentSymbols = state.documentSymbols || [];
|
|
15879
15941
|
let workspaceUri = state.workspaceUri || '';
|
|
@@ -16058,7 +16120,7 @@ const hotReload = async () => {
|
|
|
16058
16120
|
await relaunchWorkers();
|
|
16059
16121
|
const newEditors = await restoreWidgetState(keys, savedStates);
|
|
16060
16122
|
for (const editor of newEditors) {
|
|
16061
|
-
set$
|
|
16123
|
+
set$a(editor.newState.uid, editor.oldState, editor.newState);
|
|
16062
16124
|
}
|
|
16063
16125
|
|
|
16064
16126
|
// TODO ask renderer worker to rerender all editors
|
|
@@ -16096,7 +16158,7 @@ const initializeSyntaxHighlighting = async (syntaxHighlightingEnabled, syncIncre
|
|
|
16096
16158
|
if (syntaxHighlightingEnabled) {
|
|
16097
16159
|
setEnabled$1(true);
|
|
16098
16160
|
const syntaxRpc = await createSyntaxHighlightingWorkerRpc();
|
|
16099
|
-
set$
|
|
16161
|
+
set$8(syntaxRpc);
|
|
16100
16162
|
}
|
|
16101
16163
|
if (syncIncremental) {
|
|
16102
16164
|
setEnabled(true);
|
|
@@ -16293,7 +16355,7 @@ const loadContent = async (state, savedState, largeFile = false, focus = true) =
|
|
|
16293
16355
|
await loadTokenizer(computedLanguageId, tokenizePath);
|
|
16294
16356
|
const tokenizer = getTokenizer(computedLanguageId);
|
|
16295
16357
|
const newTokenizerId = state.tokenizerId + 1;
|
|
16296
|
-
set$
|
|
16358
|
+
set$5(newTokenizerId, tokenizer);
|
|
16297
16359
|
effectiveEditor.tokenizerId = newTokenizerId;
|
|
16298
16360
|
}
|
|
16299
16361
|
const savedHistory = existingEditor ? undefined : getSavedHistory(savedState, content);
|
|
@@ -16437,7 +16499,7 @@ const refreshGutterDecorationsAll = async () => {
|
|
|
16437
16499
|
if (!latest) {
|
|
16438
16500
|
continue;
|
|
16439
16501
|
}
|
|
16440
|
-
set$
|
|
16502
|
+
set$a(editor.id, latest.oldState, {
|
|
16441
16503
|
...latest.newState,
|
|
16442
16504
|
gutterDecorations: refreshedEditor.gutterDecorations
|
|
16443
16505
|
});
|
|
@@ -17748,7 +17810,7 @@ const render2 = (uid, _diffResult) => {
|
|
|
17748
17810
|
} = editor;
|
|
17749
17811
|
// Diagnostics can change after the caller calculated its diff in a separate RPC.
|
|
17750
17812
|
const diffResult = diff(oldState, newState);
|
|
17751
|
-
set$
|
|
17813
|
+
set$a(uid, newState, newState);
|
|
17752
17814
|
const commands = applyRender(oldState, newState, diffResult);
|
|
17753
17815
|
return commands;
|
|
17754
17816
|
};
|
|
@@ -17858,7 +17920,7 @@ const renderEditor = async id => {
|
|
|
17858
17920
|
oldState
|
|
17859
17921
|
} = instance;
|
|
17860
17922
|
const commands = [];
|
|
17861
|
-
set$
|
|
17923
|
+
set$a(id, newState, newState);
|
|
17862
17924
|
for (const item of render$7) {
|
|
17863
17925
|
if (item.isEqual(oldState, newState)) {
|
|
17864
17926
|
continue;
|
|
@@ -17992,92 +18054,6 @@ const revealProblem = (editor, rowIndex, columnIndex) => {
|
|
|
17992
18054
|
};
|
|
17993
18055
|
};
|
|
17994
18056
|
|
|
17995
|
-
const saveState = (state, savedState) => {
|
|
17996
|
-
const {
|
|
17997
|
-
explicitLanguageId,
|
|
17998
|
-
largeFile,
|
|
17999
|
-
lines,
|
|
18000
|
-
redoStack,
|
|
18001
|
-
undoStack
|
|
18002
|
-
} = state;
|
|
18003
|
-
return {
|
|
18004
|
-
...(explicitLanguageId && {
|
|
18005
|
-
explicitLanguageId
|
|
18006
|
-
}),
|
|
18007
|
-
...(largeFile && {
|
|
18008
|
-
largeFile: true
|
|
18009
|
-
}),
|
|
18010
|
-
...((redoStack.length > 0 || undoStack.length > 0) && {
|
|
18011
|
-
lines,
|
|
18012
|
-
redoStack,
|
|
18013
|
-
undoStack
|
|
18014
|
-
})
|
|
18015
|
-
};
|
|
18016
|
-
};
|
|
18017
|
-
|
|
18018
|
-
const sendMessagePortToExtensionManagementWorker = async (port, rpcId) => {
|
|
18019
|
-
await sendMessagePortToExtensionManagementWorker$1(port, rpcId);
|
|
18020
|
-
};
|
|
18021
|
-
const sendDeprecatedExtensionHostPortToExtensionManagementWorker = async (port, _initialCommand, rpcId) => {
|
|
18022
|
-
await sendMessagePortToExtensionManagementWorker$1(port, rpcId);
|
|
18023
|
-
};
|
|
18024
|
-
|
|
18025
|
-
const setDebugEnabled = (state, enabled) => {
|
|
18026
|
-
return state;
|
|
18027
|
-
};
|
|
18028
|
-
|
|
18029
|
-
const toggleMinimap = async () => {
|
|
18030
|
-
const minimapEnabled = await getMinimapEnabled();
|
|
18031
|
-
await update({
|
|
18032
|
-
'editor.minimap.enabled': !minimapEnabled
|
|
18033
|
-
});
|
|
18034
|
-
};
|
|
18035
|
-
|
|
18036
|
-
/**
|
|
18037
|
-
* Unregister a listener for editor events
|
|
18038
|
-
* @param listenerType - The type of event to stop listening for
|
|
18039
|
-
* @param rpcId - The RPC ID of the listener to unregister
|
|
18040
|
-
*/
|
|
18041
|
-
const unregisterListener = (listenerType, rpcId) => {
|
|
18042
|
-
number(listenerType);
|
|
18043
|
-
number(rpcId);
|
|
18044
|
-
unregisterListener$1(listenerType, rpcId);
|
|
18045
|
-
};
|
|
18046
|
-
|
|
18047
|
-
const invoke = async (method, ...params) => {
|
|
18048
|
-
const worker = get$9(DebugWorker);
|
|
18049
|
-
return worker.invoke(method, ...params);
|
|
18050
|
-
};
|
|
18051
|
-
|
|
18052
|
-
const getDebugHighlight = async debugId => {
|
|
18053
|
-
const newInfo = await invoke('RunAndDebug.getHighlight', debugId);
|
|
18054
|
-
return newInfo;
|
|
18055
|
-
};
|
|
18056
|
-
|
|
18057
|
-
const getKey = () => {
|
|
18058
|
-
const keys = getKeys$2();
|
|
18059
|
-
return parseInt(keys[0]);
|
|
18060
|
-
};
|
|
18061
|
-
const updateDebugInfo = async debugId => {
|
|
18062
|
-
const newInfo = await getDebugHighlight(debugId);
|
|
18063
|
-
const key = getKey();
|
|
18064
|
-
const instance = get$8(key);
|
|
18065
|
-
if (!instance) {
|
|
18066
|
-
return;
|
|
18067
|
-
}
|
|
18068
|
-
const {
|
|
18069
|
-
newState,
|
|
18070
|
-
oldState
|
|
18071
|
-
} = instance;
|
|
18072
|
-
const newEditor = {
|
|
18073
|
-
...newState,
|
|
18074
|
-
highlightedLine: newInfo.rowIndex
|
|
18075
|
-
};
|
|
18076
|
-
set$9(key, oldState, newEditor);
|
|
18077
|
-
// @ts-ignore
|
|
18078
|
-
await invoke$d('Editor.rerender', key);
|
|
18079
|
-
};
|
|
18080
|
-
|
|
18081
18057
|
const editorDiagnosticEffect = {
|
|
18082
18058
|
// TODO set effects delay / diagnostic delay
|
|
18083
18059
|
apply(editor) {
|
|
@@ -18107,7 +18083,7 @@ const saveAfterDelay = async (uid, token) => {
|
|
|
18107
18083
|
return;
|
|
18108
18084
|
}
|
|
18109
18085
|
let didSave = false;
|
|
18110
|
-
const save
|
|
18086
|
+
const save = wrapCommand$1(async editor => {
|
|
18111
18087
|
if (!isLatest(uid, token)) {
|
|
18112
18088
|
return editor;
|
|
18113
18089
|
}
|
|
@@ -18116,11 +18092,11 @@ const saveAfterDelay = async (uid, token) => {
|
|
|
18116
18092
|
if (autoSave !== 'afterDelay') {
|
|
18117
18093
|
return editor;
|
|
18118
18094
|
}
|
|
18119
|
-
const savedEditor = await save(editor);
|
|
18095
|
+
const savedEditor = await save$1(editor);
|
|
18120
18096
|
didSave = savedEditor !== editor;
|
|
18121
18097
|
return savedEditor;
|
|
18122
18098
|
});
|
|
18123
|
-
await save
|
|
18099
|
+
await save(uid);
|
|
18124
18100
|
if (didSave) {
|
|
18125
18101
|
await invoke$d('Editor.renderPending', uid);
|
|
18126
18102
|
}
|
|
@@ -18170,7 +18146,7 @@ const wrapCommand$1 = (fn, preservesTypingCoalescing = false, returnState = true
|
|
|
18170
18146
|
return returnState ? newEditor : undefined;
|
|
18171
18147
|
}
|
|
18172
18148
|
const newEditorWithDerivedState = await updateDerivedState(state, newEditor);
|
|
18173
|
-
set$
|
|
18149
|
+
set$a(uid, state, newEditorWithDerivedState);
|
|
18174
18150
|
await dispose$3();
|
|
18175
18151
|
if (editorDiagnosticEffect.isActive(state, newEditorWithDerivedState)) {
|
|
18176
18152
|
void editorDiagnosticEffect.apply(newEditorWithDerivedState);
|
|
@@ -18199,7 +18175,7 @@ const wrapCommand$1 = (fn, preservesTypingCoalescing = false, returnState = true
|
|
|
18199
18175
|
undoStack: finalEditor.undoStack,
|
|
18200
18176
|
visualDecorations: finalEditor.visualDecorations
|
|
18201
18177
|
});
|
|
18202
|
-
set$
|
|
18178
|
+
set$a(otherUid, instance.oldState, synchronizedEditor);
|
|
18203
18179
|
if (editorDiagnosticEffect.isActive(editor, synchronizedEditor)) {
|
|
18204
18180
|
void editorDiagnosticEffect.apply(synchronizedEditor);
|
|
18205
18181
|
}
|
|
@@ -18240,6 +18216,105 @@ const wrapDeferredCommand$1 = (fn, returnState = true) => {
|
|
|
18240
18216
|
};
|
|
18241
18217
|
};
|
|
18242
18218
|
|
|
18219
|
+
const save = async (uid, skipFormatting = false) => {
|
|
18220
|
+
let savedFrom;
|
|
18221
|
+
const saveContent = wrapCommand$1(async editor => {
|
|
18222
|
+
savedFrom = editor;
|
|
18223
|
+
return save$1(editor, skipFormatting);
|
|
18224
|
+
});
|
|
18225
|
+
const saved = await saveContent(uid);
|
|
18226
|
+
if (savedFrom && saved && savedFrom.uri !== saved.uri) {
|
|
18227
|
+
// Retargeting calls Editor.handleUriChange, so release the editing queue first.
|
|
18228
|
+
await invoke$9(savedFrom.applicationId, 'Main.handleUriChange', savedFrom.uri, saved.uri);
|
|
18229
|
+
}
|
|
18230
|
+
};
|
|
18231
|
+
|
|
18232
|
+
const saveState = (state, savedState) => {
|
|
18233
|
+
const {
|
|
18234
|
+
explicitLanguageId,
|
|
18235
|
+
largeFile,
|
|
18236
|
+
lines,
|
|
18237
|
+
redoStack,
|
|
18238
|
+
undoStack
|
|
18239
|
+
} = state;
|
|
18240
|
+
return {
|
|
18241
|
+
...(explicitLanguageId && {
|
|
18242
|
+
explicitLanguageId
|
|
18243
|
+
}),
|
|
18244
|
+
...(largeFile && {
|
|
18245
|
+
largeFile: true
|
|
18246
|
+
}),
|
|
18247
|
+
...((redoStack.length > 0 || undoStack.length > 0) && {
|
|
18248
|
+
lines,
|
|
18249
|
+
redoStack,
|
|
18250
|
+
undoStack
|
|
18251
|
+
})
|
|
18252
|
+
};
|
|
18253
|
+
};
|
|
18254
|
+
|
|
18255
|
+
const sendMessagePortToExtensionManagementWorker = async (port, rpcId) => {
|
|
18256
|
+
await sendMessagePortToExtensionManagementWorker$1(port, rpcId);
|
|
18257
|
+
};
|
|
18258
|
+
const sendDeprecatedExtensionHostPortToExtensionManagementWorker = async (port, _initialCommand, rpcId) => {
|
|
18259
|
+
await sendMessagePortToExtensionManagementWorker$1(port, rpcId);
|
|
18260
|
+
};
|
|
18261
|
+
|
|
18262
|
+
const setDebugEnabled = (state, enabled) => {
|
|
18263
|
+
return state;
|
|
18264
|
+
};
|
|
18265
|
+
|
|
18266
|
+
const toggleMinimap = async () => {
|
|
18267
|
+
const minimapEnabled = await getMinimapEnabled();
|
|
18268
|
+
await update({
|
|
18269
|
+
'editor.minimap.enabled': !minimapEnabled
|
|
18270
|
+
});
|
|
18271
|
+
};
|
|
18272
|
+
|
|
18273
|
+
/**
|
|
18274
|
+
* Unregister a listener for editor events
|
|
18275
|
+
* @param listenerType - The type of event to stop listening for
|
|
18276
|
+
* @param rpcId - The RPC ID of the listener to unregister
|
|
18277
|
+
*/
|
|
18278
|
+
const unregisterListener = (listenerType, rpcId) => {
|
|
18279
|
+
number(listenerType);
|
|
18280
|
+
number(rpcId);
|
|
18281
|
+
unregisterListener$1(listenerType, rpcId);
|
|
18282
|
+
};
|
|
18283
|
+
|
|
18284
|
+
const invoke = async (method, ...params) => {
|
|
18285
|
+
const worker = get$9(DebugWorker);
|
|
18286
|
+
return worker.invoke(method, ...params);
|
|
18287
|
+
};
|
|
18288
|
+
|
|
18289
|
+
const getDebugHighlight = async debugId => {
|
|
18290
|
+
const newInfo = await invoke('RunAndDebug.getHighlight', debugId);
|
|
18291
|
+
return newInfo;
|
|
18292
|
+
};
|
|
18293
|
+
|
|
18294
|
+
const getKey = () => {
|
|
18295
|
+
const keys = getKeys$2();
|
|
18296
|
+
return parseInt(keys[0]);
|
|
18297
|
+
};
|
|
18298
|
+
const updateDebugInfo = async debugId => {
|
|
18299
|
+
const newInfo = await getDebugHighlight(debugId);
|
|
18300
|
+
const key = getKey();
|
|
18301
|
+
const instance = get$8(key);
|
|
18302
|
+
if (!instance) {
|
|
18303
|
+
return;
|
|
18304
|
+
}
|
|
18305
|
+
const {
|
|
18306
|
+
newState,
|
|
18307
|
+
oldState
|
|
18308
|
+
} = instance;
|
|
18309
|
+
const newEditor = {
|
|
18310
|
+
...newState,
|
|
18311
|
+
highlightedLine: newInfo.rowIndex
|
|
18312
|
+
};
|
|
18313
|
+
set$a(key, oldState, newEditor);
|
|
18314
|
+
// @ts-ignore
|
|
18315
|
+
await invoke$d('Editor.rerender', key);
|
|
18316
|
+
};
|
|
18317
|
+
|
|
18243
18318
|
// State and undo history belong in this worker. Rendering reads changes separately.
|
|
18244
18319
|
const wrapCommand = (fn, preservesTypingCoalescing = false) => {
|
|
18245
18320
|
return wrapCommand$1(fn, preservesTypingCoalescing, false);
|
|
@@ -18427,7 +18502,7 @@ const commandMap = {
|
|
|
18427
18502
|
'Editor.rerender': wrapCommand(rerender),
|
|
18428
18503
|
'Editor.resize': wrapCommand(resize),
|
|
18429
18504
|
'Editor.revealProblem': wrapCommand(revealProblem),
|
|
18430
|
-
'Editor.save':
|
|
18505
|
+
'Editor.save': save,
|
|
18431
18506
|
'Editor.saveState': wrapGetter(saveState),
|
|
18432
18507
|
'Editor.scrollByLines': wrapCommand(scrollByLines),
|
|
18433
18508
|
'Editor.selectAll': wrapCommand(selectAll),
|
|
@@ -18578,7 +18653,7 @@ const initializeDragAndDropWorker = async () => {
|
|
|
18578
18653
|
commandMap: {},
|
|
18579
18654
|
send: sendMessagePortToDragAndDropWorker
|
|
18580
18655
|
});
|
|
18581
|
-
set$
|
|
18656
|
+
set$h(rpc);
|
|
18582
18657
|
};
|
|
18583
18658
|
|
|
18584
18659
|
const initializeErrorWorker = async () => {
|
|
@@ -18588,7 +18663,7 @@ const initializeErrorWorker = async () => {
|
|
|
18588
18663
|
return sendMessagePortToErrorWorker(port, EditorWorker);
|
|
18589
18664
|
}
|
|
18590
18665
|
});
|
|
18591
|
-
set$
|
|
18666
|
+
set$g(rpc);
|
|
18592
18667
|
};
|
|
18593
18668
|
|
|
18594
18669
|
const createExtensionManagementWorkerRpc = async () => {
|
|
@@ -18604,7 +18679,7 @@ const createExtensionManagementWorkerRpc = async () => {
|
|
|
18604
18679
|
const initializeExtensionManagementWorker = async () => {
|
|
18605
18680
|
try {
|
|
18606
18681
|
const rpc = await createExtensionManagementWorkerRpc();
|
|
18607
|
-
set$
|
|
18682
|
+
set$f(rpc);
|
|
18608
18683
|
} catch {
|
|
18609
18684
|
// ignore
|
|
18610
18685
|
}
|
|
@@ -18619,14 +18694,14 @@ const initializeOpenerWorker = async () => {
|
|
|
18619
18694
|
commandMap: {},
|
|
18620
18695
|
send: send$1
|
|
18621
18696
|
});
|
|
18622
|
-
set$
|
|
18697
|
+
set$e(rpc);
|
|
18623
18698
|
};
|
|
18624
18699
|
|
|
18625
18700
|
const initializeRendererWorker = async () => {
|
|
18626
18701
|
const rpc = await create$d({
|
|
18627
18702
|
commandMap: commandMap
|
|
18628
18703
|
});
|
|
18629
|
-
set$
|
|
18704
|
+
set$c(rpc);
|
|
18630
18705
|
};
|
|
18631
18706
|
|
|
18632
18707
|
const send = port => {
|
|
@@ -18637,7 +18712,7 @@ const initializeTextMeasurementWorker = async () => {
|
|
|
18637
18712
|
commandMap: {},
|
|
18638
18713
|
send
|
|
18639
18714
|
});
|
|
18640
|
-
set$
|
|
18715
|
+
set$d(rpc);
|
|
18641
18716
|
};
|
|
18642
18717
|
|
|
18643
18718
|
const listen = async () => {
|
|
@@ -18647,7 +18722,7 @@ const listen = async () => {
|
|
|
18647
18722
|
commandMap: {},
|
|
18648
18723
|
send: sendMessagePortToDialogWorker
|
|
18649
18724
|
});
|
|
18650
|
-
set$
|
|
18725
|
+
set$i(dialogRpc);
|
|
18651
18726
|
};
|
|
18652
18727
|
|
|
18653
18728
|
const CodeGeneratorInput = 'CodeGeneratorInput';
|
|
@@ -18969,15 +19044,15 @@ const EditorMessageWidget = {
|
|
|
18969
19044
|
};
|
|
18970
19045
|
|
|
18971
19046
|
const registerWidgets = () => {
|
|
18972
|
-
set$
|
|
18973
|
-
set$
|
|
18974
|
-
set$
|
|
18975
|
-
set$
|
|
18976
|
-
set$
|
|
18977
|
-
set$
|
|
18978
|
-
set$
|
|
18979
|
-
set$
|
|
18980
|
-
set$
|
|
19047
|
+
set$9(ColorPicker$2, EditorColorPickerWidget);
|
|
19048
|
+
set$9(Completion, EditorCompletionWidget);
|
|
19049
|
+
set$9(CompletionDetail, EditorCompletionDetailWidget);
|
|
19050
|
+
set$9(Find, EditorFindWidget);
|
|
19051
|
+
set$9(Hover, EditorHoverWidget);
|
|
19052
|
+
set$9(Message, EditorMessageWidget);
|
|
19053
|
+
set$9(Rename$1, EditorRenameWidget);
|
|
19054
|
+
set$9(SourceAction$1, EditorSourceActionWidget);
|
|
19055
|
+
set$9(CodeGenerator, EditorCodeGeneratorWidget);
|
|
18981
19056
|
};
|
|
18982
19057
|
|
|
18983
19058
|
const handleUnhandledRejection = event => {
|
package/dist/settings.json
CHANGED
|
@@ -791,6 +791,16 @@
|
|
|
791
791
|
"minimum": 0,
|
|
792
792
|
"maximum": 10000
|
|
793
793
|
},
|
|
794
|
+
{
|
|
795
|
+
"category": "text-editor",
|
|
796
|
+
"description": "Controls how long editor messages remain visible, in milliseconds",
|
|
797
|
+
"heading": "Message Display Duration",
|
|
798
|
+
"id": "editor.messageDelay",
|
|
799
|
+
"type": "number",
|
|
800
|
+
"value": 3000,
|
|
801
|
+
"minimum": 0,
|
|
802
|
+
"maximum": 10000
|
|
803
|
+
},
|
|
794
804
|
{
|
|
795
805
|
"category": "text-editor",
|
|
796
806
|
"description": "Controls whether the editor should be in a diff editor",
|