@lvce-editor/editor-worker 19.30.8 → 19.30.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 +25 -7
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -5443,7 +5443,7 @@ const isUntitledFile = uri => {
|
|
|
5443
5443
|
};
|
|
5444
5444
|
|
|
5445
5445
|
const saveNormalFile = async (uri, content) => {
|
|
5446
|
-
await invoke$a('FileSystem.writeFile', uri, content);
|
|
5446
|
+
await invoke$a('FileSystem.writeFile', uri, content, 'utf8', false);
|
|
5447
5447
|
};
|
|
5448
5448
|
|
|
5449
5449
|
const showFilePicker = async platform => {
|
|
@@ -7708,8 +7708,7 @@ const getHover = async (editor, offset) => {
|
|
|
7708
7708
|
|
|
7709
7709
|
const measureTextBlockHeight = async (text, fontFamily, fontSize, lineHeight, width) => {
|
|
7710
7710
|
// @ts-ignore
|
|
7711
|
-
|
|
7712
|
-
return 100;
|
|
7711
|
+
return invoke$a('MeasureTextHeight.measureTextBlockHeight', text, fontFamily, fontSize, lineHeight, width);
|
|
7713
7712
|
};
|
|
7714
7713
|
|
|
7715
7714
|
const getLineInfo = (line, tokens, TokenMap) => {
|
|
@@ -7790,7 +7789,12 @@ const getMatchingDiagnostics = (diagnostics, rowIndex, columnIndex) => {
|
|
|
7790
7789
|
return matching;
|
|
7791
7790
|
};
|
|
7792
7791
|
const fallbackDisplayStringLanguageId = 'typescript'; // TODO remove this
|
|
7792
|
+
|
|
7793
|
+
const hoverDocumentationFontSize = 15;
|
|
7794
|
+
const hoverDocumentationFontFamily = 'Fira Code';
|
|
7795
|
+
const hoverDocumentationLineHeight = '1.33333';
|
|
7793
7796
|
const hoverWidth = 600;
|
|
7797
|
+
const hoverDocumentationWidth = hoverWidth - 18;
|
|
7794
7798
|
const getEditorHoverInfo = async (editorUid, position) => {
|
|
7795
7799
|
number(editorUid);
|
|
7796
7800
|
const instance = get$8(editorUid);
|
|
@@ -7824,8 +7828,13 @@ const getEditorHoverInfo = async (editorUid, position) => {
|
|
|
7824
7828
|
const lineInfos = displayString ? await tokenizeCodeBlock(displayString, displayStringLanguageId || fallbackDisplayStringLanguageId, tokenizerPath) : [];
|
|
7825
7829
|
const wordPart = getWordBefore(editor, rowIndex, columnIndex);
|
|
7826
7830
|
const wordStart = columnIndex - wordPart.length;
|
|
7827
|
-
const documentationHeight = await measureTextBlockHeight();
|
|
7828
|
-
|
|
7831
|
+
const documentationHeight = documentation ? await measureTextBlockHeight(documentation, hoverDocumentationFontFamily, hoverDocumentationFontSize, hoverDocumentationLineHeight, hoverDocumentationWidth) : 0;
|
|
7832
|
+
let diagnosticText = '';
|
|
7833
|
+
for (const diagnostic of matchingDiagnostics) {
|
|
7834
|
+
diagnosticText += `${diagnosticText ? '\n' : ''}${diagnostic.message} ${diagnostic.source} (${diagnostic.code})`;
|
|
7835
|
+
}
|
|
7836
|
+
const diagnosticsHeight = diagnosticText ? (await measureTextBlockHeight(diagnosticText, editor.fontFamily, editor.fontSize, `${editor.rowHeight}px`, hoverDocumentationWidth)) + 10 : 0;
|
|
7837
|
+
const height = Math.min(diagnosticsHeight + (lineInfos.length > 0 ? lineInfos.length * editor.rowHeight + 12 : 0) + (documentation ? documentationHeight + 11 : 0) || 20, editor.height);
|
|
7829
7838
|
const x$1 = Math.max(editor.x, Math.min(x(editor, rowIndex, wordStart), editor.x + editor.width - hoverWidth));
|
|
7830
7839
|
const rowBottom = y(editor, rowIndex);
|
|
7831
7840
|
const y$1 = rowBottom + height <= editor.y + editor.height ? rowBottom : Math.max(editor.y, rowBottom - editor.rowHeight - height);
|
|
@@ -10101,6 +10110,13 @@ const getSignatureHelp = async (editor, offset) => {
|
|
|
10101
10110
|
return executeSignatureHelpProvider(editor, offset);
|
|
10102
10111
|
};
|
|
10103
10112
|
|
|
10113
|
+
const documentationFontSize = 15;
|
|
10114
|
+
const documentationFontFamily = 'Fira Code';
|
|
10115
|
+
const documentationLineHeight = '1.33333';
|
|
10116
|
+
const borderLeft = 1;
|
|
10117
|
+
const borderRight = 1;
|
|
10118
|
+
const paddingLeft = 8;
|
|
10119
|
+
const paddingRight = 8;
|
|
10104
10120
|
const getSignatureHelpInfo = async editorUid => {
|
|
10105
10121
|
number(editorUid);
|
|
10106
10122
|
const instance = get$8(editorUid);
|
|
@@ -10124,7 +10140,9 @@ const getSignatureHelpInfo = async editorUid => {
|
|
|
10124
10140
|
documentation
|
|
10125
10141
|
} = content;
|
|
10126
10142
|
const lineInfos = await tokenizeCodeBlock(displayString, editor.languageId || 'typescript', '');
|
|
10127
|
-
const
|
|
10143
|
+
const fullWidth = Math.min(600, editor.width);
|
|
10144
|
+
const documentationWidth = fullWidth - paddingLeft - paddingRight - borderLeft - borderRight;
|
|
10145
|
+
const documentationHeight = await measureTextBlockHeight(documentation, documentationFontFamily, documentationFontSize, documentationLineHeight, documentationWidth);
|
|
10128
10146
|
const bounds = getSignatureHelpWidgetBounds(editor, rowIndex, columnIndex, lineInfos.length, documentationHeight, Boolean(documentation));
|
|
10129
10147
|
return {
|
|
10130
10148
|
...bounds,
|
|
@@ -10887,7 +10905,7 @@ const undo = state => {
|
|
|
10887
10905
|
return state;
|
|
10888
10906
|
}
|
|
10889
10907
|
const last = undoStack.at(-1);
|
|
10890
|
-
const inverseChanges = last.map(inverseChange);
|
|
10908
|
+
const inverseChanges = last.toReversed().map(inverseChange);
|
|
10891
10909
|
const newState = {
|
|
10892
10910
|
...state,
|
|
10893
10911
|
redoStack: [...(state.redoStack || []), last],
|