@lvce-editor/editor-worker 19.66.5 → 19.66.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 +51 -15
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -6433,6 +6433,15 @@ const closeWidgetsMaybe = widgets => {
|
|
|
6433
6433
|
return widgets.filter(widget => isPersistentWidget(widget.id));
|
|
6434
6434
|
};
|
|
6435
6435
|
|
|
6436
|
+
const hasWidget = (widgets, id) => {
|
|
6437
|
+
for (const widget of widgets) {
|
|
6438
|
+
if (widget.id === id) {
|
|
6439
|
+
return true;
|
|
6440
|
+
}
|
|
6441
|
+
}
|
|
6442
|
+
return false;
|
|
6443
|
+
};
|
|
6444
|
+
|
|
6436
6445
|
const logError = async (error, prefix) => {
|
|
6437
6446
|
const prettyError = await invoke$h('Errors.prepare', error);
|
|
6438
6447
|
await invoke$h('Errors.print', prettyError, prefix);
|
|
@@ -6869,9 +6878,13 @@ const handleBlur$1 = async editor => {
|
|
|
6869
6878
|
return editor;
|
|
6870
6879
|
}
|
|
6871
6880
|
const widgetRevision = next(editor.uid);
|
|
6881
|
+
const completionWidgetDismissedOnBlur = hasWidget([...(editor.widgets || [])], Completion);
|
|
6872
6882
|
const newEditor = {
|
|
6873
6883
|
...editor,
|
|
6874
6884
|
additionalFocus: 0,
|
|
6885
|
+
...(completionWidgetDismissedOnBlur && {
|
|
6886
|
+
completionWidgetDismissedOnBlur: true
|
|
6887
|
+
}),
|
|
6875
6888
|
focused: false,
|
|
6876
6889
|
widgetRevision,
|
|
6877
6890
|
widgets: closeWidgetsMaybe(editor.widgets || [])
|
|
@@ -7394,15 +7407,6 @@ const closeSourceAction = editor => {
|
|
|
7394
7407
|
};
|
|
7395
7408
|
};
|
|
7396
7409
|
|
|
7397
|
-
const hasWidget = (widgets, id) => {
|
|
7398
|
-
for (const widget of widgets) {
|
|
7399
|
-
if (widget.id === id) {
|
|
7400
|
-
return true;
|
|
7401
|
-
}
|
|
7402
|
-
}
|
|
7403
|
-
return false;
|
|
7404
|
-
};
|
|
7405
|
-
|
|
7406
7410
|
const addWidgetToEditor = async (widgetId, focusKey, editor, factory, newStateGenerator, fullFocus) => {
|
|
7407
7411
|
const {
|
|
7408
7412
|
widgets = []
|
|
@@ -8640,6 +8644,7 @@ const EditorSelectUp = 'Editor: Select Up';
|
|
|
8640
8644
|
const EditorShowHover = 'Show Hover';
|
|
8641
8645
|
const EditorSortLinesAscending = 'Editor: Sort Lines Ascending';
|
|
8642
8646
|
const EditorToggleComment = 'Editor: Toggle Comment';
|
|
8647
|
+
const EditorToggleSuggestWidget = 'Editor: Toggle Suggest Widget';
|
|
8643
8648
|
const EditorUnindent = 'Editor: Unindent';
|
|
8644
8649
|
const EnterCode = 'Enter Code';
|
|
8645
8650
|
const EscapeToClose = 'Escape to close';
|
|
@@ -8672,6 +8677,9 @@ const goToDefinition$1 = () => {
|
|
|
8672
8677
|
const goToBracket = () => {
|
|
8673
8678
|
return i18nString(GoToBracket);
|
|
8674
8679
|
};
|
|
8680
|
+
const editorToggleSuggestWidget = () => {
|
|
8681
|
+
return i18nString(EditorToggleSuggestWidget);
|
|
8682
|
+
};
|
|
8675
8683
|
const noDefinitionFound = () => {
|
|
8676
8684
|
return i18nString(NoDefinitionFound);
|
|
8677
8685
|
};
|
|
@@ -12606,7 +12614,7 @@ const getLineCommentEdit = (rowIndex, line, lineComment) => {
|
|
|
12606
12614
|
};
|
|
12607
12615
|
};
|
|
12608
12616
|
|
|
12609
|
-
const getSelectedLineCommentEdits = (editor, lineComment) => {
|
|
12617
|
+
const getSelectedLineCommentEdits = (editor, lineComment, origin = ToggleBlockComment$1) => {
|
|
12610
12618
|
const {
|
|
12611
12619
|
lines,
|
|
12612
12620
|
selections
|
|
@@ -12640,7 +12648,7 @@ const getSelectedLineCommentEdits = (editor, lineComment) => {
|
|
|
12640
12648
|
rowIndex
|
|
12641
12649
|
},
|
|
12642
12650
|
inserted: [`${lineComment} `],
|
|
12643
|
-
origin
|
|
12651
|
+
origin,
|
|
12644
12652
|
start: {
|
|
12645
12653
|
columnIndex,
|
|
12646
12654
|
rowIndex
|
|
@@ -12677,10 +12685,7 @@ const editorToggleLineComment = async editor => {
|
|
|
12677
12685
|
if (!lineComment) {
|
|
12678
12686
|
return editor;
|
|
12679
12687
|
}
|
|
12680
|
-
const
|
|
12681
|
-
const cursorRowIndex = editor.selections[0];
|
|
12682
|
-
const line = getLine$1(textDocument, cursorRowIndex);
|
|
12683
|
-
const documentEdits = [getLineCommentEdit(cursorRowIndex, line, lineComment)];
|
|
12688
|
+
const documentEdits = getSelectedLineCommentEdits(editor, lineComment, LineComment);
|
|
12684
12689
|
return scheduleDocumentAndCursorsSelections(editor, documentEdits);
|
|
12685
12690
|
};
|
|
12686
12691
|
|
|
@@ -12701,6 +12706,33 @@ const toggleComment = async editor => {
|
|
|
12701
12706
|
}
|
|
12702
12707
|
};
|
|
12703
12708
|
|
|
12709
|
+
const toggleCompletion = async editor => {
|
|
12710
|
+
if (!editor) {
|
|
12711
|
+
return editor;
|
|
12712
|
+
}
|
|
12713
|
+
const {
|
|
12714
|
+
widgets
|
|
12715
|
+
} = editor;
|
|
12716
|
+
const isCompletionOpen = hasWidget(widgets, Completion);
|
|
12717
|
+
if (isCompletionOpen) {
|
|
12718
|
+
const newEditor = await closeCompletion(editor);
|
|
12719
|
+
if (!editor.completionWidgetDismissedOnBlur) {
|
|
12720
|
+
return newEditor;
|
|
12721
|
+
}
|
|
12722
|
+
return {
|
|
12723
|
+
...newEditor,
|
|
12724
|
+
completionWidgetDismissedOnBlur: false
|
|
12725
|
+
};
|
|
12726
|
+
}
|
|
12727
|
+
if (editor.completionWidgetDismissedOnBlur) {
|
|
12728
|
+
return {
|
|
12729
|
+
...editor,
|
|
12730
|
+
completionWidgetDismissedOnBlur: false
|
|
12731
|
+
};
|
|
12732
|
+
}
|
|
12733
|
+
return openCompletion(editor);
|
|
12734
|
+
};
|
|
12735
|
+
|
|
12704
12736
|
const type = async (editor, text) => {
|
|
12705
12737
|
const changes = editorReplaceSelections(editor, [text], EditorType);
|
|
12706
12738
|
const newEditor = await scheduleDocumentAndCursorsSelections(editor, changes);
|
|
@@ -14511,6 +14543,9 @@ const getQuickPickMenuEntries = () => {
|
|
|
14511
14543
|
}, {
|
|
14512
14544
|
id: 'Editor.toggleMinimap',
|
|
14513
14545
|
label: viewToggleMinimap()
|
|
14546
|
+
}, {
|
|
14547
|
+
id: 'Editor.toggleCompletion',
|
|
14548
|
+
label: editorToggleSuggestWidget()
|
|
14514
14549
|
}];
|
|
14515
14550
|
};
|
|
14516
14551
|
|
|
@@ -17198,6 +17233,7 @@ const commandMap = {
|
|
|
17198
17233
|
'Editor.toggleBlockComment': wrapCommand(toggleBlockComment),
|
|
17199
17234
|
'Editor.toggleBreakpoint': wrapCommand(toggleBreakpoint),
|
|
17200
17235
|
'Editor.toggleComment': wrapCommand(toggleComment),
|
|
17236
|
+
'Editor.toggleCompletion': wrapCommand(toggleCompletion),
|
|
17201
17237
|
'Editor.toggleLineComment': wrapCommand(editorToggleLineComment),
|
|
17202
17238
|
'Editor.toggleMinimap': toggleMinimap,
|
|
17203
17239
|
'Editor.type': wrapCommand(type, true),
|