@lvce-editor/editor-worker 3.21.0 → 3.23.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.
@@ -2280,6 +2280,24 @@ const closeCompletion = editor => {
2280
2280
  };
2281
2281
  };
2282
2282
 
2283
+ const isMatchingWidget = widget => {
2284
+ return widget.id === SourceAction;
2285
+ };
2286
+ const closeSourceAction = editor => {
2287
+ const {
2288
+ widgets
2289
+ } = editor;
2290
+ const index = widgets.findIndex(isMatchingWidget);
2291
+ if (index === -1) {
2292
+ return editor;
2293
+ }
2294
+ const newWidgets = [...widgets.slice(0, index), ...widgets.slice(index + 1)];
2295
+ return {
2296
+ ...editor,
2297
+ widgets: newWidgets
2298
+ };
2299
+ };
2300
+
2283
2301
  const hasWidget = (widgets, id) => {
2284
2302
  for (const widget of widgets) {
2285
2303
  if (widget.id === id) {
@@ -2378,7 +2396,7 @@ const FocusFindWidgetCloseButton = 48;
2378
2396
  const FocusFindWidgetNextMatchButton = 49;
2379
2397
  const FocusFindWidgetPreviousMatchButton = 50;
2380
2398
  const FocusEditorHover = 51;
2381
- const SourceActions = 52;
2399
+ const SourceActions = 38;
2382
2400
 
2383
2401
  const newStateGenerator$1 = state => {
2384
2402
  return loadContent$3(state);
@@ -3301,12 +3319,6 @@ const noResults$1 = () => {
3301
3319
  const sourceAction = () => {
3302
3320
  return i18nString(UiStrings$1.SourceAction);
3303
3321
  };
3304
- const organizeImports$1 = () => {
3305
- return i18nString(UiStrings$1.OrganizeImports);
3306
- };
3307
- const sortImports = () => {
3308
- return i18nString(UiStrings$1.SortImports);
3309
- };
3310
3322
 
3311
3323
  // @ts-ignore
3312
3324
  const goTo = async ({
@@ -6539,14 +6551,9 @@ const showSourceActions$1 = async editor => {
6539
6551
  return editor;
6540
6552
  };
6541
6553
 
6554
+ // TODO maybe ask extension host worker instead
6542
6555
  const getEditorSourceActions = async () => {
6543
- const sourceActions = [{
6544
- name: organizeImports$1(),
6545
- command: 'Editor.organizeImports'
6546
- }, {
6547
- name: sortImports(),
6548
- command: 'Editor.sortImports'
6549
- }];
6556
+ const sourceActions = await invoke$3('GetEditorSourceActions.getEditorSourceActions');
6550
6557
  return sourceActions;
6551
6558
  };
6552
6559
 
@@ -8882,6 +8889,7 @@ const commandMap = {
8882
8889
  'Editor.braceCompletion': braceCompletion,
8883
8890
  'Editor.cancelSelection': cancelSelection,
8884
8891
  'Editor.closeCompletion': closeCompletion,
8892
+ 'Editor.closeSourceAction': closeSourceAction,
8885
8893
  'Editor.compositionEnd': compositionEnd,
8886
8894
  'Editor.compositionStart': compositionStart,
8887
8895
  'Editor.compositionUpdate': compositionUpdate,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/editor-worker",
3
- "version": "3.21.0",
3
+ "version": "3.23.0",
4
4
  "description": "",
5
5
  "main": "dist/editorWorkerMain.js",
6
6
  "type": "module",