@lvce-editor/editor-worker 19.68.5 → 19.69.0
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 +389 -256
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -1343,6 +1343,7 @@ const {
|
|
|
1343
1343
|
|
|
1344
1344
|
const {
|
|
1345
1345
|
invoke: invoke$g,
|
|
1346
|
+
invokeAndTransfer: invokeAndTransfer$2,
|
|
1346
1347
|
set: set$d
|
|
1347
1348
|
} = create$c(ExtensionManagementWorker);
|
|
1348
1349
|
const getLanguages$1 = (platform, assetDir) => {
|
|
@@ -1437,7 +1438,7 @@ const {
|
|
|
1437
1438
|
|
|
1438
1439
|
const {
|
|
1439
1440
|
invoke: invoke$d,
|
|
1440
|
-
invokeAndTransfer,
|
|
1441
|
+
invokeAndTransfer: invokeAndTransfer$1,
|
|
1441
1442
|
set: set$a
|
|
1442
1443
|
} = create$c(RendererWorker);
|
|
1443
1444
|
const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
@@ -1449,19 +1450,19 @@ const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
|
1449
1450
|
};
|
|
1450
1451
|
const sendMessagePortToDragAndDropWorker = async port => {
|
|
1451
1452
|
const command = 'DragAndDrop.handleMessagePort';
|
|
1452
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToRendererProcess', port, command);
|
|
1453
|
+
await invokeAndTransfer$1('SendMessagePortToExtensionHostWorker.sendMessagePortToRendererProcess', port, command);
|
|
1453
1454
|
};
|
|
1454
1455
|
const sendMessagePortToOpenerWorker = async (port, rpcId) => {
|
|
1455
1456
|
const command = 'HandleMessagePort.handleMessagePort';
|
|
1456
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToOpenerWorker', port, command, rpcId);
|
|
1457
|
+
await invokeAndTransfer$1('SendMessagePortToExtensionHostWorker.sendMessagePortToOpenerWorker', port, command, rpcId);
|
|
1457
1458
|
};
|
|
1458
1459
|
const sendMessagePortToDialogWorker = async port => {
|
|
1459
1460
|
const command = 'HandleMessagePort.handleMessagePort';
|
|
1460
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToDialogWorker', port, command);
|
|
1461
|
+
await invokeAndTransfer$1('SendMessagePortToExtensionHostWorker.sendMessagePortToDialogWorker', port, command);
|
|
1461
1462
|
};
|
|
1462
1463
|
const sendMessagePortToErrorWorker = async (port, rpcId) => {
|
|
1463
1464
|
const command = 'Errors.handleMessagePort';
|
|
1464
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToErrorWorker', port, command, rpcId);
|
|
1465
|
+
await invokeAndTransfer$1('SendMessagePortToExtensionHostWorker.sendMessagePortToErrorWorker', port, command, rpcId);
|
|
1465
1466
|
};
|
|
1466
1467
|
const writeClipBoardText = async text => {
|
|
1467
1468
|
await invoke$d('ClipBoard.writeText', /* text */text);
|
|
@@ -1471,11 +1472,11 @@ const readClipBoardText = async () => {
|
|
|
1471
1472
|
};
|
|
1472
1473
|
const sendMessagePortToTextMeasurementWorker = async port => {
|
|
1473
1474
|
const command = 'TextMeasurement.handleMessagePort';
|
|
1474
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToTextMeasurementWorker', port, command, 0);
|
|
1475
|
+
await invokeAndTransfer$1('SendMessagePortToExtensionHostWorker.sendMessagePortToTextMeasurementWorker', port, command, 0);
|
|
1475
1476
|
};
|
|
1476
1477
|
const sendMessagePortToExtensionManagementWorker$1 = async (port, rpcId) => {
|
|
1477
1478
|
const command = 'Extensions.handleMessagePort';
|
|
1478
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionManagementWorker', port, command, rpcId);
|
|
1479
|
+
await invokeAndTransfer$1('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionManagementWorker', port, command, rpcId);
|
|
1479
1480
|
};
|
|
1480
1481
|
const getPreference = async key => {
|
|
1481
1482
|
return await invoke$d('Preferences.get', key);
|
|
@@ -1488,7 +1489,7 @@ const openUri = async (uri, focus, options) => {
|
|
|
1488
1489
|
});
|
|
1489
1490
|
};
|
|
1490
1491
|
const sendMessagePortToSyntaxHighlightingWorker$1 = async port => {
|
|
1491
|
-
await invokeAndTransfer('SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker', port, 'HandleMessagePort.handleMessagePort2');
|
|
1492
|
+
await invokeAndTransfer$1('SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker', port, 'HandleMessagePort.handleMessagePort2');
|
|
1492
1493
|
};
|
|
1493
1494
|
|
|
1494
1495
|
const {
|
|
@@ -3847,7 +3848,7 @@ const splitLines = lines => {
|
|
|
3847
3848
|
const state$9 = {};
|
|
3848
3849
|
const create$a = () => create$g({
|
|
3849
3850
|
commandMap: {},
|
|
3850
|
-
send: port => invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, 'FileSystem.connect')
|
|
3851
|
+
send: port => invokeAndTransfer$1('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, 'FileSystem.connect')
|
|
3851
3852
|
});
|
|
3852
3853
|
const invoke$a = async (method, ...args) => {
|
|
3853
3854
|
state$9.rpcPromise ||= create$a();
|
|
@@ -4618,6 +4619,9 @@ const updateColorPickerValue$1 = async (editor, value) => {
|
|
|
4618
4619
|
const invoke$8 = async (applicationId, method, ...args) => {
|
|
4619
4620
|
return applicationId === undefined ? invoke$g(method, ...args) : invoke$g('Extensions.invokeForApplication', applicationId, method, ...args);
|
|
4620
4621
|
};
|
|
4622
|
+
const invokeAndTransfer = async (applicationId, method, ...args) => {
|
|
4623
|
+
return applicationId === undefined ? invokeAndTransfer$2(method, ...args) : invokeAndTransfer$2('Extensions.invokeForApplication', applicationId, method, ...args);
|
|
4624
|
+
};
|
|
4621
4625
|
|
|
4622
4626
|
const getTextDocument$3 = editor => ({
|
|
4623
4627
|
documentId: editor.id || editor.uid,
|
|
@@ -5265,7 +5269,7 @@ const launchWorker = async (name, url, intializeCommand, commandMap = {}) => {
|
|
|
5265
5269
|
commandMap,
|
|
5266
5270
|
isMessagePortOpen: true,
|
|
5267
5271
|
async send(port) {
|
|
5268
|
-
await invokeAndTransfer('IpcParent.create', {
|
|
5272
|
+
await invokeAndTransfer$1('IpcParent.create', {
|
|
5269
5273
|
method: ModuleWorkerAndWorkaroundForChromeDevtoolsBug,
|
|
5270
5274
|
name,
|
|
5271
5275
|
port,
|
|
@@ -6211,6 +6215,317 @@ const renderWidgets$1 = (oldState, newState) => {
|
|
|
6211
6215
|
return allCommands.filter(item => item[0] !== 'Viewlet.appendToBody' && (item[0] !== 'Viewlet.setFocusContext' || item.length >= 3));
|
|
6212
6216
|
};
|
|
6213
6217
|
|
|
6218
|
+
const queues = {};
|
|
6219
|
+
const enqueue = async (uid, callback) => {
|
|
6220
|
+
const instance = get$8(uid);
|
|
6221
|
+
if (!instance) {
|
|
6222
|
+
return undefined;
|
|
6223
|
+
}
|
|
6224
|
+
const {
|
|
6225
|
+
applicationId,
|
|
6226
|
+
uri
|
|
6227
|
+
} = instance.newState;
|
|
6228
|
+
const key = JSON.stringify([applicationId ?? null, uri || uid]);
|
|
6229
|
+
const previous = queues[key];
|
|
6230
|
+
const {
|
|
6231
|
+
promise,
|
|
6232
|
+
resolve
|
|
6233
|
+
} = Promise.withResolvers();
|
|
6234
|
+
queues[key] = promise;
|
|
6235
|
+
if (previous) {
|
|
6236
|
+
await previous;
|
|
6237
|
+
}
|
|
6238
|
+
try {
|
|
6239
|
+
return await callback();
|
|
6240
|
+
} finally {
|
|
6241
|
+
resolve();
|
|
6242
|
+
if (queues[key] === promise) {
|
|
6243
|
+
delete queues[key];
|
|
6244
|
+
}
|
|
6245
|
+
}
|
|
6246
|
+
};
|
|
6247
|
+
|
|
6248
|
+
const logError = async (error, prefix) => {
|
|
6249
|
+
const prettyError = await invoke$h('Errors.prepare', error);
|
|
6250
|
+
await invoke$h('Errors.print', prettyError, prefix);
|
|
6251
|
+
};
|
|
6252
|
+
const logFallback = (error, prefix) => {
|
|
6253
|
+
if (prefix) {
|
|
6254
|
+
console.error(prefix, error);
|
|
6255
|
+
return;
|
|
6256
|
+
}
|
|
6257
|
+
console.error(error);
|
|
6258
|
+
};
|
|
6259
|
+
const handleError$1 = async (error, prefix = '') => {
|
|
6260
|
+
try {
|
|
6261
|
+
await logError(error, prefix);
|
|
6262
|
+
} catch (otherError) {
|
|
6263
|
+
console.warn('ErrorHandling error', otherError);
|
|
6264
|
+
logFallback(error, prefix);
|
|
6265
|
+
}
|
|
6266
|
+
};
|
|
6267
|
+
|
|
6268
|
+
const getTextDocument$2 = editor => {
|
|
6269
|
+
return {
|
|
6270
|
+
documentId: editor.id || editor.uid,
|
|
6271
|
+
languageId: editor.languageId,
|
|
6272
|
+
text: getText$1(editor),
|
|
6273
|
+
uri: editor.uri
|
|
6274
|
+
};
|
|
6275
|
+
};
|
|
6276
|
+
const streamIsolatedDiagnosticProvider = async (editor, resultPort) => {
|
|
6277
|
+
const textDocument = getTextDocument$2(editor);
|
|
6278
|
+
return invokeAndTransfer(editor.applicationId, 'Extensions.streamDiagnosticProvider', textDocument, resultPort);
|
|
6279
|
+
};
|
|
6280
|
+
const streamDiagnosticProvider = async (editor, resultPort) => {
|
|
6281
|
+
return streamIsolatedDiagnosticProvider(editor, resultPort);
|
|
6282
|
+
};
|
|
6283
|
+
|
|
6284
|
+
const invoke$5 = (...args) => invoke$d(...args);
|
|
6285
|
+
|
|
6286
|
+
/**
|
|
6287
|
+
* Merges link decorations with diagnostic decorations
|
|
6288
|
+
* Links should always be present, but we also need to include any diagnostic decorations
|
|
6289
|
+
*/
|
|
6290
|
+
const mergeLinksWithDiagnosticDecorations = (editor, diagnosticDecorations) => {
|
|
6291
|
+
// Get link decorations
|
|
6292
|
+
const linkDecorations = detectAllLinksAsDecorations(editor);
|
|
6293
|
+
|
|
6294
|
+
// Merge with diagnostic decorations
|
|
6295
|
+
const allDecorations = [...linkDecorations, ...diagnosticDecorations];
|
|
6296
|
+
|
|
6297
|
+
// Sort by offset to maintain proper order
|
|
6298
|
+
const sortedDecorations = [];
|
|
6299
|
+
for (let i = 0; i < allDecorations.length; i += 4) {
|
|
6300
|
+
sortedDecorations.push({
|
|
6301
|
+
length: allDecorations[i + 1],
|
|
6302
|
+
modifiers: allDecorations[i + 3],
|
|
6303
|
+
offset: allDecorations[i],
|
|
6304
|
+
type: allDecorations[i + 2]
|
|
6305
|
+
});
|
|
6306
|
+
}
|
|
6307
|
+
sortedDecorations.sort((a, b) => a.offset - b.offset);
|
|
6308
|
+
|
|
6309
|
+
// Flatten back to array format
|
|
6310
|
+
const result = [];
|
|
6311
|
+
for (const dec of sortedDecorations) {
|
|
6312
|
+
result.push(dec.offset, dec.length, dec.type, dec.modifiers);
|
|
6313
|
+
}
|
|
6314
|
+
return result;
|
|
6315
|
+
};
|
|
6316
|
+
|
|
6317
|
+
const requestGenerations = new Map();
|
|
6318
|
+
const requestDiagnosticSnapshots = new Map();
|
|
6319
|
+
const previousProviderResults = new Map();
|
|
6320
|
+
const getDiagnostics$1 = async (editor, resultPort) => {
|
|
6321
|
+
return streamDiagnosticProvider(editor, resultPort);
|
|
6322
|
+
};
|
|
6323
|
+
const addDiagnostics = async (editor, diagnostics) => {
|
|
6324
|
+
const visualDecorations = await getVisibleDiagnostics(editor, diagnostics);
|
|
6325
|
+
const diagnosticDecorations = visualDecorations.flatMap(decoration => [decoration.offset, decoration.length, decoration.type, decoration.modifiers || 0]);
|
|
6326
|
+
const decorations = mergeLinksWithDiagnosticDecorations(editor, diagnosticDecorations);
|
|
6327
|
+
return {
|
|
6328
|
+
...editor,
|
|
6329
|
+
decorations,
|
|
6330
|
+
diagnostics,
|
|
6331
|
+
lightBulbRowIndex: -1,
|
|
6332
|
+
visualDecorations
|
|
6333
|
+
};
|
|
6334
|
+
};
|
|
6335
|
+
const handleError = async (error, editor) => {
|
|
6336
|
+
if (error instanceof Error && error.message.includes('No diagnostic provider found')) {
|
|
6337
|
+
return editor;
|
|
6338
|
+
}
|
|
6339
|
+
await handleError$1(error, 'Failed to update diagnostics: ');
|
|
6340
|
+
return editor;
|
|
6341
|
+
};
|
|
6342
|
+
const notifyDiagnosticsChange = async (uri, applicationId) => {
|
|
6343
|
+
try {
|
|
6344
|
+
await invoke$9(applicationId, 'Layout.handleDiagnosticsChange', uri);
|
|
6345
|
+
} catch {
|
|
6346
|
+
// Older renderer workers do not support diagnostics change listeners.
|
|
6347
|
+
}
|
|
6348
|
+
};
|
|
6349
|
+
const diagnosticsEqual = (left, right) => {
|
|
6350
|
+
if (left === right) {
|
|
6351
|
+
return true;
|
|
6352
|
+
}
|
|
6353
|
+
if ((left?.length ?? 0) !== right.length) {
|
|
6354
|
+
return false;
|
|
6355
|
+
}
|
|
6356
|
+
return right.every((diagnostic, index) => {
|
|
6357
|
+
const other = left[index];
|
|
6358
|
+
return other.code === diagnostic.code && other.columnIndex === diagnostic.columnIndex && other.endColumnIndex === diagnostic.endColumnIndex && other.endRowIndex === diagnostic.endRowIndex && other.message === diagnostic.message && other.rowIndex === diagnostic.rowIndex && other.source === diagnostic.source && other.type === diagnostic.type && other.uri === diagnostic.uri;
|
|
6359
|
+
});
|
|
6360
|
+
};
|
|
6361
|
+
const diagnosticLayoutEqual = (left, right) => left.charWidth === right.charWidth && left.deltaY === right.deltaY && left.fontFamily === right.fontFamily && left.fontSize === right.fontSize && left.fontWeight === right.fontWeight && left.isMonospaceFont === right.isMonospaceFont && left.itemHeight === right.itemHeight && left.letterSpacing === right.letterSpacing && left.lines === right.lines && left.minLineY === right.minLineY && left.rowHeight === right.rowHeight && left.tabSize === right.tabSize && left.viewLineIndices === right.viewLineIndices && left.width === right.width;
|
|
6362
|
+
const isApplicable = (latest, editor, generation) => latest && requestGenerations.get(editor.id) === generation && latest.newState.diagnostics === requestDiagnosticSnapshots.get(editor.id) && latest.newState.diagnosticsEnabled && !latest.newState.loadError && latest.newState.languageId === editor.languageId && latest.newState.lines === editor.lines && latest.newState.uri === editor.uri;
|
|
6363
|
+
const mergeDiagnostics = (editor, editorWithDiagnostics) => ({
|
|
6364
|
+
...editor,
|
|
6365
|
+
decorations: editorWithDiagnostics.decorations,
|
|
6366
|
+
diagnostics: editorWithDiagnostics.diagnostics,
|
|
6367
|
+
lightBulbRowIndex: editorWithDiagnostics.lightBulbRowIndex,
|
|
6368
|
+
visualDecorations: editorWithDiagnostics.visualDecorations
|
|
6369
|
+
});
|
|
6370
|
+
const commitDiagnostics = async (editor, generation, diagnostics) => {
|
|
6371
|
+
return (await enqueue(editor.id, async () => {
|
|
6372
|
+
let latest = get$8(editor.id);
|
|
6373
|
+
if (!isApplicable(latest, editor, generation)) {
|
|
6374
|
+
return editor;
|
|
6375
|
+
}
|
|
6376
|
+
if (diagnosticsEqual(latest.newState.diagnostics, diagnostics)) {
|
|
6377
|
+
return latest.newState;
|
|
6378
|
+
}
|
|
6379
|
+
let calculationState = latest.newState;
|
|
6380
|
+
let editorWithDiagnostics = await addDiagnostics(calculationState, diagnostics);
|
|
6381
|
+
latest = get$8(editor.id);
|
|
6382
|
+
while (isApplicable(latest, editor, generation) && !diagnosticLayoutEqual(calculationState, latest.newState)) {
|
|
6383
|
+
calculationState = latest.newState;
|
|
6384
|
+
editorWithDiagnostics = await addDiagnostics(calculationState, diagnostics);
|
|
6385
|
+
latest = get$8(editor.id);
|
|
6386
|
+
}
|
|
6387
|
+
if (!isApplicable(latest, editor, generation)) {
|
|
6388
|
+
return editor;
|
|
6389
|
+
}
|
|
6390
|
+
if (diagnosticsEqual(latest.newState.diagnostics, diagnostics)) {
|
|
6391
|
+
return latest.newState;
|
|
6392
|
+
}
|
|
6393
|
+
const newEditor = mergeDiagnostics(latest.newState, editorWithDiagnostics);
|
|
6394
|
+
set$8(editor.id, latest.oldState, newEditor);
|
|
6395
|
+
requestDiagnosticSnapshots.set(editor.id, diagnostics);
|
|
6396
|
+
await invoke$5('Editor.renderPending', newEditor.id);
|
|
6397
|
+
await notifyDiagnosticsChange(newEditor.uri, newEditor.applicationId);
|
|
6398
|
+
return newEditor;
|
|
6399
|
+
})) ?? editor;
|
|
6400
|
+
};
|
|
6401
|
+
const flattenProviderDiagnostics = providers => {
|
|
6402
|
+
return providers.values().toArray().toSorted((left, right) => left.providerIndex - right.providerIndex).flatMap(({
|
|
6403
|
+
diagnostics
|
|
6404
|
+
}) => diagnostics);
|
|
6405
|
+
};
|
|
6406
|
+
const updateDiagnostics = async editor => {
|
|
6407
|
+
if (!editor.diagnosticsEnabled || editor.loadError) {
|
|
6408
|
+
return editor;
|
|
6409
|
+
}
|
|
6410
|
+
const generation = (requestGenerations.get(editor.id) ?? 0) + 1;
|
|
6411
|
+
requestGenerations.set(editor.id, generation);
|
|
6412
|
+
requestDiagnosticSnapshots.set(editor.id, get$8(editor.id)?.newState.diagnostics ?? editor.diagnostics);
|
|
6413
|
+
const providers = new Map();
|
|
6414
|
+
const previous = previousProviderResults.get(editor.id);
|
|
6415
|
+
if (previous && previous.languageId === editor.languageId && previous.lines === editor.lines && previous.uri === editor.uri) {
|
|
6416
|
+
for (const [providerId, result] of previous.providers) {
|
|
6417
|
+
providers.set(providerId, result);
|
|
6418
|
+
}
|
|
6419
|
+
}
|
|
6420
|
+
const {
|
|
6421
|
+
port1,
|
|
6422
|
+
port2
|
|
6423
|
+
} = new MessageChannel();
|
|
6424
|
+
const completed = Promise.withResolvers();
|
|
6425
|
+
let commitQueue = Promise.resolve();
|
|
6426
|
+
let providerCount = -1;
|
|
6427
|
+
port1.onmessage = event => {
|
|
6428
|
+
const previousCommit = commitQueue;
|
|
6429
|
+
commitQueue = (async () => {
|
|
6430
|
+
await previousCommit;
|
|
6431
|
+
try {
|
|
6432
|
+
const message = event.data;
|
|
6433
|
+
if (requestGenerations.get(editor.id) !== generation) {
|
|
6434
|
+
if (message.type === 'done') {
|
|
6435
|
+
port1.close();
|
|
6436
|
+
completed.resolve();
|
|
6437
|
+
}
|
|
6438
|
+
return;
|
|
6439
|
+
}
|
|
6440
|
+
if (message.type === 'providers') {
|
|
6441
|
+
providerCount = message.providerCount ?? 0;
|
|
6442
|
+
const providerIds = message.providerIds ?? [];
|
|
6443
|
+
for (const providerId of providers.keys()) {
|
|
6444
|
+
if (providerIds.includes(providerId)) {
|
|
6445
|
+
const previousResult = providers.get(providerId);
|
|
6446
|
+
providers.set(providerId, {
|
|
6447
|
+
...previousResult,
|
|
6448
|
+
providerIndex: providerIds.indexOf(providerId)
|
|
6449
|
+
});
|
|
6450
|
+
} else {
|
|
6451
|
+
providers.delete(providerId);
|
|
6452
|
+
}
|
|
6453
|
+
}
|
|
6454
|
+
return;
|
|
6455
|
+
}
|
|
6456
|
+
if (message.type === 'result' && message.providerId !== undefined) {
|
|
6457
|
+
providers.set(message.providerId, {
|
|
6458
|
+
diagnostics: message.diagnostics ?? [],
|
|
6459
|
+
providerIndex: message.providerIndex ?? providers.size
|
|
6460
|
+
});
|
|
6461
|
+
await commitDiagnostics(editor, generation, flattenProviderDiagnostics(providers));
|
|
6462
|
+
return;
|
|
6463
|
+
}
|
|
6464
|
+
if (message.type === 'done') {
|
|
6465
|
+
if (providerCount === 0) {
|
|
6466
|
+
providers.clear();
|
|
6467
|
+
await commitDiagnostics(editor, generation, []);
|
|
6468
|
+
}
|
|
6469
|
+
previousProviderResults.set(editor.id, {
|
|
6470
|
+
languageId: editor.languageId,
|
|
6471
|
+
lines: editor.lines,
|
|
6472
|
+
providers: new Map(providers),
|
|
6473
|
+
uri: editor.uri
|
|
6474
|
+
});
|
|
6475
|
+
port1.close();
|
|
6476
|
+
completed.resolve();
|
|
6477
|
+
}
|
|
6478
|
+
} catch (error) {
|
|
6479
|
+
port1.close();
|
|
6480
|
+
completed.resolve();
|
|
6481
|
+
await handleError(error, editor);
|
|
6482
|
+
}
|
|
6483
|
+
})();
|
|
6484
|
+
};
|
|
6485
|
+
port1.start();
|
|
6486
|
+
try {
|
|
6487
|
+
const response = await getDiagnostics$1(editor, port2);
|
|
6488
|
+
if (Array.isArray(response) && providerCount === -1) {
|
|
6489
|
+
providers.set('legacy', {
|
|
6490
|
+
diagnostics: response,
|
|
6491
|
+
providerIndex: 0
|
|
6492
|
+
});
|
|
6493
|
+
await commitDiagnostics(editor, generation, response);
|
|
6494
|
+
previousProviderResults.set(editor.id, {
|
|
6495
|
+
languageId: editor.languageId,
|
|
6496
|
+
lines: editor.lines,
|
|
6497
|
+
providers: new Map(providers),
|
|
6498
|
+
uri: editor.uri
|
|
6499
|
+
});
|
|
6500
|
+
port1.close();
|
|
6501
|
+
completed.resolve();
|
|
6502
|
+
}
|
|
6503
|
+
await completed.promise;
|
|
6504
|
+
const latest = get$8(editor.id);
|
|
6505
|
+
return isApplicable(latest, editor, generation) ? latest.newState : editor;
|
|
6506
|
+
} catch (error) {
|
|
6507
|
+
port1.close();
|
|
6508
|
+
return handleError(error, editor);
|
|
6509
|
+
}
|
|
6510
|
+
};
|
|
6511
|
+
const requestDiagnostics = editor => {
|
|
6512
|
+
void updateDiagnostics(editor);
|
|
6513
|
+
return editor;
|
|
6514
|
+
};
|
|
6515
|
+
const clearDiagnosticRequestState = editorId => {
|
|
6516
|
+
requestGenerations.delete(editorId);
|
|
6517
|
+
requestDiagnosticSnapshots.delete(editorId);
|
|
6518
|
+
previousProviderResults.delete(editorId);
|
|
6519
|
+
};
|
|
6520
|
+
const updateDiagnosticsAll = async () => {
|
|
6521
|
+
for (const key of getKeys$2()) {
|
|
6522
|
+
const editor = get$8(Number(key))?.newState;
|
|
6523
|
+
if (editor) {
|
|
6524
|
+
await updateDiagnostics(editor);
|
|
6525
|
+
}
|
|
6526
|
+
}
|
|
6527
|
+
};
|
|
6528
|
+
|
|
6214
6529
|
const disposeEditor = async editorUid => {
|
|
6215
6530
|
const editor = get$8(editorUid)?.newState;
|
|
6216
6531
|
if (!editor) {
|
|
@@ -6221,6 +6536,7 @@ const disposeEditor = async editorUid => {
|
|
|
6221
6536
|
delete editor.lifecycle.sentLines;
|
|
6222
6537
|
}
|
|
6223
6538
|
// Invalidate the registry before awaiting widget or worker cleanup.
|
|
6539
|
+
clearDiagnosticRequestState(editorUid);
|
|
6224
6540
|
dispose$6(editorUid);
|
|
6225
6541
|
try {
|
|
6226
6542
|
await invoke$9(editor.applicationId, 'Layout.handleDiagnosticsChange', editor.uri);
|
|
@@ -6833,26 +7149,6 @@ const hasWidget = (widgets, id) => {
|
|
|
6833
7149
|
return false;
|
|
6834
7150
|
};
|
|
6835
7151
|
|
|
6836
|
-
const logError = async (error, prefix) => {
|
|
6837
|
-
const prettyError = await invoke$h('Errors.prepare', error);
|
|
6838
|
-
await invoke$h('Errors.print', prettyError, prefix);
|
|
6839
|
-
};
|
|
6840
|
-
const logFallback = (error, prefix) => {
|
|
6841
|
-
if (prefix) {
|
|
6842
|
-
console.error(prefix, error);
|
|
6843
|
-
return;
|
|
6844
|
-
}
|
|
6845
|
-
console.error(error);
|
|
6846
|
-
};
|
|
6847
|
-
const handleError$1 = async (error, prefix = '') => {
|
|
6848
|
-
try {
|
|
6849
|
-
await logError(error, prefix);
|
|
6850
|
-
} catch (otherError) {
|
|
6851
|
-
console.warn('ErrorHandling error', otherError);
|
|
6852
|
-
logFallback(error, prefix);
|
|
6853
|
-
}
|
|
6854
|
-
};
|
|
6855
|
-
|
|
6856
7152
|
const getFormattingEdits = async editor => {
|
|
6857
7153
|
if (editor.largeFile) {
|
|
6858
7154
|
return [];
|
|
@@ -9825,6 +10121,7 @@ const getDiagnosticHoverInfo = async (editor, diagnostic) => {
|
|
|
9825
10121
|
return {
|
|
9826
10122
|
diagnostics: [diagnostic],
|
|
9827
10123
|
documentation: '',
|
|
10124
|
+
documentationVirtualDom: [],
|
|
9828
10125
|
height,
|
|
9829
10126
|
lineInfos: [],
|
|
9830
10127
|
width,
|
|
@@ -9842,6 +10139,7 @@ const create$5 = () => {
|
|
|
9842
10139
|
content: '',
|
|
9843
10140
|
diagnostics: [],
|
|
9844
10141
|
documentation: '',
|
|
10142
|
+
documentationVirtualDom: [],
|
|
9845
10143
|
editorUid: 0,
|
|
9846
10144
|
height: 0,
|
|
9847
10145
|
lineInfos: [],
|
|
@@ -9855,6 +10153,7 @@ const create$5 = () => {
|
|
|
9855
10153
|
content: '',
|
|
9856
10154
|
diagnostics: [],
|
|
9857
10155
|
documentation: '',
|
|
10156
|
+
documentationVirtualDom: [],
|
|
9858
10157
|
editorUid: 0,
|
|
9859
10158
|
height: 0,
|
|
9860
10159
|
lineInfos: [],
|
|
@@ -9867,7 +10166,7 @@ const create$5 = () => {
|
|
|
9867
10166
|
return widget;
|
|
9868
10167
|
};
|
|
9869
10168
|
|
|
9870
|
-
const getTextDocument$
|
|
10169
|
+
const getTextDocument$1 = editor => {
|
|
9871
10170
|
return {
|
|
9872
10171
|
documentId: editor.id || editor.uid,
|
|
9873
10172
|
languageId: editor.languageId,
|
|
@@ -9876,7 +10175,7 @@ const getTextDocument$2 = editor => {
|
|
|
9876
10175
|
};
|
|
9877
10176
|
};
|
|
9878
10177
|
const executeIsolatedHoverProvider = async (editor, offset) => {
|
|
9879
|
-
const textDocument = getTextDocument$
|
|
10178
|
+
const textDocument = getTextDocument$1(editor);
|
|
9880
10179
|
return invoke$8(editor.applicationId, 'Extensions.executeHoverProvider', textDocument, offset);
|
|
9881
10180
|
};
|
|
9882
10181
|
const executeHoverProvider = async (editor, offset) => {
|
|
@@ -9893,6 +10192,13 @@ const getHover = async (editor, offset) => {
|
|
|
9893
10192
|
return hover;
|
|
9894
10193
|
};
|
|
9895
10194
|
|
|
10195
|
+
const getVirtualDomFromMarkdown = async markdown => {
|
|
10196
|
+
const html = await invoke$5('Markdown.renderMarkdown', markdown, {
|
|
10197
|
+
linksExternal: true
|
|
10198
|
+
});
|
|
10199
|
+
return invoke$5('Markdown.getVirtualDom', html);
|
|
10200
|
+
};
|
|
10201
|
+
|
|
9896
10202
|
const getLineInfo = (line, tokens, TokenMap) => {
|
|
9897
10203
|
const tokensLength = tokens.length;
|
|
9898
10204
|
let end = 0;
|
|
@@ -9990,6 +10296,7 @@ const getEditorHoverInfo = async (editorUid, position) => {
|
|
|
9990
10296
|
}
|
|
9991
10297
|
const tokenizerPath = '';
|
|
9992
10298
|
const lineInfos = displayString ? await tokenizeCodeBlock(displayString, displayStringLanguageId || fallbackDisplayStringLanguageId, tokenizerPath) : [];
|
|
10299
|
+
const documentationVirtualDom = documentation ? await getVirtualDomFromMarkdown(documentation) : [];
|
|
9993
10300
|
const wordPart = getWordBefore(editor, rowIndex, columnIndex);
|
|
9994
10301
|
const wordStart = columnIndex - wordPart.length;
|
|
9995
10302
|
const documentationHeight = documentation ? await measureTextBlockHeight(documentation, hoverDocumentationFontFamily, hoverDocumentationFontSize, hoverDocumentationLineHeight, hoverDocumentationWidth) : 0;
|
|
@@ -10004,6 +10311,7 @@ const getEditorHoverInfo = async (editorUid, position) => {
|
|
|
10004
10311
|
const y$1 = rowBottom + height <= editor.y + editor.height ? rowBottom : Math.max(editor.y, rowBottom - editor.rowHeight - height);
|
|
10005
10312
|
return {
|
|
10006
10313
|
documentation,
|
|
10314
|
+
documentationVirtualDom,
|
|
10007
10315
|
height,
|
|
10008
10316
|
lineInfos,
|
|
10009
10317
|
matchingDiagnostics,
|
|
@@ -10019,6 +10327,7 @@ const loadHoverContent = async (state, position) => {
|
|
|
10019
10327
|
}
|
|
10020
10328
|
const {
|
|
10021
10329
|
documentation,
|
|
10330
|
+
documentationVirtualDom,
|
|
10022
10331
|
height,
|
|
10023
10332
|
lineInfos,
|
|
10024
10333
|
matchingDiagnostics,
|
|
@@ -10029,6 +10338,7 @@ const loadHoverContent = async (state, position) => {
|
|
|
10029
10338
|
...state,
|
|
10030
10339
|
diagnostics: matchingDiagnostics,
|
|
10031
10340
|
documentation,
|
|
10341
|
+
documentationVirtualDom,
|
|
10032
10342
|
height,
|
|
10033
10343
|
lineInfos,
|
|
10034
10344
|
width: 600,
|
|
@@ -11073,7 +11383,7 @@ const create$3 = () => {
|
|
|
11073
11383
|
};
|
|
11074
11384
|
|
|
11075
11385
|
const {
|
|
11076
|
-
invoke: invoke$
|
|
11386
|
+
invoke: invoke$4,
|
|
11077
11387
|
setFactory
|
|
11078
11388
|
} = createLazyRpc(CompletionWorker);
|
|
11079
11389
|
|
|
@@ -11092,10 +11402,10 @@ const newStateGenerator$3 = async (state, parentUid) => {
|
|
|
11092
11402
|
applicationId,
|
|
11093
11403
|
languageId
|
|
11094
11404
|
} = newState;
|
|
11095
|
-
await invoke$
|
|
11096
|
-
await invoke$
|
|
11097
|
-
const diff = await invoke$
|
|
11098
|
-
const commands = await invoke$
|
|
11405
|
+
await invoke$4('Completions.create', uid, x, y, width, height, parentUid, languageId, applicationId);
|
|
11406
|
+
await invoke$4('Completions.loadContent', uid);
|
|
11407
|
+
const diff = await invoke$4('Completions.diff2', uid);
|
|
11408
|
+
const commands = await invoke$4('Completions.render2', uid, diff);
|
|
11099
11409
|
return {
|
|
11100
11410
|
...state,
|
|
11101
11411
|
commands
|
|
@@ -11225,7 +11535,7 @@ const launch = async () => {
|
|
|
11225
11535
|
const rpc = await launchFindWidgetWorker();
|
|
11226
11536
|
set$h(rpcId, rpc);
|
|
11227
11537
|
};
|
|
11228
|
-
const invoke$
|
|
11538
|
+
const invoke$3 = async (method, ...params) => {
|
|
11229
11539
|
const rpc = get$9(rpcId);
|
|
11230
11540
|
return await rpc.invoke(method, ...params);
|
|
11231
11541
|
};
|
|
@@ -11256,7 +11566,7 @@ const getOrCreate$1 = () => {
|
|
|
11256
11566
|
}
|
|
11257
11567
|
return state$2.workerPromise;
|
|
11258
11568
|
};
|
|
11259
|
-
const invoke$
|
|
11569
|
+
const invoke$2 = async (method, ...params) => {
|
|
11260
11570
|
const worker = await getOrCreate$1();
|
|
11261
11571
|
return await worker.invoke(method, ...params);
|
|
11262
11572
|
};
|
|
@@ -11276,7 +11586,7 @@ const getOrCreate = () => {
|
|
|
11276
11586
|
}
|
|
11277
11587
|
return state$1.workerPromise;
|
|
11278
11588
|
};
|
|
11279
|
-
const invoke$
|
|
11589
|
+
const invoke$1 = async (method, ...params) => {
|
|
11280
11590
|
const worker = await getOrCreate();
|
|
11281
11591
|
return await worker.invoke(method, ...params);
|
|
11282
11592
|
};
|
|
@@ -11286,15 +11596,15 @@ const getWidgetInvoke = widgetId => {
|
|
|
11286
11596
|
case ColorPicker$2:
|
|
11287
11597
|
return invoke$7;
|
|
11288
11598
|
case Completion:
|
|
11289
|
-
return invoke$5;
|
|
11290
|
-
case Find:
|
|
11291
11599
|
return invoke$4;
|
|
11292
|
-
case
|
|
11600
|
+
case Find:
|
|
11293
11601
|
return invoke$3;
|
|
11602
|
+
case Hover:
|
|
11603
|
+
return invoke$2;
|
|
11294
11604
|
case Rename$1:
|
|
11295
11605
|
return invoke$6;
|
|
11296
11606
|
case SourceAction$1:
|
|
11297
|
-
return invoke$
|
|
11607
|
+
return invoke$1;
|
|
11298
11608
|
default:
|
|
11299
11609
|
return undefined;
|
|
11300
11610
|
}
|
|
@@ -11554,10 +11864,10 @@ const loadContent$2 = async (state, parentUid) => {
|
|
|
11554
11864
|
y
|
|
11555
11865
|
} = editor;
|
|
11556
11866
|
await launch();
|
|
11557
|
-
await invoke$
|
|
11558
|
-
await invoke$
|
|
11559
|
-
const diff = await invoke$
|
|
11560
|
-
const commands = await invoke$
|
|
11867
|
+
await invoke$3('FindWidget.create', uid, x, y, width, height, parentUid);
|
|
11868
|
+
await invoke$3('FindWidget.loadContent', uid);
|
|
11869
|
+
const diff = await invoke$3('FindWidget.diff2', uid);
|
|
11870
|
+
const commands = await invoke$3('FindWidget.render2', uid, diff);
|
|
11561
11871
|
return {
|
|
11562
11872
|
...state,
|
|
11563
11873
|
commands
|
|
@@ -12506,7 +12816,7 @@ const getSignatureHelpWidgetBounds = (editor, rowIndex, columnIndex, lineCount,
|
|
|
12506
12816
|
};
|
|
12507
12817
|
};
|
|
12508
12818
|
|
|
12509
|
-
const getTextDocument
|
|
12819
|
+
const getTextDocument = editor => {
|
|
12510
12820
|
return {
|
|
12511
12821
|
documentId: editor.id || editor.uid,
|
|
12512
12822
|
languageId: editor.languageId,
|
|
@@ -12517,7 +12827,7 @@ const getTextDocument$1 = editor => {
|
|
|
12517
12827
|
const executeSignatureHelpProvider = async (editor, offset) => {
|
|
12518
12828
|
object(editor);
|
|
12519
12829
|
number(offset);
|
|
12520
|
-
const textDocument = getTextDocument
|
|
12830
|
+
const textDocument = getTextDocument(editor);
|
|
12521
12831
|
return invoke$8(editor.applicationId, 'Extensions.executeSignatureHelpProvider', textDocument, offset);
|
|
12522
12832
|
};
|
|
12523
12833
|
|
|
@@ -12654,10 +12964,10 @@ const newStateGenerator = async (state, parentUid) => {
|
|
|
12654
12964
|
const {
|
|
12655
12965
|
languageId
|
|
12656
12966
|
} = newState;
|
|
12657
|
-
await invoke$
|
|
12658
|
-
await invoke$
|
|
12659
|
-
const diff = await invoke$
|
|
12660
|
-
const commands = await invoke$
|
|
12967
|
+
await invoke$1('SourceActions.create', uid, x, y, width, height, parentUid, languageId);
|
|
12968
|
+
await invoke$1('SourceActions.loadContent', uid);
|
|
12969
|
+
const diff = await invoke$1('SourceActions.diff2', uid);
|
|
12970
|
+
const commands = await invoke$1('SourceActions.render2', uid, diff);
|
|
12661
12971
|
return {
|
|
12662
12972
|
...state,
|
|
12663
12973
|
commands
|
|
@@ -13647,6 +13957,7 @@ const loadContent$1 = async (editorUid, state, position) => {
|
|
|
13647
13957
|
}
|
|
13648
13958
|
const {
|
|
13649
13959
|
documentation,
|
|
13960
|
+
documentationVirtualDom,
|
|
13650
13961
|
height,
|
|
13651
13962
|
lineInfos,
|
|
13652
13963
|
matchingDiagnostics,
|
|
@@ -13657,6 +13968,7 @@ const loadContent$1 = async (editorUid, state, position) => {
|
|
|
13657
13968
|
...state,
|
|
13658
13969
|
diagnostics: matchingDiagnostics,
|
|
13659
13970
|
documentation,
|
|
13971
|
+
documentationVirtualDom,
|
|
13660
13972
|
height,
|
|
13661
13973
|
lineInfos,
|
|
13662
13974
|
x,
|
|
@@ -14062,20 +14374,20 @@ const hoverSashNode = {
|
|
|
14062
14374
|
onPointerDown: HandleSashPointerDown,
|
|
14063
14375
|
type: Div
|
|
14064
14376
|
};
|
|
14065
|
-
const getChildCount = (lineInfos,
|
|
14066
|
-
const documentationCount =
|
|
14377
|
+
const getChildCount = (lineInfos, documentationVirtualDom, diagnostics) => {
|
|
14378
|
+
const documentationCount = documentationVirtualDom.length > 0 ? 1 : 0;
|
|
14067
14379
|
const diagnosticsCount = diagnostics && diagnostics.length > 0 ? 1 : 0;
|
|
14068
|
-
return lineInfos.length + documentationCount + diagnosticsCount;
|
|
14380
|
+
return (lineInfos.length > 0 ? 1 : 0) + documentationCount + diagnosticsCount;
|
|
14069
14381
|
};
|
|
14070
|
-
const getEditorHoverClassName = (lineInfos,
|
|
14071
|
-
const isDiagnosticOnly = diagnostics?.length === 1 && lineInfos.length === 0 &&
|
|
14382
|
+
const getEditorHoverClassName = (lineInfos, documentationVirtualDom, diagnostics) => {
|
|
14383
|
+
const isDiagnosticOnly = diagnostics?.length === 1 && lineInfos.length === 0 && documentationVirtualDom.length === 0;
|
|
14072
14384
|
return mergeClassNames('Viewlet', 'EditorHover', isDiagnosticOnly ? EditorHoverDiagnosticOnly : '');
|
|
14073
14385
|
};
|
|
14074
|
-
const getHoverVirtualDom = (lineInfos,
|
|
14386
|
+
const getHoverVirtualDom = (lineInfos, documentationVirtualDom, diagnostics) => {
|
|
14075
14387
|
const dom = [];
|
|
14076
14388
|
dom.push({
|
|
14077
|
-
childCount: getChildCount(lineInfos,
|
|
14078
|
-
className: getEditorHoverClassName(lineInfos,
|
|
14389
|
+
childCount: getChildCount(lineInfos, documentationVirtualDom, diagnostics) + 1,
|
|
14390
|
+
className: getEditorHoverClassName(lineInfos, documentationVirtualDom, diagnostics),
|
|
14079
14391
|
type: Div
|
|
14080
14392
|
});
|
|
14081
14393
|
if (diagnostics && diagnostics.length > 0) {
|
|
@@ -14096,8 +14408,8 @@ const getHoverVirtualDom = (lineInfos, documentation, diagnostics) => {
|
|
|
14096
14408
|
type: Div
|
|
14097
14409
|
}, ...lineInfosDom);
|
|
14098
14410
|
}
|
|
14099
|
-
if (
|
|
14100
|
-
dom.push(hoverDocumentationNode,
|
|
14411
|
+
if (documentationVirtualDom.length > 0) {
|
|
14412
|
+
dom.push(hoverDocumentationNode, ...documentationVirtualDom);
|
|
14101
14413
|
}
|
|
14102
14414
|
dom.push(hoverSashNode);
|
|
14103
14415
|
return dom;
|
|
@@ -14105,10 +14417,10 @@ const getHoverVirtualDom = (lineInfos, documentation, diagnostics) => {
|
|
|
14105
14417
|
|
|
14106
14418
|
const renderHoverDom = {
|
|
14107
14419
|
apply(oldState, newState) {
|
|
14108
|
-
const dom = getHoverVirtualDom(newState.lineInfos, newState.
|
|
14420
|
+
const dom = getHoverVirtualDom(newState.lineInfos, newState.documentationVirtualDom, newState.diagnostics);
|
|
14109
14421
|
return [/* method */SetDom2, dom];
|
|
14110
14422
|
},
|
|
14111
|
-
isEqual: (oldState, newState) => oldState.lineInfos === newState.lineInfos && oldState.
|
|
14423
|
+
isEqual: (oldState, newState) => oldState.lineInfos === newState.lineInfos && oldState.documentationVirtualDom === newState.documentationVirtualDom && oldState.diagnostics === newState.diagnostics
|
|
14112
14424
|
};
|
|
14113
14425
|
const renderBounds$2 = {
|
|
14114
14426
|
apply(oldState, newState) {
|
|
@@ -14425,7 +14737,7 @@ const getSourceActions = async editorUid => {
|
|
|
14425
14737
|
const actions = await getEditorSourceActions(editorUid);
|
|
14426
14738
|
return actions;
|
|
14427
14739
|
};
|
|
14428
|
-
const getDiagnostics
|
|
14740
|
+
const getDiagnostics = async editorUid => {
|
|
14429
14741
|
const editor = getEditor$1(editorUid);
|
|
14430
14742
|
const {
|
|
14431
14743
|
diagnostics
|
|
@@ -15240,9 +15552,9 @@ const updateFindWidget = async state => {
|
|
|
15240
15552
|
const {
|
|
15241
15553
|
uid
|
|
15242
15554
|
} = widget.newState;
|
|
15243
|
-
await invoke$
|
|
15244
|
-
const diff = await invoke$
|
|
15245
|
-
const commands = await invoke$
|
|
15555
|
+
await invoke$3('FindWidget.handleSettingsChanged', uid);
|
|
15556
|
+
const diff = await invoke$3('FindWidget.diff2', uid);
|
|
15557
|
+
const commands = await invoke$3('FindWidget.render2', uid, diff);
|
|
15246
15558
|
return updateWidget(state, Find, {
|
|
15247
15559
|
...widget.newState,
|
|
15248
15560
|
commands
|
|
@@ -15337,7 +15649,7 @@ const getWidgetHotReloadDescriptor = widgetId => {
|
|
|
15337
15649
|
switch (widgetId) {
|
|
15338
15650
|
case Find:
|
|
15339
15651
|
return {
|
|
15340
|
-
invoke: invoke$
|
|
15652
|
+
invoke: invoke$3,
|
|
15341
15653
|
name: 'FindWidget'
|
|
15342
15654
|
};
|
|
15343
15655
|
default:
|
|
@@ -15478,7 +15790,7 @@ const sendMessagePortToSyntaxHighlightingWorker = async port => {
|
|
|
15478
15790
|
await sendMessagePortToSyntaxHighlightingWorker$1(port);
|
|
15479
15791
|
} catch {
|
|
15480
15792
|
// deprecated
|
|
15481
|
-
await invokeAndTransfer(
|
|
15793
|
+
await invokeAndTransfer$1(
|
|
15482
15794
|
// @ts-ignore
|
|
15483
15795
|
'SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker', port, 'HandleMessagePort.handleMessagePort');
|
|
15484
15796
|
}
|
|
@@ -17228,13 +17540,13 @@ const unregisterListener = (listenerType, rpcId) => {
|
|
|
17228
17540
|
unregisterListener$1(listenerType, rpcId);
|
|
17229
17541
|
};
|
|
17230
17542
|
|
|
17231
|
-
const invoke
|
|
17543
|
+
const invoke = async (method, ...params) => {
|
|
17232
17544
|
const worker = get$9(DebugWorker);
|
|
17233
17545
|
return worker.invoke(method, ...params);
|
|
17234
17546
|
};
|
|
17235
17547
|
|
|
17236
17548
|
const getDebugHighlight = async debugId => {
|
|
17237
|
-
const newInfo = await invoke
|
|
17549
|
+
const newInfo = await invoke('RunAndDebug.getHighlight', debugId);
|
|
17238
17550
|
return newInfo;
|
|
17239
17551
|
};
|
|
17240
17552
|
|
|
@@ -17262,186 +17574,6 @@ const updateDebugInfo = async debugId => {
|
|
|
17262
17574
|
await invoke$d('Editor.rerender', key);
|
|
17263
17575
|
};
|
|
17264
17576
|
|
|
17265
|
-
const queues = {};
|
|
17266
|
-
const enqueue = async (uid, callback) => {
|
|
17267
|
-
const instance = get$8(uid);
|
|
17268
|
-
if (!instance) {
|
|
17269
|
-
return undefined;
|
|
17270
|
-
}
|
|
17271
|
-
const {
|
|
17272
|
-
applicationId,
|
|
17273
|
-
uri
|
|
17274
|
-
} = instance.newState;
|
|
17275
|
-
const key = JSON.stringify([applicationId ?? null, uri || uid]);
|
|
17276
|
-
const previous = queues[key];
|
|
17277
|
-
const {
|
|
17278
|
-
promise,
|
|
17279
|
-
resolve
|
|
17280
|
-
} = Promise.withResolvers();
|
|
17281
|
-
queues[key] = promise;
|
|
17282
|
-
if (previous) {
|
|
17283
|
-
await previous;
|
|
17284
|
-
}
|
|
17285
|
-
try {
|
|
17286
|
-
return await callback();
|
|
17287
|
-
} finally {
|
|
17288
|
-
resolve();
|
|
17289
|
-
if (queues[key] === promise) {
|
|
17290
|
-
delete queues[key];
|
|
17291
|
-
}
|
|
17292
|
-
}
|
|
17293
|
-
};
|
|
17294
|
-
|
|
17295
|
-
const getTextDocument = editor => {
|
|
17296
|
-
return {
|
|
17297
|
-
documentId: editor.id || editor.uid,
|
|
17298
|
-
languageId: editor.languageId,
|
|
17299
|
-
text: getText$1(editor),
|
|
17300
|
-
uri: editor.uri
|
|
17301
|
-
};
|
|
17302
|
-
};
|
|
17303
|
-
const executeIsolatedDiagnosticProvider = async editor => {
|
|
17304
|
-
const textDocument = getTextDocument(editor);
|
|
17305
|
-
return invoke$8(editor.applicationId, 'Extensions.executeDiagnosticProvider', textDocument);
|
|
17306
|
-
};
|
|
17307
|
-
const executeDiagnosticProvider = async editor => {
|
|
17308
|
-
return executeIsolatedDiagnosticProvider(editor);
|
|
17309
|
-
};
|
|
17310
|
-
|
|
17311
|
-
const invoke = (...args) => invoke$d(...args);
|
|
17312
|
-
|
|
17313
|
-
/**
|
|
17314
|
-
* Merges link decorations with diagnostic decorations
|
|
17315
|
-
* Links should always be present, but we also need to include any diagnostic decorations
|
|
17316
|
-
*/
|
|
17317
|
-
const mergeLinksWithDiagnosticDecorations = (editor, diagnosticDecorations) => {
|
|
17318
|
-
// Get link decorations
|
|
17319
|
-
const linkDecorations = detectAllLinksAsDecorations(editor);
|
|
17320
|
-
|
|
17321
|
-
// Merge with diagnostic decorations
|
|
17322
|
-
const allDecorations = [...linkDecorations, ...diagnosticDecorations];
|
|
17323
|
-
|
|
17324
|
-
// Sort by offset to maintain proper order
|
|
17325
|
-
const sortedDecorations = [];
|
|
17326
|
-
for (let i = 0; i < allDecorations.length; i += 4) {
|
|
17327
|
-
sortedDecorations.push({
|
|
17328
|
-
length: allDecorations[i + 1],
|
|
17329
|
-
modifiers: allDecorations[i + 3],
|
|
17330
|
-
offset: allDecorations[i],
|
|
17331
|
-
type: allDecorations[i + 2]
|
|
17332
|
-
});
|
|
17333
|
-
}
|
|
17334
|
-
sortedDecorations.sort((a, b) => a.offset - b.offset);
|
|
17335
|
-
|
|
17336
|
-
// Flatten back to array format
|
|
17337
|
-
const result = [];
|
|
17338
|
-
for (const dec of sortedDecorations) {
|
|
17339
|
-
result.push(dec.offset, dec.length, dec.type, dec.modifiers);
|
|
17340
|
-
}
|
|
17341
|
-
return result;
|
|
17342
|
-
};
|
|
17343
|
-
|
|
17344
|
-
const getDiagnostics = async editor => {
|
|
17345
|
-
return executeDiagnosticProvider(editor);
|
|
17346
|
-
};
|
|
17347
|
-
const addDiagnostics = async (editor, diagnostics) => {
|
|
17348
|
-
const visualDecorations = await getVisibleDiagnostics(editor, diagnostics);
|
|
17349
|
-
const diagnosticDecorations = visualDecorations.flatMap(decoration => [decoration.offset, decoration.length, decoration.type, decoration.modifiers || 0]);
|
|
17350
|
-
const decorations = mergeLinksWithDiagnosticDecorations(editor, diagnosticDecorations);
|
|
17351
|
-
return {
|
|
17352
|
-
...editor,
|
|
17353
|
-
decorations,
|
|
17354
|
-
diagnostics,
|
|
17355
|
-
lightBulbRowIndex: -1,
|
|
17356
|
-
visualDecorations
|
|
17357
|
-
};
|
|
17358
|
-
};
|
|
17359
|
-
const handleError = async (error, editor) => {
|
|
17360
|
-
if (error instanceof Error && error.message.includes('No diagnostic provider found')) {
|
|
17361
|
-
return editor;
|
|
17362
|
-
}
|
|
17363
|
-
await handleError$1(error, 'Failed to update diagnostics: ');
|
|
17364
|
-
return editor;
|
|
17365
|
-
};
|
|
17366
|
-
const notifyDiagnosticsChange = async (uri, applicationId) => {
|
|
17367
|
-
try {
|
|
17368
|
-
await invoke$9(applicationId, 'Layout.handleDiagnosticsChange', uri);
|
|
17369
|
-
} catch {
|
|
17370
|
-
// Older renderer workers do not support diagnostics change listeners.
|
|
17371
|
-
}
|
|
17372
|
-
};
|
|
17373
|
-
const diagnosticsEqual = (left, right) => {
|
|
17374
|
-
if (left === right) {
|
|
17375
|
-
return true;
|
|
17376
|
-
}
|
|
17377
|
-
if ((left?.length ?? 0) !== right.length) {
|
|
17378
|
-
return false;
|
|
17379
|
-
}
|
|
17380
|
-
return right.every((diagnostic, index) => {
|
|
17381
|
-
const other = left[index];
|
|
17382
|
-
return other.code === diagnostic.code && other.columnIndex === diagnostic.columnIndex && other.endColumnIndex === diagnostic.endColumnIndex && other.endRowIndex === diagnostic.endRowIndex && other.message === diagnostic.message && other.rowIndex === diagnostic.rowIndex && other.source === diagnostic.source && other.type === diagnostic.type && other.uri === diagnostic.uri;
|
|
17383
|
-
});
|
|
17384
|
-
};
|
|
17385
|
-
const diagnosticLayoutEqual = (left, right) => left.charWidth === right.charWidth && left.deltaY === right.deltaY && left.fontFamily === right.fontFamily && left.fontSize === right.fontSize && left.fontWeight === right.fontWeight && left.isMonospaceFont === right.isMonospaceFont && left.itemHeight === right.itemHeight && left.letterSpacing === right.letterSpacing && left.lines === right.lines && left.minLineY === right.minLineY && left.rowHeight === right.rowHeight && left.tabSize === right.tabSize && left.viewLineIndices === right.viewLineIndices && left.width === right.width;
|
|
17386
|
-
const isApplicable = (latest, editor) => latest && latest.newState.diagnosticsEnabled && !latest.newState.loadError && latest.newState.diagnostics === editor.diagnostics && latest.newState.languageId === editor.languageId && latest.newState.lines === editor.lines && latest.newState.uri === editor.uri;
|
|
17387
|
-
const mergeDiagnostics = (editor, editorWithDiagnostics) => ({
|
|
17388
|
-
...editor,
|
|
17389
|
-
decorations: editorWithDiagnostics.decorations,
|
|
17390
|
-
diagnostics: editorWithDiagnostics.diagnostics,
|
|
17391
|
-
lightBulbRowIndex: editorWithDiagnostics.lightBulbRowIndex,
|
|
17392
|
-
visualDecorations: editorWithDiagnostics.visualDecorations
|
|
17393
|
-
});
|
|
17394
|
-
const updateDiagnostics = async editor => {
|
|
17395
|
-
if (!editor.diagnosticsEnabled || editor.loadError) {
|
|
17396
|
-
return editor;
|
|
17397
|
-
}
|
|
17398
|
-
try {
|
|
17399
|
-
const diagnostics = await getDiagnostics(editor);
|
|
17400
|
-
return (await enqueue(editor.id, async () => {
|
|
17401
|
-
let latest = get$8(editor.id);
|
|
17402
|
-
if (!isApplicable(latest, editor)) {
|
|
17403
|
-
return editor;
|
|
17404
|
-
}
|
|
17405
|
-
if (diagnosticsEqual(latest.newState.diagnostics, diagnostics)) {
|
|
17406
|
-
return latest.newState;
|
|
17407
|
-
}
|
|
17408
|
-
let calculationState = latest.newState;
|
|
17409
|
-
let editorWithDiagnostics = await addDiagnostics(calculationState, diagnostics);
|
|
17410
|
-
latest = get$8(editor.id);
|
|
17411
|
-
while (isApplicable(latest, editor) && !diagnosticLayoutEqual(calculationState, latest.newState)) {
|
|
17412
|
-
calculationState = latest.newState;
|
|
17413
|
-
editorWithDiagnostics = await addDiagnostics(calculationState, diagnostics);
|
|
17414
|
-
latest = get$8(editor.id);
|
|
17415
|
-
}
|
|
17416
|
-
if (!isApplicable(latest, editor)) {
|
|
17417
|
-
return editor;
|
|
17418
|
-
}
|
|
17419
|
-
if (diagnosticsEqual(latest.newState.diagnostics, diagnostics)) {
|
|
17420
|
-
return latest.newState;
|
|
17421
|
-
}
|
|
17422
|
-
const newEditor = mergeDiagnostics(latest.newState, editorWithDiagnostics);
|
|
17423
|
-
set$8(editor.id, latest.oldState, newEditor);
|
|
17424
|
-
await invoke('Editor.renderPending', newEditor.id);
|
|
17425
|
-
await notifyDiagnosticsChange(newEditor.uri, newEditor.applicationId);
|
|
17426
|
-
return newEditor;
|
|
17427
|
-
})) ?? editor;
|
|
17428
|
-
} catch (error) {
|
|
17429
|
-
return handleError(error, editor);
|
|
17430
|
-
}
|
|
17431
|
-
};
|
|
17432
|
-
const requestDiagnostics = editor => {
|
|
17433
|
-
void updateDiagnostics(editor);
|
|
17434
|
-
return editor;
|
|
17435
|
-
};
|
|
17436
|
-
const updateDiagnosticsAll = async () => {
|
|
17437
|
-
for (const key of getKeys$2()) {
|
|
17438
|
-
const editor = get$8(Number(key))?.newState;
|
|
17439
|
-
if (editor) {
|
|
17440
|
-
await updateDiagnostics(editor);
|
|
17441
|
-
}
|
|
17442
|
-
}
|
|
17443
|
-
};
|
|
17444
|
-
|
|
17445
17577
|
const editorDiagnosticEffect = {
|
|
17446
17578
|
// TODO set effects delay / diagnostic delay
|
|
17447
17579
|
apply(editor) {
|
|
@@ -17678,7 +17810,7 @@ const commandMap = {
|
|
|
17678
17810
|
'Editor.fold': wrapCommand(fold$1),
|
|
17679
17811
|
'Editor.format': wrapCommand(format),
|
|
17680
17812
|
'Editor.getCommandIds': getCommandIds,
|
|
17681
|
-
'Editor.getDiagnostics': getDiagnostics
|
|
17813
|
+
'Editor.getDiagnostics': getDiagnostics,
|
|
17682
17814
|
'Editor.getKeyBindings': getKeyBindings,
|
|
17683
17815
|
'Editor.getKeys': getKeys,
|
|
17684
17816
|
'Editor.getLanguageId': getLanguageId,
|
|
@@ -17903,6 +18035,7 @@ const commandMap = {
|
|
|
17903
18035
|
'Listener.register': registerListener,
|
|
17904
18036
|
'Listener.registerListener': registerListener,
|
|
17905
18037
|
'Listener.unregister': unregisterListener,
|
|
18038
|
+
'Markdown.getVirtualDomFromMarkdown': getVirtualDomFromMarkdown,
|
|
17906
18039
|
'SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker': sendDeprecatedExtensionHostPortToExtensionManagementWorker,
|
|
17907
18040
|
'SendMessagePortToExtensionManagementWorker.sendMessagePortToExtensionManagementWorker': sendMessagePortToExtensionManagementWorker
|
|
17908
18041
|
};
|
|
@@ -18248,7 +18381,7 @@ const render$1 = widget => {
|
|
|
18248
18381
|
newState,
|
|
18249
18382
|
oldState
|
|
18250
18383
|
} = widget;
|
|
18251
|
-
const commands = newState.commands.length > 0 ? renderFull$3(oldState, newState) : [[SetDom2, newState.uid, getHoverVirtualDom(newState.lineInfos, newState.
|
|
18384
|
+
const commands = newState.commands.length > 0 ? renderFull$3(oldState, newState) : [[SetDom2, newState.uid, getHoverVirtualDom(newState.lineInfos, newState.documentationVirtualDom, newState.diagnostics)], [SetBounds2, newState.uid, newState.x, newState.y, newState.width, newState.height]];
|
|
18252
18385
|
const wrappedCommands = [];
|
|
18253
18386
|
const {
|
|
18254
18387
|
uid
|