@lvce-editor/editor-worker 19.67.3 → 19.67.5
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 +40 -3
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -6177,6 +6177,11 @@ const disposeEditor = async editorUid => {
|
|
|
6177
6177
|
}
|
|
6178
6178
|
// Invalidate the registry before awaiting widget or worker cleanup.
|
|
6179
6179
|
dispose$6(editorUid);
|
|
6180
|
+
try {
|
|
6181
|
+
await invoke$9(editor.applicationId, 'Layout.handleDiagnosticsChange', editor.uri);
|
|
6182
|
+
} catch {
|
|
6183
|
+
// Older renderer workers do not support diagnostics change listeners.
|
|
6184
|
+
}
|
|
6180
6185
|
dispose$2(editorUid);
|
|
6181
6186
|
dispose$4(editorUid);
|
|
6182
6187
|
clear$1(editorUid);
|
|
@@ -10374,8 +10379,15 @@ const handleTouchMove = (editor, touchEvent) => {
|
|
|
10374
10379
|
};
|
|
10375
10380
|
|
|
10376
10381
|
const handleUriChange = async (editor, newUri) => {
|
|
10382
|
+
const {
|
|
10383
|
+
explicitLanguageId,
|
|
10384
|
+
...state
|
|
10385
|
+
} = editor;
|
|
10377
10386
|
return {
|
|
10378
|
-
...
|
|
10387
|
+
...state,
|
|
10388
|
+
...(editor.uri === newUri && explicitLanguageId && {
|
|
10389
|
+
explicitLanguageId
|
|
10390
|
+
}),
|
|
10379
10391
|
uri: newUri
|
|
10380
10392
|
};
|
|
10381
10393
|
};
|
|
@@ -11922,10 +11934,11 @@ const setIndentation = (editor, insertSpaces) => {
|
|
|
11922
11934
|
};
|
|
11923
11935
|
};
|
|
11924
11936
|
|
|
11925
|
-
const setLanguageId = async (editor, languageId, tokenizePath) => {
|
|
11937
|
+
const setLanguageId = async (editor, languageId, tokenizePath, isExplicit = false) => {
|
|
11926
11938
|
if (editor.largeFile) {
|
|
11927
11939
|
return {
|
|
11928
11940
|
...editor,
|
|
11941
|
+
explicitLanguageId: isExplicit ? languageId : editor.explicitLanguageId,
|
|
11929
11942
|
languageId
|
|
11930
11943
|
};
|
|
11931
11944
|
}
|
|
@@ -11938,6 +11951,7 @@ const setLanguageId = async (editor, languageId, tokenizePath) => {
|
|
|
11938
11951
|
set$3(newTokenizerId, tokenizer);
|
|
11939
11952
|
return {
|
|
11940
11953
|
...editor,
|
|
11954
|
+
explicitLanguageId: isExplicit ? languageId : editor.explicitLanguageId,
|
|
11941
11955
|
focused: true,
|
|
11942
11956
|
invalidStartIndex: 0,
|
|
11943
11957
|
languageId,
|
|
@@ -15082,6 +15096,21 @@ const getSavedHistory = (savedState, content) => {
|
|
|
15082
15096
|
undoStack
|
|
15083
15097
|
};
|
|
15084
15098
|
};
|
|
15099
|
+
const getSavedLanguageId = (savedState, languages) => {
|
|
15100
|
+
if (!savedState || typeof savedState !== 'object') {
|
|
15101
|
+
return undefined;
|
|
15102
|
+
}
|
|
15103
|
+
const {
|
|
15104
|
+
explicitLanguageId
|
|
15105
|
+
} = savedState;
|
|
15106
|
+
if (typeof explicitLanguageId !== 'string' || !explicitLanguageId) {
|
|
15107
|
+
return undefined;
|
|
15108
|
+
}
|
|
15109
|
+
if (languages.every(language => language?.id !== explicitLanguageId)) {
|
|
15110
|
+
return undefined;
|
|
15111
|
+
}
|
|
15112
|
+
return explicitLanguageId;
|
|
15113
|
+
};
|
|
15085
15114
|
const loadContent = async (state, savedState, largeFile = false) => {
|
|
15086
15115
|
const {
|
|
15087
15116
|
assetDir,
|
|
@@ -15123,7 +15152,8 @@ const loadContent = async (state, savedState, largeFile = false) => {
|
|
|
15123
15152
|
const charWidth = await measureCharacterWidth(fontWeight, fontSize, fontFamily, letterSpacing);
|
|
15124
15153
|
const languages = await getLanguages(platform, assetDir);
|
|
15125
15154
|
setTokenizePaths(languages);
|
|
15126
|
-
const
|
|
15155
|
+
const explicitLanguageId = getSavedLanguageId(savedState, languages);
|
|
15156
|
+
const computedLanguageId = explicitLanguageId || getLanguageId$1(uri, languages);
|
|
15127
15157
|
const newEditor0 = {
|
|
15128
15158
|
...state,
|
|
15129
15159
|
breadcrumbsEnabled,
|
|
@@ -15132,6 +15162,9 @@ const loadContent = async (state, savedState, largeFile = false) => {
|
|
|
15132
15162
|
completionTriggerCharacters,
|
|
15133
15163
|
diagnosticsEnabled,
|
|
15134
15164
|
dragAndDropEnabled,
|
|
15165
|
+
...(explicitLanguageId && {
|
|
15166
|
+
explicitLanguageId
|
|
15167
|
+
}),
|
|
15135
15168
|
fontFamily,
|
|
15136
15169
|
fontSize,
|
|
15137
15170
|
fontWeight,
|
|
@@ -16624,12 +16657,16 @@ const revealProblem = (editor, rowIndex, columnIndex) => {
|
|
|
16624
16657
|
|
|
16625
16658
|
const saveState = (state, savedState) => {
|
|
16626
16659
|
const {
|
|
16660
|
+
explicitLanguageId,
|
|
16627
16661
|
largeFile,
|
|
16628
16662
|
lines,
|
|
16629
16663
|
redoStack,
|
|
16630
16664
|
undoStack
|
|
16631
16665
|
} = state;
|
|
16632
16666
|
return {
|
|
16667
|
+
...(explicitLanguageId && {
|
|
16668
|
+
explicitLanguageId
|
|
16669
|
+
}),
|
|
16633
16670
|
...(largeFile && {
|
|
16634
16671
|
largeFile: true
|
|
16635
16672
|
}),
|