@lvce-editor/quick-pick-worker 4.6.0 → 4.8.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.
@@ -1309,16 +1309,18 @@ const close = async state => {
1309
1309
  providerId
1310
1310
  } = state;
1311
1311
  if (providerId === Custom$1) {
1312
- const resolveId = args[2];
1313
1312
  const options = args.at(-1);
1314
- const result = getCancelResult$1(args);
1315
- if (options?.callbackOwner === 'quickPickWorker') {
1316
- if (typeof resolveId !== 'number') {
1317
- throw new TypeError('expected resolve id to be a number');
1313
+ if (!options?.executeItemCommand) {
1314
+ const resolveId = args[2];
1315
+ const result = getCancelResult$1(args);
1316
+ if (options?.callbackOwner === 'quickPickWorker') {
1317
+ if (typeof resolveId !== 'number') {
1318
+ throw new TypeError('expected resolve id to be a number');
1319
+ }
1320
+ executeCallback(resolveId, result);
1321
+ } else {
1322
+ await invoke$1('QuickPick.executeCallback', resolveId, result);
1318
1323
  }
1319
- executeCallback(resolveId, result);
1320
- } else {
1321
- await invoke$1('QuickPick.executeCallback', resolveId, result);
1322
1324
  }
1323
1325
  }
1324
1326
  await closeWidget(state.uid);
@@ -2587,12 +2589,16 @@ const invoke = (method, ...args) => {
2587
2589
 
2588
2590
  const toProtoVisibleItem$2 = item => {
2589
2591
  const {
2592
+ args,
2593
+ command,
2590
2594
  description = '',
2591
2595
  icon = '',
2592
2596
  label,
2593
2597
  value
2594
2598
  } = item;
2595
2599
  return {
2600
+ args,
2601
+ command,
2596
2602
  description,
2597
2603
  direntType: 0,
2598
2604
  fileIcon: '',
@@ -3100,6 +3106,13 @@ const selectPick$8 = async (_pick, value) => {
3100
3106
  args
3101
3107
  } = state$1;
3102
3108
  const options = getOptions(args);
3109
+ if (options.executeItemCommand && _pick.command) {
3110
+ return {
3111
+ command: Hide,
3112
+ itemCommand: _pick.command,
3113
+ itemCommandArgs: _pick.args || []
3114
+ };
3115
+ }
3103
3116
  const resolveId = args[2];
3104
3117
  let result;
3105
3118
  if (options.mode === 'quickPick') {
@@ -3432,8 +3445,11 @@ const handleBlur = async state => {
3432
3445
  providerId
3433
3446
  } = state;
3434
3447
  if (providerId === Custom$1) {
3435
- const resolveId = args[2];
3436
- await invoke$1('QuickPick.executeCallback', resolveId, getCancelResult(args));
3448
+ const options = args.at(-1);
3449
+ if (!options?.executeItemCommand) {
3450
+ const resolveId = args[2];
3451
+ await invoke$1('QuickPick.executeCallback', resolveId, getCancelResult(args));
3452
+ }
3437
3453
  }
3438
3454
  await closeWidget(state.uid);
3439
3455
  return state;
@@ -3684,6 +3700,9 @@ const selectIndex = async (state, index, button = /* left */0) => {
3684
3700
  switch (command) {
3685
3701
  case Hide:
3686
3702
  await closeWidget(state.uid);
3703
+ if (selectPickResult.itemCommand) {
3704
+ await invoke$1(selectPickResult.itemCommand, ...(selectPickResult.itemCommandArgs || []));
3705
+ }
3687
3706
  return state;
3688
3707
  case OpenLanguageMode:
3689
3708
  return loadContent({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/quick-pick-worker",
3
- "version": "4.6.0",
3
+ "version": "4.8.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/lvce-editor/quick-pick-worker.git"