@lvce-editor/editor-worker 7.18.0 → 7.20.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.
@@ -903,7 +903,7 @@ const send = (transport, method, ...params) => {
903
903
  const message = create$4$2(method, params);
904
904
  transport.send(message);
905
905
  };
906
- const invoke$a = (ipc, method, ...params) => {
906
+ const invoke$b = (ipc, method, ...params) => {
907
907
  return invokeHelper(ipc, method, params, false);
908
908
  };
909
909
  const invokeAndTransfer$1 = (ipc, method, ...params) => {
@@ -942,7 +942,7 @@ const createRpc = ipc => {
942
942
  send(ipc, method, ...params);
943
943
  },
944
944
  invoke(method, ...params) {
945
- return invoke$a(ipc, method, ...params);
945
+ return invoke$b(ipc, method, ...params);
946
946
  },
947
947
  invokeAndTransfer(method, ...params) {
948
948
  return invokeAndTransfer$1(ipc, method, ...params);
@@ -1153,23 +1153,23 @@ const RendererWorker = {
1153
1153
  invokeAndTransfer: invokeAndTransfer$3,
1154
1154
  set: set$3$1};
1155
1155
  const {
1156
- invoke: invoke$8,
1156
+ invoke: invoke$a,
1157
1157
  set: set$a} = create$9(MarkdownWorker$1);
1158
1158
  const SyntaxHighlightingWorker = {
1159
1159
  __proto__: null,
1160
- invoke: invoke$8,
1160
+ invoke: invoke$a,
1161
1161
  set: set$a
1162
1162
  };
1163
1163
 
1164
1164
  const {
1165
1165
  set: set$8,
1166
- invoke: invoke$7,
1166
+ invoke: invoke$8,
1167
1167
  invokeAndTransfer
1168
1168
  } = RendererWorker;
1169
1169
 
1170
1170
  // TODO add tests for this
1171
1171
  const activateByEvent = async event => {
1172
- await invoke$7('ExtensionHostManagement.activateByEvent', event);
1172
+ await invoke$8('ExtensionHostManagement.activateByEvent', event);
1173
1173
  };
1174
1174
 
1175
1175
  const codeGeneratorAccept = state => {
@@ -1222,15 +1222,15 @@ const launchColorPickerWorker = async () => {
1222
1222
  return launchWorker(name, url);
1223
1223
  };
1224
1224
 
1225
- let workerPromise$3;
1226
- const getOrCreate$4 = () => {
1227
- if (!workerPromise$3) {
1228
- workerPromise$3 = launchColorPickerWorker();
1225
+ let workerPromise$4;
1226
+ const getOrCreate$5 = () => {
1227
+ if (!workerPromise$4) {
1228
+ workerPromise$4 = launchColorPickerWorker();
1229
1229
  }
1230
- return workerPromise$3;
1230
+ return workerPromise$4;
1231
1231
  };
1232
- const invoke$6 = async (method, ...params) => {
1233
- const worker = await getOrCreate$4();
1232
+ const invoke$7 = async (method, ...params) => {
1233
+ const worker = await getOrCreate$5();
1234
1234
  return await worker.invoke(method, ...params);
1235
1235
  };
1236
1236
 
@@ -1242,10 +1242,10 @@ const loadContent$2 = async (state, parentUid) => {
1242
1242
  width,
1243
1243
  height
1244
1244
  } = state;
1245
- await invoke$6('ColorPicker.create', uid, x, y, width, height, parentUid);
1246
- await invoke$6('ColorPicker.loadContent', uid);
1247
- const diff = await invoke$6('ColorPicker.diff2', uid);
1248
- const commands = await invoke$6('ColorPicker.render2', uid, diff);
1245
+ await invoke$7('ColorPicker.create', uid, x, y, width, height, parentUid);
1246
+ await invoke$7('ColorPicker.loadContent', uid);
1247
+ const diff = await invoke$7('ColorPicker.diff2', uid);
1248
+ const commands = await invoke$7('ColorPicker.render2', uid, diff);
1249
1249
  return {
1250
1250
  ...state,
1251
1251
  commands
@@ -1654,7 +1654,7 @@ const createMeasureContext = () => {
1654
1654
  const state$8 = {
1655
1655
  ctx: undefined
1656
1656
  };
1657
- const getOrCreate$3 = createCtx => {
1657
+ const getOrCreate$4 = createCtx => {
1658
1658
  if (state$8.ctx) {
1659
1659
  return state$8.ctx;
1660
1660
  }
@@ -1663,7 +1663,7 @@ const getOrCreate$3 = createCtx => {
1663
1663
  };
1664
1664
 
1665
1665
  const getContext = () => {
1666
- const ctx = getOrCreate$3(createMeasureContext);
1666
+ const ctx = getOrCreate$4(createMeasureContext);
1667
1667
  return ctx;
1668
1668
  };
1669
1669
 
@@ -2186,7 +2186,7 @@ const TextDocumentSyncFull = 'ExtensionHostTextDocument.syncFull';
2186
2186
 
2187
2187
  const {
2188
2188
  set: set$5,
2189
- invoke: invoke$5} = ExtensionHost;
2189
+ invoke: invoke$6} = ExtensionHost;
2190
2190
 
2191
2191
  const ColorPicker$1 = 41;
2192
2192
  const EditorCompletion = 9;
@@ -2215,7 +2215,7 @@ const execute = async ({
2215
2215
  }) => {
2216
2216
  const fullEvent = `${event}:${editor.languageId}`;
2217
2217
  await activateByEvent(fullEvent);
2218
- const result = await invoke$5(method, editor.uid, ...args);
2218
+ const result = await invoke$6(method, editor.uid, ...args);
2219
2219
  return result;
2220
2220
  };
2221
2221
 
@@ -2283,7 +2283,7 @@ const updateDiagnostics = async newState => {
2283
2283
  // TODO don't really need text document sync response
2284
2284
  // could perhaps save a lot of messages by using send instead of invoke
2285
2285
  // @ts-ignore
2286
- await invoke$5(TextDocumentSyncFull, newState.uri, newState.id, newState.languageId, content);
2286
+ await invoke$6(TextDocumentSyncFull, newState.uri, newState.id, newState.languageId, content);
2287
2287
  const diagnostics = await executeDiagnosticProvider(newState);
2288
2288
  const latest = get$4(newState.id);
2289
2289
  if (!latest) {
@@ -2297,7 +2297,7 @@ const updateDiagnostics = async newState => {
2297
2297
  };
2298
2298
  set$6(newState.id, latest.oldState, newEditor);
2299
2299
  // @ts-ignore
2300
- await invoke$7('Editor.rerender', newState.id);
2300
+ await invoke$8('Editor.rerender', newState.id);
2301
2301
  return newEditor;
2302
2302
  } catch (error) {
2303
2303
  // @ts-ignore
@@ -2443,7 +2443,7 @@ const createEditor = async ({
2443
2443
  };
2444
2444
  set$6(id, emptyEditor, newEditor4);
2445
2445
  // @ts-ignore
2446
- await invoke$5(TextDocumentSyncFull, uri, id, languageId, content);
2446
+ await invoke$6(TextDocumentSyncFull, uri, id, languageId, content);
2447
2447
  if (diagnosticsEnabled) {
2448
2448
  updateDiagnostics(newEditor4);
2449
2449
  }
@@ -2797,7 +2797,7 @@ const editorShowMessage = async (editor, rowIndex, columnIndex, message, isError
2797
2797
  const y$1 = y(editor, rowIndex);
2798
2798
  const displayErrorMessage = message;
2799
2799
  // @ts-ignore
2800
- await invoke$7('Editor.showOverlayMessage', editor, 'Viewlet.send', editor.uid, 'showOverlayMessage', x$1, y$1, displayErrorMessage);
2800
+ await invoke$8('Editor.showOverlayMessage', editor, 'Viewlet.send', editor.uid, 'showOverlayMessage', x$1, y$1, displayErrorMessage);
2801
2801
  if (!isError) {
2802
2802
  const handleTimeout = () => {
2803
2803
  editorHideMessage(editor);
@@ -2854,7 +2854,7 @@ const braceCompletion = async (editor, text) => {
2854
2854
  // @ts-ignore
2855
2855
  const offset = offsetAt(editor, editor.cursor);
2856
2856
  // @ts-ignore
2857
- const result = await invoke$7('ExtensionHostBraceCompletion.executeBraceCompletionProvider', editor, offset, text);
2857
+ const result = await invoke$8('ExtensionHostBraceCompletion.executeBraceCompletionProvider', editor, offset, text);
2858
2858
  if (result) {
2859
2859
  const closingBrace = getMatchingClosingBrace$1(text);
2860
2860
  const insertText = text + closingBrace;
@@ -2953,15 +2953,15 @@ const launchRenameWorker = async () => {
2953
2953
  return rpc;
2954
2954
  };
2955
2955
 
2956
- let workerPromise$2;
2957
- const getOrCreate$2 = () => {
2958
- if (!workerPromise$2) {
2959
- workerPromise$2 = launchRenameWorker();
2956
+ let workerPromise$3;
2957
+ const getOrCreate$3 = () => {
2958
+ if (!workerPromise$3) {
2959
+ workerPromise$3 = launchRenameWorker();
2960
2960
  }
2961
- return workerPromise$2;
2961
+ return workerPromise$3;
2962
2962
  };
2963
- const invoke$4 = async (method, ...params) => {
2964
- const worker = await getOrCreate$2();
2963
+ const invoke$5 = async (method, ...params) => {
2964
+ const worker = await getOrCreate$3();
2965
2965
  return await worker.invoke(method, ...params);
2966
2966
  };
2967
2967
 
@@ -2979,7 +2979,7 @@ const closeRename = async editor => {
2979
2979
  return editor;
2980
2980
  }
2981
2981
  const renameWidget = widgets[renameWidgetIndex];
2982
- await invoke$4('Rename.close', renameWidget.newState.uid);
2982
+ await invoke$5('Rename.close', renameWidget.newState.uid);
2983
2983
  const latest = get$4(uid);
2984
2984
  const {
2985
2985
  newState
@@ -3016,21 +3016,21 @@ const hasWidget = (widgets, id) => {
3016
3016
 
3017
3017
  const setAdditionalFocus = async focusKey => {
3018
3018
  // @ts-ignore
3019
- await invoke$7('Focus.setAdditionalFocus', focusKey);
3019
+ await invoke$8('Focus.setAdditionalFocus', focusKey);
3020
3020
  };
3021
3021
 
3022
3022
  const setFocus = async focusKey => {
3023
3023
  if (!focusKey) {
3024
3024
  return;
3025
3025
  }
3026
- await invoke$7('Focus.setFocus', focusKey);
3026
+ await invoke$8('Focus.setFocus', focusKey);
3027
3027
  };
3028
3028
  const unsetAdditionalFocus = async focusKey => {
3029
3029
  if (!focusKey) {
3030
3030
  return;
3031
3031
  }
3032
3032
  // @ts-ignore
3033
- await invoke$7('Focus.removeAdditionalFocus', focusKey);
3033
+ await invoke$8('Focus.removeAdditionalFocus', focusKey);
3034
3034
  };
3035
3035
 
3036
3036
  const addWidgetToEditor = async (widgetId, focusKey, editor, factory, newStateGenerator, fullFocus) => {
@@ -3091,11 +3091,11 @@ const create$6 = () => {
3091
3091
  return widget;
3092
3092
  };
3093
3093
 
3094
- const newStateGenerator$5 = (state, parentUid) => {
3094
+ const newStateGenerator$6 = (state, parentUid) => {
3095
3095
  return loadContent$2(state, parentUid);
3096
3096
  };
3097
3097
  const openColorPicker = async editor => {
3098
- return addWidgetToEditor(ColorPicker, ColorPicker$1, editor, create$6, newStateGenerator$5);
3098
+ return addWidgetToEditor(ColorPicker, ColorPicker$1, editor, create$6, newStateGenerator$6);
3099
3099
  };
3100
3100
 
3101
3101
  const state$6 = {
@@ -3151,7 +3151,7 @@ const compositionEnd = (editor, data) => {
3151
3151
  const writeText = async text => {
3152
3152
  try {
3153
3153
  string(text);
3154
- await invoke$7('ClipBoard.writeText', /* text */text);
3154
+ await invoke$8('ClipBoard.writeText', /* text */text);
3155
3155
  } catch (error) {
3156
3156
  throw new VError(error, 'Failed to write text to clipboard');
3157
3157
  }
@@ -3788,7 +3788,7 @@ const deleteWordRight = editor => {
3788
3788
 
3789
3789
  const findAllReferences = async editor => {
3790
3790
  // @ts-ignore
3791
- await invoke$7('SideBar.show', 'References', /* focus */true);
3791
+ await invoke$8('SideBar.show', 'References', /* focus */true);
3792
3792
  return editor;
3793
3793
  };
3794
3794
 
@@ -3919,7 +3919,7 @@ const getWordBefore = (editor, rowIndex, columnIndex) => {
3919
3919
  // @ts-ignore
3920
3920
  const getDefinition = async (editor, offset) => {
3921
3921
  // @ts-ignore
3922
- const definition = await invoke$7('ExtensionHostDefinition.executeDefinitionProvider', editor, offset);
3922
+ const definition = await invoke$8('ExtensionHostDefinition.executeDefinitionProvider', editor, offset);
3923
3923
  return definition;
3924
3924
  };
3925
3925
 
@@ -4102,7 +4102,7 @@ const goTo = async ({
4102
4102
  endRowIndex: definition.endRowIndex,
4103
4103
  endColumnIndex: definition.endColumnIndex
4104
4104
  };
4105
- await invoke$7(/* Main.openUri */'Main.openUri', /* uri */uri, /* focus */true, context);
4105
+ await invoke$8(/* Main.openUri */'Main.openUri', /* uri */uri, /* focus */true, context);
4106
4106
  return editor;
4107
4107
  } catch (error) {
4108
4108
  // TODO if editor is already disposed at this point, do nothing
@@ -4180,7 +4180,7 @@ const getNoLocationFoundMessage = info => {
4180
4180
 
4181
4181
  const getTypeDefinition = async (editor, offset) => {
4182
4182
  // @ts-ignore
4183
- const definition = await invoke$7('ExtensionHostTypeDefinition.executeTypeDefinitionProvider', editor, offset);
4183
+ const definition = await invoke$8('ExtensionHostTypeDefinition.executeTypeDefinitionProvider', editor, offset);
4184
4184
  return definition;
4185
4185
  };
4186
4186
 
@@ -4220,7 +4220,7 @@ const goToTypeDefinition = async (editor, explicit = true) => {
4220
4220
  const Editor = 3;
4221
4221
 
4222
4222
  const handleContextMenu = async (editor, button, x, y) => {
4223
- await invoke$7(/* ContextMenu.show */'ContextMenu.show', /* x */x, /* y */y, /* id */Editor);
4223
+ await invoke$8(/* ContextMenu.show */'ContextMenu.show', /* x */x, /* y */y, /* id */Editor);
4224
4224
  return editor;
4225
4225
  };
4226
4226
 
@@ -4258,7 +4258,7 @@ const WhenExpressionEditorText = 12;
4258
4258
  const handleFocus$1 = editor => {
4259
4259
  // TODO make change events functional,
4260
4260
  // when rendering, send focus changes to renderer worker
4261
- invoke$7('Focus.setFocus', WhenExpressionEditorText);
4261
+ invoke$8('Focus.setFocus', WhenExpressionEditorText);
4262
4262
  return editor;
4263
4263
  };
4264
4264
 
@@ -4917,7 +4917,7 @@ const indentMore = editor => {
4917
4917
 
4918
4918
  const getLanguageConfiguration = async editor => {
4919
4919
  // @ts-ignore
4920
- return invoke$7('Languages.getLanguageConfiguration', {
4920
+ return invoke$8('Languages.getLanguageConfiguration', {
4921
4921
  uri: editor.uri,
4922
4922
  languageId: editor.languageId
4923
4923
  });
@@ -5220,7 +5220,7 @@ const create$5 = () => {
5220
5220
  return widget;
5221
5221
  };
5222
5222
 
5223
- const newStateGenerator$4 = async state => {
5223
+ const newStateGenerator$5 = async state => {
5224
5224
  const latestState = {
5225
5225
  ...state,
5226
5226
  x: 100,
@@ -5232,7 +5232,7 @@ const newStateGenerator$4 = async state => {
5232
5232
  };
5233
5233
  const openCodeGenerator = async editor => {
5234
5234
  const fullFocus = true;
5235
- return addWidgetToEditor(CodeGenerator, FocusCodeGenerator, editor, create$5, newStateGenerator$4, fullFocus);
5235
+ return addWidgetToEditor(CodeGenerator, FocusCodeGenerator, editor, create$5, newStateGenerator$5, fullFocus);
5236
5236
  };
5237
5237
 
5238
5238
  const create$4 = () => {
@@ -5267,19 +5267,19 @@ const launchCompletionWorker = async () => {
5267
5267
  return rpc;
5268
5268
  };
5269
5269
 
5270
- let workerPromise$1;
5271
- const getOrCreate$1 = () => {
5272
- if (!workerPromise$1) {
5273
- workerPromise$1 = launchCompletionWorker();
5270
+ let workerPromise$2;
5271
+ const getOrCreate$2 = () => {
5272
+ if (!workerPromise$2) {
5273
+ workerPromise$2 = launchCompletionWorker();
5274
5274
  }
5275
- return workerPromise$1;
5275
+ return workerPromise$2;
5276
5276
  };
5277
- const invoke$3 = async (method, ...params) => {
5278
- const worker = await getOrCreate$1();
5277
+ const invoke$4 = async (method, ...params) => {
5278
+ const worker = await getOrCreate$2();
5279
5279
  return await worker.invoke(method, ...params);
5280
5280
  };
5281
5281
 
5282
- const newStateGenerator$3 = async (state, parentUid) => {
5282
+ const newStateGenerator$4 = async (state, parentUid) => {
5283
5283
  const {
5284
5284
  uid,
5285
5285
  x,
@@ -5287,14 +5287,16 @@ const newStateGenerator$3 = async (state, parentUid) => {
5287
5287
  width,
5288
5288
  height
5289
5289
  } = state;
5290
- const editor = get$4(parentUid);
5290
+ const {
5291
+ newState
5292
+ } = get$4(parentUid);
5291
5293
  const {
5292
5294
  languageId
5293
- } = editor;
5294
- await invoke$3('Completions.create', uid, x, y, width, height, parentUid, languageId);
5295
- await invoke$3('Completions.loadContent', uid);
5296
- const diff = await invoke$3('Completions.diff2', uid);
5297
- const commands = await invoke$3('Completions.render2', uid, diff);
5295
+ } = newState;
5296
+ await invoke$4('Completions.create', uid, x, y, width, height, parentUid, languageId);
5297
+ await invoke$4('Completions.loadContent', uid);
5298
+ const diff = await invoke$4('Completions.diff2', uid);
5299
+ const commands = await invoke$4('Completions.render2', uid, diff);
5298
5300
  return {
5299
5301
  ...state,
5300
5302
  commands
@@ -5302,7 +5304,7 @@ const newStateGenerator$3 = async (state, parentUid) => {
5302
5304
  };
5303
5305
  const openCompletion = async editor => {
5304
5306
  const fullFocus = false;
5305
- return addWidgetToEditor(Completion, EditorCompletion, editor, create$4, newStateGenerator$3, fullFocus);
5307
+ return addWidgetToEditor(Completion, EditorCompletion, editor, create$4, newStateGenerator$4, fullFocus);
5306
5308
  };
5307
5309
 
5308
5310
  const create$3 = () => {
@@ -5337,15 +5339,15 @@ const launchFindWidgetWorker = async () => {
5337
5339
  return launchWorker(name, url);
5338
5340
  };
5339
5341
 
5340
- let workerPromise;
5341
- const getOrCreate = () => {
5342
- if (!workerPromise) {
5343
- workerPromise = launchFindWidgetWorker();
5342
+ let workerPromise$1;
5343
+ const getOrCreate$1 = () => {
5344
+ if (!workerPromise$1) {
5345
+ workerPromise$1 = launchFindWidgetWorker();
5344
5346
  }
5345
- return workerPromise;
5347
+ return workerPromise$1;
5346
5348
  };
5347
- const invoke$2 = async (method, ...params) => {
5348
- const worker = await getOrCreate();
5349
+ const invoke$3 = async (method, ...params) => {
5350
+ const worker = await getOrCreate$1();
5349
5351
  return await worker.invoke(method, ...params);
5350
5352
  };
5351
5353
 
@@ -5371,22 +5373,22 @@ const loadContent$1 = async (state, parentUid) => {
5371
5373
  width,
5372
5374
  height
5373
5375
  } = editor;
5374
- await invoke$2('FindWidget.create', uid, x, y, width, height, parentUid);
5375
- await invoke$2('FindWidget.loadContent', uid);
5376
- const diff = await invoke$2('FindWidget.diff2', uid);
5377
- const commands = await invoke$2('FindWidget.render2', uid, diff);
5376
+ await invoke$3('FindWidget.create', uid, x, y, width, height, parentUid);
5377
+ await invoke$3('FindWidget.loadContent', uid);
5378
+ const diff = await invoke$3('FindWidget.diff2', uid);
5379
+ const commands = await invoke$3('FindWidget.render2', uid, diff);
5378
5380
  return {
5379
5381
  ...state,
5380
5382
  commands
5381
5383
  };
5382
5384
  };
5383
5385
 
5384
- const newStateGenerator$2 = (state, parentUid) => {
5386
+ const newStateGenerator$3 = (state, parentUid) => {
5385
5387
  return loadContent$1(state, parentUid);
5386
5388
  };
5387
5389
  const openFind2 = async editor => {
5388
5390
  const fullFocus = true;
5389
- return addWidgetToEditor(ColorPicker, FindWidget, editor, create$3, newStateGenerator$2, fullFocus);
5391
+ return addWidgetToEditor(ColorPicker, FindWidget, editor, create$3, newStateGenerator$3, fullFocus);
5390
5392
  };
5391
5393
 
5392
5394
  const openFind = async state => {
@@ -5433,7 +5435,7 @@ const create$2 = () => {
5433
5435
  return renameWidget;
5434
5436
  };
5435
5437
 
5436
- const newStateGenerator$1 = async (state, parentUid) => {
5438
+ const newStateGenerator$2 = async (state, parentUid) => {
5437
5439
  const {
5438
5440
  uid,
5439
5441
  x,
@@ -5441,14 +5443,16 @@ const newStateGenerator$1 = async (state, parentUid) => {
5441
5443
  width,
5442
5444
  height
5443
5445
  } = state;
5444
- const editor = get$4(parentUid);
5446
+ const {
5447
+ newState
5448
+ } = get$4(parentUid);
5445
5449
  const {
5446
5450
  languageId
5447
- } = editor;
5448
- await invoke$4('Rename.create', uid, x, y, width, height, parentUid, languageId);
5449
- await invoke$4('Rename.loadContent', uid);
5450
- const diff = await invoke$4('Rename.diff2', uid);
5451
- const commands = await invoke$4('Rename.render2', uid, diff);
5451
+ } = newState;
5452
+ await invoke$5('Rename.create', uid, x, y, width, height, parentUid, languageId);
5453
+ await invoke$5('Rename.loadContent', uid);
5454
+ const diff = await invoke$5('Rename.diff2', uid);
5455
+ const commands = await invoke$5('Rename.render2', uid, diff);
5452
5456
  return {
5453
5457
  ...state,
5454
5458
  commands
@@ -5466,7 +5470,7 @@ const openRename = async editor => {
5466
5470
  return editor;
5467
5471
  }
5468
5472
  const fullFocus = true;
5469
- return addWidgetToEditor(Rename, FocusEditorRename$1, editor, create$2, newStateGenerator$1, fullFocus);
5473
+ return addWidgetToEditor(Rename, FocusEditorRename$1, editor, create$2, newStateGenerator$2, fullFocus);
5470
5474
  };
5471
5475
 
5472
5476
  const getOrganizeImportEdits = async editor => {
@@ -5495,7 +5499,7 @@ const pasteText = (editor, text) => {
5495
5499
 
5496
5500
  const paste = async editor => {
5497
5501
  // @ts-ignore
5498
- const text = await invoke$7('ClipBoard.readText');
5502
+ const text = await invoke$8('ClipBoard.readText');
5499
5503
  string(text);
5500
5504
  return pasteText(editor, text);
5501
5505
  };
@@ -5637,7 +5641,7 @@ const save = async editor => {
5637
5641
  } = editor;
5638
5642
  const newEditor = await getNewEditor(editor);
5639
5643
  const content = getText$1(newEditor);
5640
- await invoke$7('FileSystem.writeFile', uri, content);
5644
+ await invoke$8('FileSystem.writeFile', uri, content);
5641
5645
  return newEditor;
5642
5646
  } catch (error) {
5643
5647
  // @ts-ignore
@@ -5944,7 +5948,7 @@ const selectInsideString = editor => {
5944
5948
 
5945
5949
  const getNewSelections = async (editor, selections) => {
5946
5950
  // @ts-ignore
5947
- const newSelections = await invoke$7('ExtensionHostSelection.executeGrowSelection', editor, selections);
5951
+ const newSelections = await invoke$8('ExtensionHostSelection.executeGrowSelection', editor, selections);
5948
5952
  if (newSelections.length === 0) {
5949
5953
  return selections;
5950
5954
  }
@@ -6198,7 +6202,7 @@ const getEnabled$1 = () => {
6198
6202
 
6199
6203
  const {
6200
6204
  set: set$3,
6201
- invoke: invoke$1} = SyntaxHighlightingWorker;
6205
+ invoke: invoke$2} = SyntaxHighlightingWorker;
6202
6206
 
6203
6207
  /**
6204
6208
  * @enum number
@@ -6268,7 +6272,7 @@ const loadTokenizer = async (languageId, tokenizePath) => {
6268
6272
  }
6269
6273
  if (getEnabled$1()) {
6270
6274
  // @ts-ignore
6271
- const tokenMap = await invoke$1('Tokenizer.load', languageId, tokenizePath);
6275
+ const tokenMap = await invoke$2('Tokenizer.load', languageId, tokenizePath);
6272
6276
  set$1(languageId, tokenMap);
6273
6277
  return;
6274
6278
  }
@@ -6620,23 +6624,23 @@ const loadHoverContent = async state => {
6620
6624
  };
6621
6625
  };
6622
6626
 
6623
- const newStateGenerator = async state => {
6627
+ const newStateGenerator$1 = async state => {
6624
6628
  return loadHoverContent(state);
6625
6629
  };
6626
6630
  const showHover2 = async editor => {
6627
- return addWidgetToEditor(Hover, FocusEditorHover, editor, create$1, newStateGenerator);
6631
+ return addWidgetToEditor(Hover, FocusEditorHover, editor, create$1, newStateGenerator$1);
6628
6632
  };
6629
6633
 
6630
6634
  const EditorHover = 'EditorHover';
6631
6635
  const showHover = async state => {
6632
- await invoke$7('Viewlet.openWidget', EditorHover);
6636
+ await invoke$8('Viewlet.openWidget', EditorHover);
6633
6637
  return state;
6634
6638
  };
6635
6639
 
6636
6640
  // TODO ask extension host worker instead
6637
6641
  const getEditorSourceActions = async () => {
6638
6642
  // @ts-ignore
6639
- const sourceActions = await invoke$7('GetEditorSourceActions.getEditorSourceActions');
6643
+ const sourceActions = await invoke$8('GetEditorSourceActions.getEditorSourceActions');
6640
6644
  return sourceActions;
6641
6645
  };
6642
6646
 
@@ -6700,7 +6704,8 @@ const create = () => {
6700
6704
  height: 0,
6701
6705
  focusedIndex: 0,
6702
6706
  sourceActions: [],
6703
- maxHeight: 0
6707
+ maxHeight: 0,
6708
+ commands: []
6704
6709
  },
6705
6710
  newState: {
6706
6711
  uid: completionUid,
@@ -6710,19 +6715,67 @@ const create = () => {
6710
6715
  height: 0,
6711
6716
  focusedIndex: 0,
6712
6717
  sourceActions: [],
6713
- maxHeight: 0
6718
+ maxHeight: 0,
6719
+ commands: []
6714
6720
  }
6715
6721
  };
6716
6722
  return widget;
6717
6723
  };
6718
6724
 
6719
- const showSourceActions = async editor => {
6725
+ const showSourceActions$1 = async editor => {
6720
6726
  const newStateGenerator = async state => {
6721
6727
  return loadSourceActions(editor, state);
6722
6728
  };
6723
6729
  return addWidgetToEditor(SourceAction$1, SourceActions, editor, create, newStateGenerator);
6724
6730
  };
6725
6731
 
6732
+ const launchSourceActionWorker = async () => {
6733
+ const name = 'Source Action Worker';
6734
+ const url = 'sourceActionWorkerMain.js';
6735
+ const intializeCommand = 'SourceActions.initialize';
6736
+ const rpc = await launchWorker(name, url, intializeCommand);
6737
+ return rpc;
6738
+ };
6739
+
6740
+ let workerPromise;
6741
+ const getOrCreate = () => {
6742
+ if (!workerPromise) {
6743
+ workerPromise = launchSourceActionWorker();
6744
+ }
6745
+ return workerPromise;
6746
+ };
6747
+ const invoke$1 = async (method, ...params) => {
6748
+ const worker = await getOrCreate();
6749
+ return await worker.invoke(method, ...params);
6750
+ };
6751
+
6752
+ const newStateGenerator = async (state, parentUid) => {
6753
+ const {
6754
+ uid,
6755
+ x,
6756
+ y,
6757
+ width,
6758
+ height
6759
+ } = state;
6760
+ const {
6761
+ newState
6762
+ } = get$4(parentUid);
6763
+ const {
6764
+ languageId
6765
+ } = newState;
6766
+ await invoke$1('SourceActions.create', uid, x, y, width, height, parentUid, languageId);
6767
+ await invoke$1('SourceActions.loadContent', uid);
6768
+ const diff = await invoke$1('SourceActions.diff2', uid);
6769
+ const commands = await invoke$1('SourceActions.render2', uid, diff);
6770
+ return {
6771
+ ...state,
6772
+ commands
6773
+ };
6774
+ };
6775
+ const showSourceActions = async editor => {
6776
+ return addWidgetToEditor(SourceAction$1, SourceActions, editor, create, newStateGenerator);
6777
+ };
6778
+
6726
6779
  const compareString = (a, b) => {
6727
6780
  return a.localeCompare(b);
6728
6781
  };
@@ -7297,7 +7350,7 @@ const typeWithAutoClosingQuote = (editor, text) => {
7297
7350
  const typeWithAutoClosingTag = async (editor, text) => {
7298
7351
  const offset = offsetAt(editor, editor.selections[0], editor.selections[1]);
7299
7352
  // @ts-ignore
7300
- const result = await invoke$7('ExtensionHostClosingTagCompletion.executeClosingTagProvider', editor, offset, text);
7353
+ const result = await invoke$8('ExtensionHostClosingTagCompletion.executeClosingTagProvider', editor, offset, text);
7301
7354
  if (!result) {
7302
7355
  const changes = editorReplaceSelections(editor, [text], EditorType);
7303
7356
  return scheduleDocumentAndCursorsSelections(editor, changes);
@@ -7559,13 +7612,15 @@ const addWidget$1 = (widget, id, render) => {
7559
7612
  const getWidgetInvoke = widgetId => {
7560
7613
  switch (widgetId) {
7561
7614
  case ColorPicker:
7562
- return invoke$6;
7615
+ return invoke$7;
7563
7616
  case Completion:
7564
- return invoke$3;
7617
+ return invoke$4;
7565
7618
  case Find:
7566
- return invoke$2;
7619
+ return invoke$3;
7567
7620
  case Rename:
7568
- return invoke$4;
7621
+ return invoke$5;
7622
+ case SourceAction$1:
7623
+ return invoke$1;
7569
7624
  default:
7570
7625
  return undefined;
7571
7626
  }
@@ -9165,13 +9220,13 @@ const getTokensViewport2 = async (editor, startLineIndex, endLineIndex, syncIncr
9165
9220
  languageId,
9166
9221
  invalidStartIndex
9167
9222
  };
9168
- return invoke$1('GetTokensViewport.getTokensViewport', slimEditor,
9223
+ return invoke$2('GetTokensViewport.getTokensViewport', slimEditor,
9169
9224
  // @ts-ignore
9170
9225
  startLineIndex, endLineIndex, hasLinesToSend, id, linesToSend);
9171
9226
  }
9172
9227
  // TODO only send needed lines of text
9173
9228
  // @ts-ignore
9174
- return invoke$1('GetTokensViewport.getTokensViewport', editor, startLineIndex, endLineIndex, true, editor.id, editor.lines);
9229
+ return invoke$2('GetTokensViewport.getTokensViewport', editor, startLineIndex, endLineIndex, true, editor.id, editor.lines);
9175
9230
  }
9176
9231
  return getTokensViewport(editor, startLineIndex, endLineIndex);
9177
9232
  };
@@ -9533,7 +9588,7 @@ const getIncrementalEdits = async (oldState, newState) => {
9533
9588
  const oldLine = oldState.lines[rowIndex];
9534
9589
  const newLine = lines[rowIndex];
9535
9590
  // @ts-ignore
9536
- const incrementalEdits = await invoke$1(
9591
+ const incrementalEdits = await invoke$2(
9537
9592
  // @ts-ignore
9538
9593
  'TokenizeIncremental.tokenizeIncremental', newState.uid,
9539
9594
  // @ts-ignore
@@ -9654,7 +9709,7 @@ const renderFocus$1 = {
9654
9709
  // TODO avoid side effect
9655
9710
  if (newState.focused) {
9656
9711
  const FocusEditorText = 12;
9657
- invoke$7('Focus.setFocus', FocusEditorText);
9712
+ invoke$8('Focus.setFocus', FocusEditorText);
9658
9713
  }
9659
9714
  return [/* method */'setFocused', newState.focused];
9660
9715
  }
@@ -9842,7 +9897,7 @@ const updateDebugInfo = async debugId => {
9842
9897
  };
9843
9898
  set$6(key, oldState, newEditor);
9844
9899
  // @ts-ignore
9845
- await invoke$7('Editor.rerender', key);
9900
+ await invoke$8('Editor.rerender', key);
9846
9901
  };
9847
9902
 
9848
9903
  const editorDiagnosticEffect = {
@@ -10090,8 +10145,9 @@ const commandMap = {
10090
10145
  'Editor.setSelections2': setSelections2,
10091
10146
  'Editor.showHover': showHover,
10092
10147
  'Editor.showHover2': showHover2,
10093
- 'Editor.showSourceActions': showSourceActions,
10094
- 'Editor.showSourceActions2': showSourceActions,
10148
+ 'Editor.showSourceActions': showSourceActions$1,
10149
+ 'Editor.showSourceActions2': showSourceActions$1,
10150
+ 'Editor.showSourceActions3': showSourceActions,
10095
10151
  'Editor.sortLinesAscending': sortLinesAscending,
10096
10152
  'Editor.tabCompletion': tabCompletion,
10097
10153
  'Editor.toggleBlockComment': toggleBlockComment,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/editor-worker",
3
- "version": "7.18.0",
3
+ "version": "7.20.0",
4
4
  "license": "MIT",
5
5
  "author": "Lvce Editor",
6
6
  "type": "module",