@lvce-editor/editor-worker 12.2.0 → 12.3.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 +19 -20
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -3464,9 +3464,10 @@ const updateDiagnostics = async newState => {
|
|
|
3464
3464
|
} catch (error) {
|
|
3465
3465
|
// @ts-ignore
|
|
3466
3466
|
if (error && error.message.includes('No diagnostic provider found')) {
|
|
3467
|
-
return;
|
|
3467
|
+
return newState;
|
|
3468
3468
|
}
|
|
3469
3469
|
console.error(`Failed to update diagnostics: ${error}`);
|
|
3470
|
+
return newState;
|
|
3470
3471
|
}
|
|
3471
3472
|
};
|
|
3472
3473
|
|
|
@@ -7825,7 +7826,21 @@ const tabCompletion = async editor => {
|
|
|
7825
7826
|
}
|
|
7826
7827
|
};
|
|
7827
7828
|
|
|
7828
|
-
const getBlockComment = async editor => {
|
|
7829
|
+
const getBlockComment = async (editor, offset) => {
|
|
7830
|
+
// TODO ask extension host worker,
|
|
7831
|
+
// execute block comment provider with
|
|
7832
|
+
// uri, language id, offset
|
|
7833
|
+
// and the extension returns a matching block comment or undefined
|
|
7834
|
+
try {
|
|
7835
|
+
await activateByEvent(`onLanguage:${editor.languageId}`);
|
|
7836
|
+
// @ts-ignore
|
|
7837
|
+
const blockComment = await invoke$6(`ExtensionHostCommment.execute`, editor.uid, offset);
|
|
7838
|
+
if (blockComment) {
|
|
7839
|
+
return blockComment;
|
|
7840
|
+
}
|
|
7841
|
+
} catch {
|
|
7842
|
+
// ignore
|
|
7843
|
+
}
|
|
7829
7844
|
const languageConfiguration = await getLanguageConfiguration(editor);
|
|
7830
7845
|
if (!languageConfiguration?.comments?.blockComment) {
|
|
7831
7846
|
return undefined;
|
|
@@ -8020,7 +8035,8 @@ const getBlockCommentEdits = (editor, blockComment) => {
|
|
|
8020
8035
|
};
|
|
8021
8036
|
|
|
8022
8037
|
const toggleBlockComment = async editor => {
|
|
8023
|
-
const
|
|
8038
|
+
const offset = getOffsetAtCursor$1(editor);
|
|
8039
|
+
const blockComment = await getBlockComment(editor, offset);
|
|
8024
8040
|
if (!blockComment) {
|
|
8025
8041
|
return editor;
|
|
8026
8042
|
}
|
|
@@ -10555,17 +10571,6 @@ const updateDebugInfo = async debugId => {
|
|
|
10555
10571
|
await invoke$9('Editor.rerender', key);
|
|
10556
10572
|
};
|
|
10557
10573
|
|
|
10558
|
-
const editorDiagnosticEffect = {
|
|
10559
|
-
isActive(oldEditor, newEditor) {
|
|
10560
|
-
// TODO avoid slow comparison
|
|
10561
|
-
return newEditor.diagnosticsEnabled && JSON.stringify(oldEditor.lines) !== JSON.stringify(newEditor.lines);
|
|
10562
|
-
},
|
|
10563
|
-
// TODO set effects delay / diagnostic delay
|
|
10564
|
-
async apply(editor) {
|
|
10565
|
-
await updateDiagnostics(editor);
|
|
10566
|
-
}
|
|
10567
|
-
};
|
|
10568
|
-
|
|
10569
10574
|
const keep = ['ActivateByEvent.activateByEvent', 'ExtensionHostManagement.activateByEvent', 'Editor.applyEdit2', 'Editor.applyEdits2', 'Editor.closeFind2', 'Editor.closeWidget2', 'Editor.create', 'Editor.getKeyBindings', 'Editor.getSourceActions', 'Editor.getLines2', 'Editor.getPositionAtCursor', 'Editor.getOffsetAtCursor', 'Editor.getQuickPickMenuEntries', 'Editor.getSelections', 'Editor.hotReload', 'Editor.getSelections2', 'Editor.getDiagnostics', 'Editor.getText', 'Editor.getWordAt', 'Editor.getWordAt2', 'Editor.getWordAtOffset2', 'Editor.getUri', 'Editor.getWordBefore', 'Editor.getWordBefore2', 'Editor.offsetAt', 'Editor.render', 'Editor.setSelections2', 'Editor.updateDebugInfo', 'Editor.getLanguageId', 'Editor.getProblems', 'Editor.getKeys', 'Font.ensure', 'HandleMessagePort.handleMessagePort', 'Hover.getHoverInfo', 'Hover.handleSashPointerDown', 'Hover.handleSashPointerMove', 'Hover.handleSashPointerUp', 'Hover.loadContent', 'Hover.render', 'Initialize.initialize', 'SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker'
|
|
10570
10575
|
// 'ColorPicker.handleSliderPointerDown',
|
|
10571
10576
|
// 'ColorPicker.handleSliderPointerMove',
|
|
@@ -10596,7 +10601,6 @@ const widgetCommands = {
|
|
|
10596
10601
|
// TODO wrap commands globally, not per editor
|
|
10597
10602
|
// TODO only store editor state in editor worker, not in renderer worker also
|
|
10598
10603
|
|
|
10599
|
-
const effects = [editorDiagnosticEffect];
|
|
10600
10604
|
const wrapCommand = fn => async (editorUid, ...args) => {
|
|
10601
10605
|
const oldInstance = get$4(editorUid);
|
|
10602
10606
|
const state = oldInstance.newState;
|
|
@@ -10604,11 +10608,6 @@ const wrapCommand = fn => async (editorUid, ...args) => {
|
|
|
10604
10608
|
if (state === newEditor) {
|
|
10605
10609
|
return newEditor;
|
|
10606
10610
|
}
|
|
10607
|
-
for (const effect of effects) {
|
|
10608
|
-
if (effect.isActive(oldInstance.newState, newEditor)) {
|
|
10609
|
-
effect.apply(newEditor);
|
|
10610
|
-
}
|
|
10611
|
-
}
|
|
10612
10611
|
// TODO if editor did not change, no need to update furthur
|
|
10613
10612
|
|
|
10614
10613
|
// TODO combine neweditor with latest editor?
|