@lvce-editor/editor-worker 19.29.10 → 19.29.11
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 +22 -36
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -7625,7 +7625,7 @@ const executeHoverProvider = async (editor, offset) => {
|
|
|
7625
7625
|
return executeIsolatedHoverProvider(editor, offset);
|
|
7626
7626
|
};
|
|
7627
7627
|
|
|
7628
|
-
const getHover
|
|
7628
|
+
const getHover = async (editor, offset) => {
|
|
7629
7629
|
object(editor);
|
|
7630
7630
|
number(offset);
|
|
7631
7631
|
// TODO invoke extension host worker directly
|
|
@@ -7689,17 +7689,6 @@ const tokenizeCodeBlock = async (codeBlock, languageId, tokenizerPath) => {
|
|
|
7689
7689
|
return lineInfos;
|
|
7690
7690
|
};
|
|
7691
7691
|
|
|
7692
|
-
const getHoverPosition = (position, selections) => {
|
|
7693
|
-
if (position) {
|
|
7694
|
-
return position;
|
|
7695
|
-
}
|
|
7696
|
-
const rowIndex = selections[0];
|
|
7697
|
-
const columnIndex = selections[1];
|
|
7698
|
-
return {
|
|
7699
|
-
columnIndex,
|
|
7700
|
-
rowIndex
|
|
7701
|
-
};
|
|
7702
|
-
};
|
|
7703
7692
|
const containsPosition = (diagnostic, rowIndex, columnIndex) => {
|
|
7704
7693
|
const {
|
|
7705
7694
|
columnIndex: startColumnIndex,
|
|
@@ -7727,22 +7716,8 @@ const getMatchingDiagnostics = (diagnostics, rowIndex, columnIndex) => {
|
|
|
7727
7716
|
}
|
|
7728
7717
|
return matching;
|
|
7729
7718
|
};
|
|
7730
|
-
const getHover = async (editor, offset) => {
|
|
7731
|
-
try {
|
|
7732
|
-
return await getHover$1(editor, offset);
|
|
7733
|
-
} catch {
|
|
7734
|
-
return undefined;
|
|
7735
|
-
}
|
|
7736
|
-
};
|
|
7737
7719
|
const fallbackDisplayStringLanguageId = 'typescript'; // TODO remove this
|
|
7738
|
-
const
|
|
7739
|
-
const x$1 = x(editor, rowIndex, wordStart);
|
|
7740
|
-
const y$1 = editor.height - y(editor, rowIndex) + editor.y + 40;
|
|
7741
|
-
return {
|
|
7742
|
-
x: x$1,
|
|
7743
|
-
y: y$1
|
|
7744
|
-
};
|
|
7745
|
-
};
|
|
7720
|
+
const hoverWidth = 600;
|
|
7746
7721
|
const getEditorHoverInfo = async (editorUid, position) => {
|
|
7747
7722
|
number(editorUid);
|
|
7748
7723
|
const instance = get$8(editorUid);
|
|
@@ -7753,11 +7728,17 @@ const getEditorHoverInfo = async (editorUid, position) => {
|
|
|
7753
7728
|
const {
|
|
7754
7729
|
columnIndex,
|
|
7755
7730
|
rowIndex
|
|
7756
|
-
} =
|
|
7731
|
+
} = position || {
|
|
7732
|
+
columnIndex: selections[1],
|
|
7733
|
+
rowIndex: selections[0]
|
|
7734
|
+
};
|
|
7757
7735
|
const offset = offsetAt(editor, rowIndex, columnIndex);
|
|
7758
7736
|
const diagnostics = editor.diagnostics || [];
|
|
7759
7737
|
const matchingDiagnostics = getMatchingDiagnostics(diagnostics, rowIndex, columnIndex);
|
|
7760
|
-
|
|
7738
|
+
let hover;
|
|
7739
|
+
try {
|
|
7740
|
+
hover = await getHover(editor, offset);
|
|
7741
|
+
} catch {}
|
|
7761
7742
|
if (!hover && matchingDiagnostics.length === 0) {
|
|
7762
7743
|
return undefined;
|
|
7763
7744
|
}
|
|
@@ -7770,17 +7751,18 @@ const getEditorHoverInfo = async (editorUid, position) => {
|
|
|
7770
7751
|
const lineInfos = displayString ? await tokenizeCodeBlock(displayString, displayStringLanguageId || fallbackDisplayStringLanguageId, tokenizerPath) : [];
|
|
7771
7752
|
const wordPart = getWordBefore(editor, rowIndex, columnIndex);
|
|
7772
7753
|
const wordStart = columnIndex - wordPart.length;
|
|
7773
|
-
await measureTextBlockHeight();
|
|
7774
|
-
const
|
|
7775
|
-
|
|
7776
|
-
|
|
7777
|
-
|
|
7754
|
+
const documentationHeight = await measureTextBlockHeight();
|
|
7755
|
+
const height = Math.min((matchingDiagnostics.length > 0 ? 30 : 0) + (lineInfos.length > 0 ? lineInfos.length * editor.rowHeight + 12 : 0) + (documentation ? documentationHeight + 11 : 0) || 20, editor.height);
|
|
7756
|
+
const x$1 = Math.max(editor.x, Math.min(x(editor, rowIndex, wordStart), editor.x + editor.width - hoverWidth));
|
|
7757
|
+
const rowBottom = y(editor, rowIndex);
|
|
7758
|
+
const y$1 = rowBottom + height <= editor.y + editor.height ? rowBottom : Math.max(editor.y, rowBottom - editor.rowHeight - height);
|
|
7778
7759
|
return {
|
|
7779
7760
|
documentation,
|
|
7761
|
+
height,
|
|
7780
7762
|
lineInfos,
|
|
7781
7763
|
matchingDiagnostics,
|
|
7782
|
-
x,
|
|
7783
|
-
y
|
|
7764
|
+
x: x$1,
|
|
7765
|
+
y: y$1
|
|
7784
7766
|
};
|
|
7785
7767
|
};
|
|
7786
7768
|
|
|
@@ -7791,6 +7773,7 @@ const loadHoverContent = async (state, position) => {
|
|
|
7791
7773
|
}
|
|
7792
7774
|
const {
|
|
7793
7775
|
documentation,
|
|
7776
|
+
height,
|
|
7794
7777
|
lineInfos,
|
|
7795
7778
|
matchingDiagnostics,
|
|
7796
7779
|
x,
|
|
@@ -7800,6 +7783,7 @@ const loadHoverContent = async (state, position) => {
|
|
|
7800
7783
|
...state,
|
|
7801
7784
|
diagnostics: matchingDiagnostics,
|
|
7802
7785
|
documentation,
|
|
7786
|
+
height,
|
|
7803
7787
|
lineInfos,
|
|
7804
7788
|
width: 600,
|
|
7805
7789
|
x,
|
|
@@ -11000,6 +10984,7 @@ const loadContent$1 = async (editorUid, state, position) => {
|
|
|
11000
10984
|
}
|
|
11001
10985
|
const {
|
|
11002
10986
|
documentation,
|
|
10987
|
+
height,
|
|
11003
10988
|
lineInfos,
|
|
11004
10989
|
matchingDiagnostics,
|
|
11005
10990
|
x,
|
|
@@ -11009,6 +10994,7 @@ const loadContent$1 = async (editorUid, state, position) => {
|
|
|
11009
10994
|
...state,
|
|
11010
10995
|
diagnostics: matchingDiagnostics,
|
|
11011
10996
|
documentation,
|
|
10997
|
+
height,
|
|
11012
10998
|
lineInfos,
|
|
11013
10999
|
x,
|
|
11014
11000
|
y
|