@lvce-editor/editor-worker 19.70.6 → 19.70.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.
@@ -7654,7 +7654,6 @@ const saveUntitledFile = async (uri, content, platform, applicationId) => {
7654
7654
  }
7655
7655
  await invoke$9(applicationId, 'FileSystem.writeFile', filePath, content);
7656
7656
  await invoke$9(applicationId, 'Layout.handleWorkspaceRefresh');
7657
- await invoke$9(applicationId, 'Main.handleUriChange', uri, filePath);
7658
7657
  return filePath;
7659
7658
  };
7660
7659
 
@@ -7683,7 +7682,7 @@ const showSaveErrorDialog = async error => {
7683
7682
  });
7684
7683
  };
7685
7684
 
7686
- const save = async (editor, skipFormatting = false) => {
7685
+ const save$1 = async (editor, skipFormatting = false) => {
7687
7686
  try {
7688
7687
  const {
7689
7688
  applicationId,
@@ -7759,7 +7758,7 @@ const handleBlur$1 = async editor => {
7759
7758
  if (autoSave !== 'onFocusChange') {
7760
7759
  return newEditor;
7761
7760
  }
7762
- return save(newEditor);
7761
+ return save$1(newEditor);
7763
7762
  };
7764
7763
 
7765
7764
  const replaceRange = (editor, ranges, replacement, origin) => {
@@ -18055,92 +18054,6 @@ const revealProblem = (editor, rowIndex, columnIndex) => {
18055
18054
  };
18056
18055
  };
18057
18056
 
18058
- const saveState = (state, savedState) => {
18059
- const {
18060
- explicitLanguageId,
18061
- largeFile,
18062
- lines,
18063
- redoStack,
18064
- undoStack
18065
- } = state;
18066
- return {
18067
- ...(explicitLanguageId && {
18068
- explicitLanguageId
18069
- }),
18070
- ...(largeFile && {
18071
- largeFile: true
18072
- }),
18073
- ...((redoStack.length > 0 || undoStack.length > 0) && {
18074
- lines,
18075
- redoStack,
18076
- undoStack
18077
- })
18078
- };
18079
- };
18080
-
18081
- const sendMessagePortToExtensionManagementWorker = async (port, rpcId) => {
18082
- await sendMessagePortToExtensionManagementWorker$1(port, rpcId);
18083
- };
18084
- const sendDeprecatedExtensionHostPortToExtensionManagementWorker = async (port, _initialCommand, rpcId) => {
18085
- await sendMessagePortToExtensionManagementWorker$1(port, rpcId);
18086
- };
18087
-
18088
- const setDebugEnabled = (state, enabled) => {
18089
- return state;
18090
- };
18091
-
18092
- const toggleMinimap = async () => {
18093
- const minimapEnabled = await getMinimapEnabled();
18094
- await update({
18095
- 'editor.minimap.enabled': !minimapEnabled
18096
- });
18097
- };
18098
-
18099
- /**
18100
- * Unregister a listener for editor events
18101
- * @param listenerType - The type of event to stop listening for
18102
- * @param rpcId - The RPC ID of the listener to unregister
18103
- */
18104
- const unregisterListener = (listenerType, rpcId) => {
18105
- number(listenerType);
18106
- number(rpcId);
18107
- unregisterListener$1(listenerType, rpcId);
18108
- };
18109
-
18110
- const invoke = async (method, ...params) => {
18111
- const worker = get$9(DebugWorker);
18112
- return worker.invoke(method, ...params);
18113
- };
18114
-
18115
- const getDebugHighlight = async debugId => {
18116
- const newInfo = await invoke('RunAndDebug.getHighlight', debugId);
18117
- return newInfo;
18118
- };
18119
-
18120
- const getKey = () => {
18121
- const keys = getKeys$2();
18122
- return parseInt(keys[0]);
18123
- };
18124
- const updateDebugInfo = async debugId => {
18125
- const newInfo = await getDebugHighlight(debugId);
18126
- const key = getKey();
18127
- const instance = get$8(key);
18128
- if (!instance) {
18129
- return;
18130
- }
18131
- const {
18132
- newState,
18133
- oldState
18134
- } = instance;
18135
- const newEditor = {
18136
- ...newState,
18137
- highlightedLine: newInfo.rowIndex
18138
- };
18139
- set$a(key, oldState, newEditor);
18140
- // @ts-ignore
18141
- await invoke$d('Editor.rerender', key);
18142
- };
18143
-
18144
18057
  const editorDiagnosticEffect = {
18145
18058
  // TODO set effects delay / diagnostic delay
18146
18059
  apply(editor) {
@@ -18170,7 +18083,7 @@ const saveAfterDelay = async (uid, token) => {
18170
18083
  return;
18171
18084
  }
18172
18085
  let didSave = false;
18173
- const save$1 = wrapCommand$1(async editor => {
18086
+ const save = wrapCommand$1(async editor => {
18174
18087
  if (!isLatest(uid, token)) {
18175
18088
  return editor;
18176
18089
  }
@@ -18179,11 +18092,11 @@ const saveAfterDelay = async (uid, token) => {
18179
18092
  if (autoSave !== 'afterDelay') {
18180
18093
  return editor;
18181
18094
  }
18182
- const savedEditor = await save(editor);
18095
+ const savedEditor = await save$1(editor);
18183
18096
  didSave = savedEditor !== editor;
18184
18097
  return savedEditor;
18185
18098
  });
18186
- await save$1(uid);
18099
+ await save(uid);
18187
18100
  if (didSave) {
18188
18101
  await invoke$d('Editor.renderPending', uid);
18189
18102
  }
@@ -18303,6 +18216,105 @@ const wrapDeferredCommand$1 = (fn, returnState = true) => {
18303
18216
  };
18304
18217
  };
18305
18218
 
18219
+ const save = async (uid, skipFormatting = false) => {
18220
+ let savedFrom;
18221
+ const saveContent = wrapCommand$1(async editor => {
18222
+ savedFrom = editor;
18223
+ return save$1(editor, skipFormatting);
18224
+ });
18225
+ const saved = await saveContent(uid);
18226
+ if (savedFrom && saved && savedFrom.uri !== saved.uri) {
18227
+ // Retargeting calls Editor.handleUriChange, so release the editing queue first.
18228
+ await invoke$9(savedFrom.applicationId, 'Main.handleUriChange', savedFrom.uri, saved.uri);
18229
+ }
18230
+ };
18231
+
18232
+ const saveState = (state, savedState) => {
18233
+ const {
18234
+ explicitLanguageId,
18235
+ largeFile,
18236
+ lines,
18237
+ redoStack,
18238
+ undoStack
18239
+ } = state;
18240
+ return {
18241
+ ...(explicitLanguageId && {
18242
+ explicitLanguageId
18243
+ }),
18244
+ ...(largeFile && {
18245
+ largeFile: true
18246
+ }),
18247
+ ...((redoStack.length > 0 || undoStack.length > 0) && {
18248
+ lines,
18249
+ redoStack,
18250
+ undoStack
18251
+ })
18252
+ };
18253
+ };
18254
+
18255
+ const sendMessagePortToExtensionManagementWorker = async (port, rpcId) => {
18256
+ await sendMessagePortToExtensionManagementWorker$1(port, rpcId);
18257
+ };
18258
+ const sendDeprecatedExtensionHostPortToExtensionManagementWorker = async (port, _initialCommand, rpcId) => {
18259
+ await sendMessagePortToExtensionManagementWorker$1(port, rpcId);
18260
+ };
18261
+
18262
+ const setDebugEnabled = (state, enabled) => {
18263
+ return state;
18264
+ };
18265
+
18266
+ const toggleMinimap = async () => {
18267
+ const minimapEnabled = await getMinimapEnabled();
18268
+ await update({
18269
+ 'editor.minimap.enabled': !minimapEnabled
18270
+ });
18271
+ };
18272
+
18273
+ /**
18274
+ * Unregister a listener for editor events
18275
+ * @param listenerType - The type of event to stop listening for
18276
+ * @param rpcId - The RPC ID of the listener to unregister
18277
+ */
18278
+ const unregisterListener = (listenerType, rpcId) => {
18279
+ number(listenerType);
18280
+ number(rpcId);
18281
+ unregisterListener$1(listenerType, rpcId);
18282
+ };
18283
+
18284
+ const invoke = async (method, ...params) => {
18285
+ const worker = get$9(DebugWorker);
18286
+ return worker.invoke(method, ...params);
18287
+ };
18288
+
18289
+ const getDebugHighlight = async debugId => {
18290
+ const newInfo = await invoke('RunAndDebug.getHighlight', debugId);
18291
+ return newInfo;
18292
+ };
18293
+
18294
+ const getKey = () => {
18295
+ const keys = getKeys$2();
18296
+ return parseInt(keys[0]);
18297
+ };
18298
+ const updateDebugInfo = async debugId => {
18299
+ const newInfo = await getDebugHighlight(debugId);
18300
+ const key = getKey();
18301
+ const instance = get$8(key);
18302
+ if (!instance) {
18303
+ return;
18304
+ }
18305
+ const {
18306
+ newState,
18307
+ oldState
18308
+ } = instance;
18309
+ const newEditor = {
18310
+ ...newState,
18311
+ highlightedLine: newInfo.rowIndex
18312
+ };
18313
+ set$a(key, oldState, newEditor);
18314
+ // @ts-ignore
18315
+ await invoke$d('Editor.rerender', key);
18316
+ };
18317
+
18306
18318
  // State and undo history belong in this worker. Rendering reads changes separately.
18307
18319
  const wrapCommand = (fn, preservesTypingCoalescing = false) => {
18308
18320
  return wrapCommand$1(fn, preservesTypingCoalescing, false);
@@ -18490,7 +18502,7 @@ const commandMap = {
18490
18502
  'Editor.rerender': wrapCommand(rerender),
18491
18503
  'Editor.resize': wrapCommand(resize),
18492
18504
  'Editor.revealProblem': wrapCommand(revealProblem),
18493
- 'Editor.save': wrapCommand(save),
18505
+ 'Editor.save': save,
18494
18506
  'Editor.saveState': wrapGetter(saveState),
18495
18507
  'Editor.scrollByLines': wrapCommand(scrollByLines),
18496
18508
  'Editor.selectAll': wrapCommand(selectAll),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/editor-worker",
3
- "version": "19.70.6",
3
+ "version": "19.70.7",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@github.com:lvce-editor/editor-worker.git"