@lvce-editor/quick-pick-worker 4.20.0 → 4.20.2

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.
@@ -1364,34 +1364,34 @@ const SetPatches = 'Viewlet.setPatches';
1364
1364
  const FocusQuickPickInput = 20;
1365
1365
 
1366
1366
  const {
1367
- invoke: invoke$6,
1367
+ invoke: invoke$7,
1368
1368
  set: set$7
1369
1369
  } = create$4(EditorWorker);
1370
1370
  const getLines = async editorUid => {
1371
- const lines = await invoke$6('Editor.getLines2', editorUid);
1371
+ const lines = await invoke$7('Editor.getLines2', editorUid);
1372
1372
  return lines;
1373
1373
  };
1374
1374
 
1375
1375
  const {
1376
- invoke: invoke$5,
1376
+ invoke: invoke$6,
1377
1377
  set: set$6
1378
1378
  } = create$4(ExtensionManagementWorker);
1379
1379
  const getLanguages = (platform, assetDir) => {
1380
- return invoke$5('Extensions.getLanguages', platform, assetDir);
1380
+ return invoke$6('Extensions.getLanguages', platform, assetDir);
1381
1381
  };
1382
1382
 
1383
1383
  const {
1384
- invoke: invoke$4,
1384
+ invoke: invoke$5,
1385
1385
  set: set$5
1386
1386
  } = create$4(7013);
1387
1387
 
1388
1388
  const {
1389
- invoke: invoke$3,
1389
+ invoke: invoke$4,
1390
1390
  set: set$4
1391
1391
  } = create$4(RendererProcess);
1392
1392
 
1393
1393
  const {
1394
- invoke: invoke$2,
1394
+ invoke: invoke$3,
1395
1395
  invokeAndTransfer,
1396
1396
  set: set$3
1397
1397
  } = create$4(RendererWorker);
@@ -1400,37 +1400,37 @@ const sendMessagePortToEditorWorker = async (port, rpcId) => {
1400
1400
  await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToEditorWorker', port, command, rpcId);
1401
1401
  };
1402
1402
  const setFocus = key => {
1403
- return invoke$2('Focus.setFocus', key);
1403
+ return invoke$3('Focus.setFocus', key);
1404
1404
  };
1405
1405
  const getFileIcon = async options => {
1406
- return invoke$2('IconTheme.getFileIcon', options);
1406
+ return invoke$3('IconTheme.getFileIcon', options);
1407
1407
  };
1408
1408
  const getFolderIcon = async options => {
1409
- return invoke$2('IconTheme.getFolderIcon', options);
1409
+ return invoke$3('IconTheme.getFolderIcon', options);
1410
1410
  };
1411
1411
  const closeWidget$1 = async widgetId => {
1412
- return invoke$2('Viewlet.closeWidget', widgetId);
1412
+ return invoke$3('Viewlet.closeWidget', widgetId);
1413
1413
  };
1414
1414
  const sendMessagePortToFileSearchWorker2 = async (port, rpcId = 0) => {
1415
1415
  const command = 'FileSearch.handleMessagePort';
1416
1416
  await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSearchWorker', port, command, rpcId);
1417
1417
  };
1418
1418
  const getActiveEditorId = () => {
1419
- return invoke$2('GetActiveEditor.getActiveEditorId');
1419
+ return invoke$3('GetActiveEditor.getActiveEditorId');
1420
1420
  };
1421
1421
  const sendMessagePortToExtensionManagementWorker = async (port, rpcId) => {
1422
1422
  const command = 'Extensions.handleMessagePort';
1423
1423
  await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionManagementWorker', port, command, rpcId);
1424
1424
  };
1425
1425
  const openUri$1 = async (uri, focus, options) => {
1426
- await invoke$2('Main.openUri', {
1426
+ await invoke$3('Main.openUri', {
1427
1427
  ...options,
1428
1428
  focus,
1429
1429
  uri
1430
1430
  });
1431
1431
  };
1432
1432
  const showErrorDialog$1 = async errorInfo => {
1433
- await invoke$2('ErrorHandling.showErrorDialog', errorInfo);
1433
+ await invoke$3('ErrorHandling.showErrorDialog', errorInfo);
1434
1434
  };
1435
1435
 
1436
1436
  const closeWidget = async id => {
@@ -1508,7 +1508,7 @@ const close = async state => {
1508
1508
  }
1509
1509
  executeCallback(resolveId, result);
1510
1510
  } else {
1511
- await invoke$2('QuickPick.executeCallback', resolveId, result);
1511
+ await invoke$3('QuickPick.executeCallback', resolveId, result);
1512
1512
  }
1513
1513
  }
1514
1514
  }
