@lvce-editor/editor-worker 19.69.9 → 19.69.10
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 +23 -18
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -6393,13 +6393,14 @@ const mergeDiagnostics = (editor, editorWithDiagnostics) => ({
|
|
|
6393
6393
|
lightBulbRowIndex: editorWithDiagnostics.lightBulbRowIndex,
|
|
6394
6394
|
visualDecorations: editorWithDiagnostics.visualDecorations
|
|
6395
6395
|
});
|
|
6396
|
-
const commitDiagnostics = async (editor, generation, diagnostics) => {
|
|
6396
|
+
const commitDiagnostics = async (editor, generation, diagnostics, onAccepted) => {
|
|
6397
6397
|
return (await enqueue(editor.id, async () => {
|
|
6398
6398
|
let latest = get$8(editor.id);
|
|
6399
6399
|
if (!isApplicable(latest, editor, generation)) {
|
|
6400
6400
|
return editor;
|
|
6401
6401
|
}
|
|
6402
6402
|
if (diagnosticsEqual(latest.newState.diagnostics, diagnostics)) {
|
|
6403
|
+
onAccepted?.();
|
|
6403
6404
|
return latest.newState;
|
|
6404
6405
|
}
|
|
6405
6406
|
let calculationState = latest.newState;
|
|
@@ -6419,6 +6420,7 @@ const commitDiagnostics = async (editor, generation, diagnostics) => {
|
|
|
6419
6420
|
const newEditor = mergeDiagnostics(latest.newState, editorWithDiagnostics);
|
|
6420
6421
|
set$9(editor.id, latest.oldState, newEditor);
|
|
6421
6422
|
requestDiagnosticSnapshots.set(editor.id, diagnostics);
|
|
6423
|
+
onAccepted?.();
|
|
6422
6424
|
await invoke$5('Editor.renderPending', newEditor.id);
|
|
6423
6425
|
await notifyDiagnosticsChange(newEditor.uri, newEditor.applicationId);
|
|
6424
6426
|
return newEditor;
|
|
@@ -6429,6 +6431,13 @@ const flattenProviderDiagnostics = providers => {
|
|
|
6429
6431
|
diagnostics
|
|
6430
6432
|
}) => diagnostics);
|
|
6431
6433
|
};
|
|
6434
|
+
const saveProviderResults = (editor, providers) => {
|
|
6435
|
+
previousProviderResults.set(editor.id, {
|
|
6436
|
+
languageId: editor.languageId,
|
|
6437
|
+
providers: new Map(providers),
|
|
6438
|
+
uri: editor.uri
|
|
6439
|
+
});
|
|
6440
|
+
};
|
|
6432
6441
|
const updateDiagnostics = async editor => {
|
|
6433
6442
|
if (!editor.diagnosticsEnabled || editor.loadError) {
|
|
6434
6443
|
return editor;
|
|
@@ -6438,7 +6447,7 @@ const updateDiagnostics = async editor => {
|
|
|
6438
6447
|
requestDiagnosticSnapshots.set(editor.id, get$8(editor.id)?.newState.diagnostics ?? editor.diagnostics);
|
|
6439
6448
|
const providers = new Map();
|
|
6440
6449
|
const previous = previousProviderResults.get(editor.id);
|
|
6441
|
-
if (previous && previous.languageId === editor.languageId && previous.
|
|
6450
|
+
if (previous && previous.languageId === editor.languageId && previous.uri === editor.uri) {
|
|
6442
6451
|
for (const [providerId, result] of previous.providers) {
|
|
6443
6452
|
providers.set(providerId, result);
|
|
6444
6453
|
}
|
|
@@ -6477,6 +6486,9 @@ const updateDiagnostics = async editor => {
|
|
|
6477
6486
|
providers.delete(providerId);
|
|
6478
6487
|
}
|
|
6479
6488
|
}
|
|
6489
|
+
if (requestGenerations.get(editor.id) === generation) {
|
|
6490
|
+
saveProviderResults(editor, providers);
|
|
6491
|
+
}
|
|
6480
6492
|
return;
|
|
6481
6493
|
}
|
|
6482
6494
|
if (message.type === 'result' && message.providerId !== undefined) {
|
|
@@ -6484,20 +6496,17 @@ const updateDiagnostics = async editor => {
|
|
|
6484
6496
|
diagnostics: message.diagnostics ?? [],
|
|
6485
6497
|
providerIndex: message.providerIndex ?? providers.size
|
|
6486
6498
|
});
|
|
6487
|
-
await commitDiagnostics(editor, generation, flattenProviderDiagnostics(providers));
|
|
6499
|
+
await commitDiagnostics(editor, generation, flattenProviderDiagnostics(providers), () => saveProviderResults(editor, providers));
|
|
6488
6500
|
return;
|
|
6489
6501
|
}
|
|
6490
6502
|
if (message.type === 'done') {
|
|
6491
6503
|
if (providerCount === 0) {
|
|
6492
6504
|
providers.clear();
|
|
6493
|
-
await commitDiagnostics(editor, generation, []);
|
|
6505
|
+
await commitDiagnostics(editor, generation, [], () => saveProviderResults(editor, providers));
|
|
6506
|
+
}
|
|
6507
|
+
if (requestGenerations.get(editor.id) === generation) {
|
|
6508
|
+
saveProviderResults(editor, providers);
|
|
6494
6509
|
}
|
|
6495
|
-
previousProviderResults.set(editor.id, {
|
|
6496
|
-
languageId: editor.languageId,
|
|
6497
|
-
lines: editor.lines,
|
|
6498
|
-
providers: new Map(providers),
|
|
6499
|
-
uri: editor.uri
|
|
6500
|
-
});
|
|
6501
6510
|
port1.close();
|
|
6502
6511
|
completed.resolve();
|
|
6503
6512
|
}
|
|
@@ -6516,13 +6525,7 @@ const updateDiagnostics = async editor => {
|
|
|
6516
6525
|
diagnostics: response,
|
|
6517
6526
|
providerIndex: 0
|
|
6518
6527
|
});
|
|
6519
|
-
await commitDiagnostics(editor, generation, response);
|
|
6520
|
-
previousProviderResults.set(editor.id, {
|
|
6521
|
-
languageId: editor.languageId,
|
|
6522
|
-
lines: editor.lines,
|
|
6523
|
-
providers: new Map(providers),
|
|
6524
|
-
uri: editor.uri
|
|
6525
|
-
});
|
|
6528
|
+
await commitDiagnostics(editor, generation, response, () => saveProviderResults(editor, providers));
|
|
6526
6529
|
port1.close();
|
|
6527
6530
|
completed.resolve();
|
|
6528
6531
|
}
|
|
@@ -10384,12 +10387,14 @@ const getEditorHoverInfo = async (editorUid, position) => {
|
|
|
10384
10387
|
const wordPart = getWordBefore(editor, rowIndex, columnIndex);
|
|
10385
10388
|
const wordStart = columnIndex - wordPart.length;
|
|
10386
10389
|
const documentationHeight = documentation ? await measureTextBlockHeight(documentation, hoverDocumentationFontFamily, hoverDocumentationFontSize, hoverDocumentationLineHeight, hoverDocumentationWidth) : 0;
|
|
10390
|
+
const measuredDisplayStringHeight = displayString ? await measureTextBlockHeight(displayString, editor.fontFamily, editor.fontSize, `${editor.rowHeight}px`, hoverDocumentationWidth) : 0;
|
|
10391
|
+
const displayStringHeight = displayString ? measuredDisplayStringHeight + (measuredDisplayStringHeight > editor.rowHeight ? editor.rowHeight : 0) + 12 : 0;
|
|
10387
10392
|
let diagnosticText = '';
|
|
10388
10393
|
for (const diagnostic of matchingDiagnostics) {
|
|
10389
10394
|
diagnosticText += `${diagnosticText ? '\n' : ''}${diagnostic.message} ${diagnostic.source} (${diagnostic.code})`;
|
|
10390
10395
|
}
|
|
10391
10396
|
const diagnosticsHeight = diagnosticText ? (await measureTextBlockHeight(diagnosticText, editor.fontFamily, editor.fontSize, `${editor.rowHeight}px`, hoverDocumentationWidth)) + 10 : 0;
|
|
10392
|
-
const height = Math.min(diagnosticsHeight +
|
|
10397
|
+
const height = Math.min(diagnosticsHeight + displayStringHeight + (documentation ? documentationHeight + 11 : 0) || 20, editor.height);
|
|
10393
10398
|
const x$1 = Math.max(editor.x, Math.min(x(editor, rowIndex, wordStart), editor.x + editor.width - hoverWidth));
|
|
10394
10399
|
const rowBottom = y(editor, rowIndex);
|
|
10395
10400
|
const y$1 = rowBottom + height <= editor.y + editor.height ? rowBottom : Math.max(editor.y, rowBottom - editor.rowHeight - height);
|