@lvce-editor/editor-worker 19.27.3 → 19.28.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 +131 -3
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -7535,7 +7535,7 @@ const execute = async ({
|
|
|
7535
7535
|
return result;
|
|
7536
7536
|
};
|
|
7537
7537
|
|
|
7538
|
-
const getTextDocument$
|
|
7538
|
+
const getTextDocument$2 = editor => {
|
|
7539
7539
|
return {
|
|
7540
7540
|
documentId: editor.id || editor.uid,
|
|
7541
7541
|
languageId: editor.languageId,
|
|
@@ -7544,7 +7544,7 @@ const getTextDocument$1 = editor => {
|
|
|
7544
7544
|
};
|
|
7545
7545
|
};
|
|
7546
7546
|
const executeIsolatedHoverProvider = async (editor, offset) => {
|
|
7547
|
-
const textDocument = getTextDocument$
|
|
7547
|
+
const textDocument = getTextDocument$2(editor);
|
|
7548
7548
|
return invoke$e('Extensions.executeHoverProvider', textDocument, offset);
|
|
7549
7549
|
};
|
|
7550
7550
|
const executeHoverProvider = async (editor, offset) => {
|
|
@@ -9730,6 +9730,129 @@ const showHover = async state => {
|
|
|
9730
9730
|
return state;
|
|
9731
9731
|
};
|
|
9732
9732
|
|
|
9733
|
+
const clampIndex = (index, length) => {
|
|
9734
|
+
return Math.max(0, Math.min(index, length - 1));
|
|
9735
|
+
};
|
|
9736
|
+
const getDocumentation = (signature, parameter, activeParameter) => {
|
|
9737
|
+
const documentation = [];
|
|
9738
|
+
if (parameter) {
|
|
9739
|
+
documentation.push(`Parameter ${activeParameter + 1} of ${signature.parameters.length}: ${parameter.label}`);
|
|
9740
|
+
if (parameter.documentation) {
|
|
9741
|
+
documentation.push(parameter.documentation);
|
|
9742
|
+
}
|
|
9743
|
+
}
|
|
9744
|
+
if (signature.documentation) {
|
|
9745
|
+
documentation.push(signature.documentation);
|
|
9746
|
+
}
|
|
9747
|
+
return documentation.join('\n');
|
|
9748
|
+
};
|
|
9749
|
+
const getSignatureHelpContent = signatureHelp => {
|
|
9750
|
+
if (signatureHelp.signatures.length === 0) {
|
|
9751
|
+
return undefined;
|
|
9752
|
+
}
|
|
9753
|
+
const activeSignature = clampIndex(signatureHelp.activeSignature, signatureHelp.signatures.length);
|
|
9754
|
+
const signature = signatureHelp.signatures[activeSignature];
|
|
9755
|
+
const activeParameter = clampIndex(signatureHelp.activeParameter, signature.parameters.length);
|
|
9756
|
+
const parameter = signature.parameters[activeParameter];
|
|
9757
|
+
return {
|
|
9758
|
+
displayString: signature.label,
|
|
9759
|
+
documentation: getDocumentation(signature, parameter, activeParameter)
|
|
9760
|
+
};
|
|
9761
|
+
};
|
|
9762
|
+
|
|
9763
|
+
const getTextDocument$1 = editor => {
|
|
9764
|
+
return {
|
|
9765
|
+
documentId: editor.id || editor.uid,
|
|
9766
|
+
languageId: editor.languageId,
|
|
9767
|
+
text: getText$1(editor),
|
|
9768
|
+
uri: editor.uri
|
|
9769
|
+
};
|
|
9770
|
+
};
|
|
9771
|
+
const executeSignatureHelpProvider = async (editor, offset) => {
|
|
9772
|
+
object(editor);
|
|
9773
|
+
number(offset);
|
|
9774
|
+
const textDocument = getTextDocument$1(editor);
|
|
9775
|
+
return invoke$e('Extensions.executeSignatureHelpProvider', textDocument, offset);
|
|
9776
|
+
};
|
|
9777
|
+
|
|
9778
|
+
const getSignatureHelp = async (editor, offset) => {
|
|
9779
|
+
return executeSignatureHelpProvider(editor, offset);
|
|
9780
|
+
};
|
|
9781
|
+
|
|
9782
|
+
const getSignatureHelpInfo = async editorUid => {
|
|
9783
|
+
number(editorUid);
|
|
9784
|
+
const instance = get$7(editorUid);
|
|
9785
|
+
const editor = instance.newState;
|
|
9786
|
+
const {
|
|
9787
|
+
selections
|
|
9788
|
+
} = editor;
|
|
9789
|
+
const rowIndex = selections[0];
|
|
9790
|
+
const columnIndex = selections[1];
|
|
9791
|
+
const offset = offsetAt(editor, rowIndex, columnIndex);
|
|
9792
|
+
const signatureHelp = await getSignatureHelp(editor, offset);
|
|
9793
|
+
if (!signatureHelp) {
|
|
9794
|
+
return undefined;
|
|
9795
|
+
}
|
|
9796
|
+
const content = getSignatureHelpContent(signatureHelp);
|
|
9797
|
+
if (!content) {
|
|
9798
|
+
return undefined;
|
|
9799
|
+
}
|
|
9800
|
+
const {
|
|
9801
|
+
displayString,
|
|
9802
|
+
documentation
|
|
9803
|
+
} = content;
|
|
9804
|
+
const lineInfos = await tokenizeCodeBlock(displayString, editor.languageId || 'typescript', '');
|
|
9805
|
+
const documentationHeight = await measureTextBlockHeight();
|
|
9806
|
+
const x$1 = x(editor, rowIndex, columnIndex);
|
|
9807
|
+
const y$1 = editor.height - y(editor, rowIndex) + editor.y + 40;
|
|
9808
|
+
return {
|
|
9809
|
+
documentation,
|
|
9810
|
+
documentationHeight,
|
|
9811
|
+
lineInfos,
|
|
9812
|
+
x: x$1,
|
|
9813
|
+
y: y$1
|
|
9814
|
+
};
|
|
9815
|
+
};
|
|
9816
|
+
|
|
9817
|
+
const loadSignatureHelpContent = async state => {
|
|
9818
|
+
const {
|
|
9819
|
+
editorUid
|
|
9820
|
+
} = state;
|
|
9821
|
+
const signatureHelpInfo = await getSignatureHelpInfo(editorUid);
|
|
9822
|
+
if (!signatureHelpInfo) {
|
|
9823
|
+
return undefined;
|
|
9824
|
+
}
|
|
9825
|
+
const {
|
|
9826
|
+
documentation,
|
|
9827
|
+
lineInfos,
|
|
9828
|
+
x,
|
|
9829
|
+
y
|
|
9830
|
+
} = signatureHelpInfo;
|
|
9831
|
+
return {
|
|
9832
|
+
...state,
|
|
9833
|
+
diagnostics: [],
|
|
9834
|
+
documentation,
|
|
9835
|
+
lineInfos,
|
|
9836
|
+
width: 600,
|
|
9837
|
+
x,
|
|
9838
|
+
y
|
|
9839
|
+
};
|
|
9840
|
+
};
|
|
9841
|
+
|
|
9842
|
+
const showSignatureHelp = async editor => {
|
|
9843
|
+
const {
|
|
9844
|
+
widgets = []
|
|
9845
|
+
} = editor;
|
|
9846
|
+
const editorWithoutHover = hasWidget(widgets, Hover) ? {
|
|
9847
|
+
...editor,
|
|
9848
|
+
widgets: removeEditorWidget(widgets, Hover)
|
|
9849
|
+
} : editor;
|
|
9850
|
+
const newStateGenerator = async state => {
|
|
9851
|
+
return loadSignatureHelpContent(state);
|
|
9852
|
+
};
|
|
9853
|
+
return addWidgetToEditor(Hover, FocusEditorHover, editorWithoutHover, create$5, newStateGenerator);
|
|
9854
|
+
};
|
|
9855
|
+
|
|
9733
9856
|
const create = () => {
|
|
9734
9857
|
const completionUid = create$8();
|
|
9735
9858
|
const widget = {
|
|
@@ -11586,8 +11709,12 @@ const getKeyBindings = () => {
|
|
|
11586
11709
|
when: FocusEditorText
|
|
11587
11710
|
}, {
|
|
11588
11711
|
command: 'Editor.selectionGrow',
|
|
11589
|
-
key:
|
|
11712
|
+
key: Alt$1 | Shift | RightArrow,
|
|
11590
11713
|
when: FocusEditor
|
|
11714
|
+
}, {
|
|
11715
|
+
command: 'Editor.showSignatureHelp',
|
|
11716
|
+
key: CtrlCmd | Shift | Space$1,
|
|
11717
|
+
when: FocusEditorText
|
|
11591
11718
|
}];
|
|
11592
11719
|
};
|
|
11593
11720
|
|
|
@@ -13735,6 +13862,7 @@ const commandMap = {
|
|
|
13735
13862
|
'Editor.setText': wrapCommand(setText),
|
|
13736
13863
|
'Editor.showHover': showHover,
|
|
13737
13864
|
'Editor.showHover2': wrapCommand(showHover2),
|
|
13865
|
+
'Editor.showSignatureHelp': wrapCommand(showSignatureHelp),
|
|
13738
13866
|
'Editor.showSourceActions': wrapCommand(showSourceActions),
|
|
13739
13867
|
'Editor.showSourceActions2': wrapCommand(showSourceActions),
|
|
13740
13868
|
'Editor.showSourceActions3': wrapCommand(showSourceActions),
|