@@ -1963,9 +1963,10 @@ const handleScrollBarPointerUp = (state, pointerId) => {
1963
1963
  };
1964
1964
  };
1965
1965
 
1966
- const create = (uid, uri, listItemHeight, x, y, width, height, platform, args, _renderAllItems, workspaceUri, assetDir) => {
1966
+ const create = (uid, uri, listItemHeight, x, y, width, height, platform, args, _renderAllItems, workspaceUri, assetDir, applicationId) => {
1967
1967
  const state = {
1968
1968
  allowEmptyResult: false,
1969
+ applicationId,
1969
1970
  cursorOffset: 0,
1970
1971
  height: 300,
1971
1972
  icons: [],
@@ -2056,7 +2057,7 @@ const dispose = uid => {
2056
2057
  };
2057
2058
 
2058
2059
  const setColorTheme = id => {
2059
- return invoke$2(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
2060
+ return invoke$3(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
2060
2061
  };
2061
2062
 
2062
2063
  const focusPick$1 = async pick => {
@@ -2709,7 +2710,7 @@ const getFinalDeltaY = (height, itemHeight, itemsLength) => {
2709
2710
  };
2710
2711
 
2711
2712
  const getColorThemeNames = async (assetDir, platform) => {
2712
- return invoke$2('ColorTheme.getColorThemeNames', assetDir, platform);
2713
+ return invoke$3('ColorTheme.getColorThemeNames', assetDir, platform);
2713
2714
  };
2714
2715
 
2715
2716
  const toProtoVisibleItem$4 = name => {
@@ -2793,7 +2794,7 @@ const state$3 = {
2793
2794
  const getAll = async () => {
2794
2795
  try {
2795
2796
  // @ts-ignore
2796
- const entries = await invoke$2('Layout.getAllQuickPickMenuEntries');
2797
+ const entries = await invoke$3('Layout.getAllQuickPickMenuEntries');
2797
2798
  return entries || [];
2798
2799
  } catch {
2799
2800
  // ignore
@@ -2821,14 +2822,14 @@ const prefixIdWithExt = item => {
2821
2822
  label: item.label || item.id
2822
2823
  };
2823
2824
  };
2824
- const getExtensionPicks = async (assetDir, platform) => {
2825
+ const getExtensionPicks = async (assetDir, platform, applicationId) => {
2825
2826
  try {
2826
2827
  // TODO
2827
2828
  // Assert.string(assetDir)
2828
2829
  // Assert.number(platform)
2829
2830
  // TODO ask extension management worker directly
2830
2831
  // TODO don't call this every time, cache the results
2831
- const extensionPicks = await invoke$2('ExtensionHost.getCommands', assetDir, platform);
2832
+ const extensionPicks = applicationId === undefined ? await invoke$3('ExtensionHost.getCommands', assetDir, platform) : await invoke$3('Application.execute', applicationId, 'ExtensionHost.getCommands', assetDir, platform);
2832
2833
  if (!extensionPicks) {
2833
2834
  return [];
2834
2835
  }
@@ -2861,12 +2862,13 @@ const toProtoVisibleItem$3 = item => {
2861
2862
  return pick;
2862
2863
  };
2863
2864
  const getPicks$e = async (value, args, {
2865
+ applicationId,
2864
2866
  assetDir = '',
2865
2867
  platform = 0
2866
2868
  } = {}) => {
2867
2869
  // TODO get picks in parallel
2868
2870
  const builtinPicks = await getBuiltinPicks();
2869
- const extensionPicks = await getExtensionPicks(assetDir, platform);
2871
+ const extensionPicks = await getExtensionPicks(assetDir, platform, applicationId);
2870
2872
  const allPicks = [...builtinPicks, ...extensionPicks];
2871
2873
  const converted = allPicks.map(toProtoVisibleItem$3);
2872
2874
  return converted;
@@ -2898,7 +2900,7 @@ const state$1 = {
2898
2900
  const set$1 = newRpc => {
2899
2901
  state$1.rpc = newRpc;
2900
2902
  };
2901
- const invoke$1 = (method, ...args) => {
2903
+ const invoke$2 = (method, ...args) => {
2902
2904
  return state$1.rpc.invoke(method, ...args);
2903
2905
  };
2904
2906
 
@@ -2929,7 +2931,7 @@ const getPicks$d = async (searchValue, args) => {
2929
2931
  const options = args.at(-1);
2930
2932
  let items;
2931
2933
  if (options?.mode === 'quickInput') {
2932
- items = searchValue === '' && options?.customItemsId ? get(options.customItemsId) : await invoke$1('ExtensionHostQuickPick.renderQuickInput', options.quickInputId, searchValue);
2934
+ items = searchValue === '' && options?.customItemsId ? get(options.customItemsId) : await invoke$2('ExtensionHostQuickPick.renderQuickInput', options.quickInputId, searchValue);
2933
2935
  } else {
2934
2936
  items = options?.customItemsId ? get(options.customItemsId) : args[1] || [];
2935
2937
  }
@@ -2954,11 +2956,11 @@ const getPicks$c = async () => {
2954
2956
  const emptyMatches = [];
2955
2957
 
2956
2958
  const getWorkspacePath = async () => {
2957
- return invoke$2('Workspace.getPath');
2959
+ return invoke$3('Workspace.getPath');
2958
2960
  };
2959
2961
 
2960
2962
  const searchFile$1 = async (path, value, prepare, assetDir) => {
2961
- const result = await invoke$4('FileSearch.searchFile', path, value, prepare, assetDir);
2963
+ const result = await invoke$5('FileSearch.searchFile', path, value, prepare, assetDir);
2962
2964
  return result;
2963
2965
  };
2964
2966
 
@@ -3352,7 +3354,7 @@ const uniq = array => {
3352
3354
  });
3353
3355
  };
3354
3356
  const getRecentlyOpened = async () => {
3355
- const recentlyOpened = await invoke$2(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
3357
+ const recentlyOpened = await invoke$3(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
3356
3358
  return uniq(recentlyOpened);
3357
3359
  };
3358
3360
 
@@ -3467,7 +3469,7 @@ const selectPickBuiltin = async item => {
3467
3469
  }
3468
3470
  const args = item.args || [];
3469
3471
  // TODO ids should be all numbers for efficiency -> also directly can call command
3470
- await invoke$2(item.id, ...args);
3472
+ await invoke$3(item.id, ...args);
3471
3473
  if (shouldHide(item)) {
3472
3474
  return {
3473
3475
  command: Hide
@@ -3477,10 +3479,14 @@ const selectPickBuiltin = async item => {
3477
3479
  command: KeepOpen
3478
3480
  };
3479
3481
  };
3480
- const selectPickExtension = async item => {
3482
+ const selectPickExtension = async (item, applicationId) => {
3481
3483
  const id = item.id.slice(4); // TODO lots of string allocation with 'ext.' find a better way to separate builtin commands from extension commands
3482
3484
  try {
3483
- await invoke$2('ExtensionHost.executeCommand', id);
3485
+ if (applicationId === undefined) {
3486
+ await invoke$3('ExtensionHost.executeCommand', id);
3487
+ } else {
3488
+ await invoke$3('Application.execute', applicationId, 'ExtensionHost.executeCommand', id);
3489
+ }
3484
3490
  } catch (error) {
3485
3491
  await handleError(error, false);
3486
3492
  await showErrorDialog(error);
@@ -3492,13 +3498,13 @@ const selectPickExtension = async item => {
3492
3498
  command: Hide
3493
3499
  };
3494
3500
  };
3495
- const selectPick$b = async item => {
3501
+ const selectPick$b = async (item, _value = '', applicationId) => {
3496
3502
  // @ts-ignore
3497
3503
  const {
3498
3504
  id
3499
3505
  } = item;
3500
3506
  if (id.startsWith('ext.')) {
3501
- return selectPickExtension(item);
3507
+ return selectPickExtension(item, applicationId);
3502
3508
  }
3503
3509
  return selectPickBuiltin(item);
3504
3510
  };
@@ -3538,7 +3544,7 @@ const selectPick$a = async (_pick, value) => {
3538
3544
  }
3539
3545
  executeCallback(resolveId, result);
3540
3546
  } else {
3541
- await invoke$2('QuickPick.executeCallback', resolveId, result);
3547
+ await invoke$3('QuickPick.executeCallback', resolveId, result);
3542
3548
  }
3543
3549
  return {
3544
3550
  command: Hide
@@ -3547,7 +3553,7 @@ const selectPick$a = async (_pick, value) => {
3547
3553
 
3548
3554
  const selectPick$9 = async pick => {
3549
3555
  const editorId = await getActiveEditorId();
3550
- await invoke$2('Viewlet.executeViewletCommand', editorId, 'setEndOfLine', pick.value);
3556
+ await invoke$3('Viewlet.executeViewletCommand', editorId, 'setEndOfLine', pick.value);
3551
3557
  return {
3552
3558
  command: Hide
3553
3559
  };
@@ -3571,12 +3577,12 @@ const selectPick$8 = async pick => {
3571
3577
  };
3572
3578
 
3573
3579
  const setCursor = async (rowIndex, columnIndex) => {
3574
- await invoke$2('Editor.cursorSet', rowIndex, columnIndex);
3580
+ await invoke$3('Editor.cursorSet', rowIndex, columnIndex);
3575
3581
  };
3576
3582
 
3577
3583
  const goToPositionAndFocus = async (rowIndex, columnIndex) => {
3578
3584
  await setCursor(rowIndex, columnIndex);
3579
- await invoke$2('Editor.handleFocus');
3585
+ await invoke$3('Editor.handleFocus');
3580
3586
  };
3581
3587
 
3582
3588
  const selectPickGoToColumn = async (item, value) => {
@@ -3619,7 +3625,7 @@ const selectPick$6 = async item => {
3619
3625
 
3620
3626
  const selectPick$5 = async pick => {
3621
3627
  const editorId = await getActiveEditorId();
3622
- await invoke$2('Viewlet.executeViewletCommand', editorId, 'setIndentation', pick.value);
3628
+ await invoke$3('Viewlet.executeViewletCommand', editorId, 'setIndentation', pick.value);
3623
3629
  return {
3624
3630
  command: Hide
3625
3631
  };
@@ -3628,7 +3634,7 @@ const selectPick$5 = async pick => {
3628
3634
  const selectPick$4 = async pick => {
3629
3635
  const editorId = await getActiveEditorId();
3630
3636
  const value = pick.value;
3631
- await invoke$2('Viewlet.executeViewletCommand', editorId, 'setLanguageId', value.languageId, value.tokenizePath);
3637
+ await invoke$3('Viewlet.executeViewletCommand', editorId, 'setLanguageId', value.languageId, value.tokenizePath);
3632
3638
  return {
3633
3639
  command: Hide
3634
3640
  };
@@ -3636,7 +3642,7 @@ const selectPick$4 = async pick => {
3636
3642
 
3637
3643
  const openWorkspaceFolder = uri => {
3638
3644
  const command = uri.includes('://') ? 'Workspace.setUri' : 'Workspace.setPath';
3639
- return invoke$2(command, uri);
3645
+ return invoke$3(command, uri);
3640
3646
  };
3641
3647
 
3642
3648
  // TODO selectPick should be independent of show/hide
@@ -3684,11 +3690,13 @@ const getSelect = id => {
3684
3690
  };
3685
3691
 
3686
3692
  const getPicks = (id, searchValue, args, {
3693
+ applicationId,
3687
3694
  assetDir,
3688
3695
  platform
3689
3696
  }) => {
3690
3697
  const fn = getPicks$1(id);
3691
3698
  return fn(searchValue, args, {
3699
+ applicationId,
3692
3700
  assetDir,
3693
3701
  platform
3694
3702
  });
@@ -3758,6 +3766,7 @@ const setValue = async (state, newValue) => {
3758
3766
  const subId = getQuickPickSubProviderId(providerId, prefix);
3759
3767
  const quickInput = isQuickInput(args);
3760
3768
  const newPicks = isStaticQuickInput(args) || subId === LanguageMode$1 ? state.picks : await getPicks(subId, newValue, args, {
3769
+ applicationId: state.applicationId,
3761
3770
  assetDir,
3762
3771
  platform
3763
3772
  });
@@ -3881,7 +3890,7 @@ const handleBlur = async state => {
3881
3890
  const options = args.at(-1);
3882
3891
  if (!options?.executeItemCommand) {
3883
3892
  const resolveId = args[2];
3884
- await invoke$2('QuickPick.executeCallback', resolveId, getCancelResult(args));
3893
+ await invoke$3('QuickPick.executeCallback', resolveId, getCancelResult(args));
3885
3894
  }
3886
3895
  }
3887
3896
  await closeWidget(state.uid);
@@ -4027,6 +4036,7 @@ const getLoadedState = async state => {
4027
4036
  const prefix = getQuickPickPrefix(value);
4028
4037
  const subId = getQuickPickSubProviderId(id, prefix);
4029
4038
  const newPicks = await getPicks(subId, value, args, {
4039
+ applicationId: state.applicationId,
4030
4040
  assetDir,
4031
4041
  platform
4032
4042
  });
@@ -4135,10 +4145,10 @@ const selectIndex = async (state, index, button = /* left */0) => {
4135
4145
  const fn = getSelect(subId);
4136
4146
  if (shouldCloseBeforeSelect(subId, pick)) {
4137
4147
  await closeWidget(state.uid);
4138
- void fn(pick, value);
4148
+ void fn(pick, value, state.applicationId);
4139
4149
  return state;
4140
4150
  }
4141
- const selectPickResult = await fn(pick, value);
4151
+ const selectPickResult = await fn(pick, value, state.applicationId);
4142
4152
  object(selectPickResult);
4143
4153
  string(selectPickResult.command);
4144
4154
  const {
@@ -4148,7 +4158,7 @@ const selectIndex = async (state, index, button = /* left */0) => {
4148
4158
  case Hide:
4149
4159
  await closeWidget(state.uid);
4150
4160
  if (selectPickResult.itemCommand) {
4151
- await invoke$2(selectPickResult.itemCommand, ...(selectPickResult.itemCommandArgs || []));
4161
+ await invoke$3(selectPickResult.itemCommand, ...(selectPickResult.itemCommandArgs || []));
4152
4162
  }
4153
4163
  return state;
4154
4164
  case OpenColorTheme:
@@ -4217,8 +4227,8 @@ const isConnected = () => {
4217
4227
  } = state;
4218
4228
  return connected;
4219
4229
  };
4220
- const invoke = (method, ...params) => {
4221
- return invoke$3(method, ...params);
4230
+ const invoke$1 = (method, ...params) => {
4231
+ return invoke$4(method, ...params);
4222
4232
  };
4223
4233
  const set = rpc => {
4224
4234
  set$4(rpc);
@@ -4232,7 +4242,7 @@ const handleRendererProcessMessagePort = async (port, viewletCommandMap, setAsRe
4232
4242
  throw new TypeError(`Viewlet command not found: ${command}`);
4233
4243
  }
4234
4244
  await fn(uid, ...args);
4235
- await invoke$2('Viewlet.requestRender', uid);
4245
+ await invoke$3('Viewlet.requestRender', uid);
4236
4246
  };
4237
4247
  const rpc = await create$8({
4238
4248
  commandMap: {
@@ -5045,7 +5055,7 @@ const isFocusContextCommand = command => {
5045
5055
  const renderDirect = async (uid, commands) => {
5046
5056
  const rendererWorkerCommands = commands.filter(isFocusContextCommand);
5047
5057
  const rendererProcessCommands = commands.filter(command => !isFocusContextCommand(command));
5048
- const transactionId = await invoke('Viewlet.queueCommands', uid, rendererProcessCommands);
5058
+ const transactionId = await invoke$1('Viewlet.queueCommands', uid, rendererProcessCommands);
5049
5059
  return [...rendererWorkerCommands, ['Viewlet.commitPending', uid, transactionId]];
5050
5060
  };
5051
5061
  const render2 = (uid, diffResult) => {
@@ -5146,7 +5156,12 @@ const serialize = command => {
5146
5156
  };
5147
5157
  };
5148
5158
 
5159
+ const invoke = async (applicationId, method, ...args) => {
5160
+ return applicationId === undefined ? invoke$3(method, ...args) : invoke$3('Application.execute', applicationId, method, ...args);
5161
+ };
5162
+
5149
5163
  const showQuickInput = async ({
5164
+ applicationId,
5150
5165
  id,
5151
5166
  ignoreFocusOut,
5152
5167
  initialItems = [],
@@ -5157,7 +5172,7 @@ const showQuickInput = async ({
5157
5172
  const customItemsId = add(initialItems);
5158
5173
  const picks = [];
5159
5174
  try {
5160
- const result = await invoke$2('QuickPick.showCustom', picks, {
5175
+ const result = await invoke(applicationId, 'QuickPick.showCustom', picks, {
5161
5176
  customItemsId,
5162
5177
  ignoreFocusOut,
5163
5178
  initialValue,
@@ -5179,6 +5194,7 @@ const QuickPick = 'QuickPick';
5179
5194
 
5180
5195
  const showQuickPick = async ({
5181
5196
  acceptInput = false,
5197
+ applicationId,
5182
5198
  items,
5183
5199
  placeholder = '',
5184
5200
  waitUntil = 'selected'
@@ -5189,7 +5205,7 @@ const showQuickPick = async ({
5189
5205
  promise
5190
5206
  } = registerCallback();
5191
5207
  try {
5192
- await invoke$2('Viewlet.openWidget', QuickPick, 'custom', [], id, {
5208
+ await invoke(applicationId, 'Viewlet.openWidget', QuickPick, 'custom', [], id, {
5193
5209
  acceptInput,
5194
5210
  callbackOwner: 'quickPickWorker',
5195
5211
  customItemsId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/quick-pick-worker",
3
- "version": "4.20.0",
3
+ "version": "4.20.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/lvce-editor/quick-pick-worker.git"