@lvce-editor/editor-worker 7.19.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,
@@ -5293,10 +5293,10 @@ const newStateGenerator$3 = async (state, parentUid) => {
5293
5293
  const {
5294
5294
  languageId
5295
5295
  } = newState;
5296
- await invoke$3('Completions.create', uid, x, y, width, height, parentUid, languageId);
5297
- await invoke$3('Completions.loadContent', uid);
5298
- const diff = await invoke$3('Completions.diff2', uid);
5299
- const commands = await invoke$3('Completions.render2', uid, diff);
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);
5300
5300
  return {
5301
5301
  ...state,
5302
5302
  commands
@@ -5304,7 +5304,7 @@ const newStateGenerator$3 = async (state, parentUid) => {
5304
5304
  };
5305
5305
  const openCompletion = async editor => {
5306
5306
  const fullFocus = false;
5307
- return addWidgetToEditor(Completion, EditorCompletion, editor, create$4, newStateGenerator$3, fullFocus);
5307
+ return addWidgetToEditor(Completion, EditorCompletion, editor, create$4, newStateGenerator$4, fullFocus);
5308
5308
  };
5309
5309
 
5310
5310
  const create$3 = () => {
@@ -5339,15 +5339,15 @@ const launchFindWidgetWorker = async () => {
5339
5339
  return launchWorker(name, url);
5340
5340
  };
5341
5341
 
5342
- let workerPromise;
5343
- const getOrCreate = () => {
5344
- if (!workerPromise) {
5345
- workerPromise = launchFindWidgetWorker();
5342
+ let workerPromise$1;
5343
+ const getOrCreate$1 = () => {
5344
+ if (!workerPromise$1) {
5345
+ workerPromise$1 = launchFindWidgetWorker();
5346
5346
  }
5347
- return workerPromise;
5347
+ return workerPromise$1;
5348
5348
  };
5349
- const invoke$2 = async (method, ...params) => {
5350
- const worker = await getOrCreate();
5349
+ const invoke$3 = async (method, ...params) => {
5350
+ const worker = await getOrCreate$1();
5351
5351
  return await worker.invoke(method, ...params);
5352
5352
  };
5353
5353
 
@@ -5373,22 +5373,22 @@ const loadContent$1 = async (state, parentUid) => {
5373
5373
  width,
5374
5374
  height
5375
5375
  } = editor;
5376
- await invoke$2('FindWidget.create', uid, x, y, width, height, parentUid);
5377
- await invoke$2('FindWidget.loadContent', uid);
5378
- const diff = await invoke$2('FindWidget.diff2', uid);
5379
- 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);
5380
5380
  return {
5381
5381
  ...state,
5382
5382
  commands
5383
5383
  };
5384
5384
  };
5385
5385
 
5386
- const newStateGenerator$2 = (state, parentUid) => {
5386
+ const newStateGenerator$3 = (state, parentUid) => {
5387
5387
  return loadContent$1(state, parentUid);
5388
5388
  };
5389
5389
  const openFind2 = async editor => {
5390
5390
  const fullFocus = true;
5391
- return addWidgetToEditor(ColorPicker, FindWidget, editor, create$3, newStateGenerator$2, fullFocus);
5391
+ return addWidgetToEditor(ColorPicker, FindWidget, editor, create$3, newStateGenerator$3, fullFocus);
5392
5392
  };
5393
5393
 
5394
5394
  const openFind = async state => {
@@ -5435,7 +5435,7 @@ const create$2 = () => {
5435
5435
  return renameWidget;
5436
5436
  };
5437
5437
 
5438
- const newStateGenerator$1 = async (state, parentUid) => {
5438
+ const newStateGenerator$2 = async (state, parentUid) => {
5439
5439
  const {
5440
5440
  uid,
5441
5441
  x,
@@ -5449,10 +5449,10 @@ const newStateGenerator$1 = async (state, parentUid) => {
5449
5449
  const {
5450
5450
  languageId
5451
5451
  } = newState;
5452
- await invoke$4('Rename.create', uid, x, y, width, height, parentUid, languageId);
5453
- await invoke$4('Rename.loadContent', uid);
5454
- const diff = await invoke$4('Rename.diff2', uid);
5455
- const commands = await invoke$4('Rename.render2', uid, diff);
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);
5456
5456
  return {
5457
5457
  ...state,
5458
5458
  commands
@@ -5470,7 +5470,7 @@ const openRename = async editor => {
5470
5470
  return editor;
5471
5471
  }
5472
5472
  const fullFocus = true;
5473
- return addWidgetToEditor(Rename, FocusEditorRename$1, editor, create$2, newStateGenerator$1, fullFocus);
5473
+ return addWidgetToEditor(Rename, FocusEditorRename$1, editor, create$2, newStateGenerator$2, fullFocus);
5474
5474
  };
5475
5475
 
5476
5476
  const getOrganizeImportEdits = async editor => {
@@ -5499,7 +5499,7 @@ const pasteText = (editor, text) => {
5499
5499
 
5500
5500
  const paste = async editor => {
5501
5501
  // @ts-ignore
5502
- const text = await invoke$7('ClipBoard.readText');
5502
+ const text = await invoke$8('ClipBoard.readText');
5503
5503
  string(text);
5504
5504
  return pasteText(editor, text);
5505
5505
  };
@@ -5641,7 +5641,7 @@ const save = async editor => {
5641
5641
  } = editor;
5642
5642
  const newEditor = await getNewEditor(editor);
5643
5643
  const content = getText$1(newEditor);
5644
- await invoke$7('FileSystem.writeFile', uri, content);
5644
+ await invoke$8('FileSystem.writeFile', uri, content);
5645
5645
  return newEditor;
5646
5646
  } catch (error) {
5647
5647
  // @ts-ignore
@@ -5948,7 +5948,7 @@ const selectInsideString = editor => {
5948
5948
 
5949
5949
  const getNewSelections = async (editor, selections) => {
5950
5950
  // @ts-ignore
5951
- const newSelections = await invoke$7('ExtensionHostSelection.executeGrowSelection', editor, selections);
5951
+ const newSelections = await invoke$8('ExtensionHostSelection.executeGrowSelection', editor, selections);
5952
5952
  if (newSelections.length === 0) {
5953
5953
  return selections;
5954
5954
  }
@@ -6202,7 +6202,7 @@ const getEnabled$1 = () => {
6202
6202
 
6203
6203
  const {
6204
6204
  set: set$3,
6205
- invoke: invoke$1} = SyntaxHighlightingWorker;
6205
+ invoke: invoke$2} = SyntaxHighlightingWorker;
6206
6206
 
6207
6207
  /**
6208
6208
  * @enum number
@@ -6272,7 +6272,7 @@ const loadTokenizer = async (languageId, tokenizePath) => {
6272
6272
  }
6273
6273
  if (getEnabled$1()) {
6274
6274
  // @ts-ignore
6275
- const tokenMap = await invoke$1('Tokenizer.load', languageId, tokenizePath);
6275
+ const tokenMap = await invoke$2('Tokenizer.load', languageId, tokenizePath);
6276
6276
  set$1(languageId, tokenMap);
6277
6277
  return;
6278
6278
  }
@@ -6624,23 +6624,23 @@ const loadHoverContent = async state => {
6624
6624
  };
6625
6625
  };
6626
6626
 
6627
- const newStateGenerator = async state => {
6627
+ const newStateGenerator$1 = async state => {
6628
6628
  return loadHoverContent(state);
6629
6629
  };
6630
6630
  const showHover2 = async editor => {
6631
- return addWidgetToEditor(Hover, FocusEditorHover, editor, create$1, newStateGenerator);
6631
+ return addWidgetToEditor(Hover, FocusEditorHover, editor, create$1, newStateGenerator$1);
6632
6632
  };
6633
6633
 
6634
6634
  const EditorHover = 'EditorHover';
6635
6635
  const showHover = async state => {
6636
- await invoke$7('Viewlet.openWidget', EditorHover);
6636
+ await invoke$8('Viewlet.openWidget', EditorHover);
6637
6637
  return state;
6638
6638
  };
6639
6639
 
6640
6640
  // TODO ask extension host worker instead
6641
6641
  const getEditorSourceActions = async () => {
6642
6642
  // @ts-ignore
6643
- const sourceActions = await invoke$7('GetEditorSourceActions.getEditorSourceActions');
6643
+ const sourceActions = await invoke$8('GetEditorSourceActions.getEditorSourceActions');
6644
6644
  return sourceActions;
6645
6645
  };
6646
6646
 
@@ -6704,7 +6704,8 @@ const create = () => {
6704
6704
  height: 0,
6705
6705
  focusedIndex: 0,
6706
6706
  sourceActions: [],
6707
- maxHeight: 0
6707
+ maxHeight: 0,
6708
+ commands: []
6708
6709
  },
6709
6710
  newState: {
6710
6711
  uid: completionUid,
@@ -6714,19 +6715,67 @@ const create = () => {
6714
6715
  height: 0,
6715
6716
  focusedIndex: 0,
6716
6717
  sourceActions: [],
6717
- maxHeight: 0
6718
+ maxHeight: 0,
6719
+ commands: []
6718
6720
  }
6719
6721
  };
6720
6722
  return widget;
6721
6723
  };
6722
6724
 
6723
- const showSourceActions = async editor => {
6725
+ const showSourceActions$1 = async editor => {
6724
6726
  const newStateGenerator = async state => {
6725
6727
  return loadSourceActions(editor, state);
6726
6728
  };
6727
6729
  return addWidgetToEditor(SourceAction$1, SourceActions, editor, create, newStateGenerator);
6728
6730
  };
6729
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
+
6730
6779
  const compareString = (a, b) => {
6731
6780
  return a.localeCompare(b);
6732
6781
  };
@@ -7301,7 +7350,7 @@ const typeWithAutoClosingQuote = (editor, text) => {
7301
7350
  const typeWithAutoClosingTag = async (editor, text) => {
7302
7351
  const offset = offsetAt(editor, editor.selections[0], editor.selections[1]);
7303
7352
  // @ts-ignore
7304
- const result = await invoke$7('ExtensionHostClosingTagCompletion.executeClosingTagProvider', editor, offset, text);
7353
+ const result = await invoke$8('ExtensionHostClosingTagCompletion.executeClosingTagProvider', editor, offset, text);
7305
7354
  if (!result) {
7306
7355
  const changes = editorReplaceSelections(editor, [text], EditorType);
7307
7356
  return scheduleDocumentAndCursorsSelections(editor, changes);
@@ -7563,13 +7612,15 @@ const addWidget$1 = (widget, id, render) => {
7563
7612
  const getWidgetInvoke = widgetId => {
7564
7613
  switch (widgetId) {
7565
7614
  case ColorPicker:
7566
- return invoke$6;
7615
+ return invoke$7;
7567
7616
  case Completion:
7568
- return invoke$3;
7617
+ return invoke$4;
7569
7618
  case Find:
7570
- return invoke$2;
7619
+ return invoke$3;
7571
7620
  case Rename:
7572
- return invoke$4;
7621
+ return invoke$5;
7622
+ case SourceAction$1:
7623
+ return invoke$1;
7573
7624
  default:
7574
7625
  return undefined;
7575
7626
  }
@@ -9169,13 +9220,13 @@ const getTokensViewport2 = async (editor, startLineIndex, endLineIndex, syncIncr
9169
9220
  languageId,
9170
9221
  invalidStartIndex
9171
9222
  };
9172
- return invoke$1('GetTokensViewport.getTokensViewport', slimEditor,
9223
+ return invoke$2('GetTokensViewport.getTokensViewport', slimEditor,
9173
9224
  // @ts-ignore
9174
9225
  startLineIndex, endLineIndex, hasLinesToSend, id, linesToSend);
9175
9226
  }
9176
9227
  // TODO only send needed lines of text
9177
9228
  // @ts-ignore
9178
- 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);
9179
9230
  }
9180
9231
  return getTokensViewport(editor, startLineIndex, endLineIndex);
9181
9232
  };
@@ -9537,7 +9588,7 @@ const getIncrementalEdits = async (oldState, newState) => {
9537
9588
  const oldLine = oldState.lines[rowIndex];
9538
9589
  const newLine = lines[rowIndex];
9539
9590
  // @ts-ignore
9540
- const incrementalEdits = await invoke$1(
9591
+ const incrementalEdits = await invoke$2(
9541
9592
  // @ts-ignore
9542
9593
  'TokenizeIncremental.tokenizeIncremental', newState.uid,
9543
9594
  // @ts-ignore
@@ -9658,7 +9709,7 @@ const renderFocus$1 = {
9658
9709
  // TODO avoid side effect
9659
9710
  if (newState.focused) {
9660
9711
  const FocusEditorText = 12;
9661
- invoke$7('Focus.setFocus', FocusEditorText);
9712
+ invoke$8('Focus.setFocus', FocusEditorText);
9662
9713
  }
9663
9714
  return [/* method */'setFocused', newState.focused];
9664
9715
  }
@@ -9846,7 +9897,7 @@ const updateDebugInfo = async debugId => {
9846
9897
  };
9847
9898
  set$6(key, oldState, newEditor);
9848
9899
  // @ts-ignore
9849
- await invoke$7('Editor.rerender', key);
9900
+ await invoke$8('Editor.rerender', key);
9850
9901
  };
9851
9902
 
9852
9903
  const editorDiagnosticEffect = {
@@ -10094,8 +10145,9 @@ const commandMap = {
10094
10145
  'Editor.setSelections2': setSelections2,
10095
10146
  'Editor.showHover': showHover,
10096
10147
  'Editor.showHover2': showHover2,
10097
- 'Editor.showSourceActions': showSourceActions,
10098
- 'Editor.showSourceActions2': showSourceActions,
10148
+ 'Editor.showSourceActions': showSourceActions$1,
10149
+ 'Editor.showSourceActions2': showSourceActions$1,
10150
+ 'Editor.showSourceActions3': showSourceActions,
10099
10151
  'Editor.sortLinesAscending': sortLinesAscending,
10100
10152
  'Editor.tabCompletion': tabCompletion,
10101
10153
  'Editor.toggleBlockComment': toggleBlockComment,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/editor-worker",
3
- "version": "7.19.0",
3
+ "version": "7.20.0",
4
4
  "license": "MIT",
5
5
  "author": "Lvce Editor",
6
6
  "type": "module",