@lvce-editor/quick-pick-worker 4.4.2 → 4.5.1

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.
@@ -3100,10 +3100,15 @@ const selectPick$8 = async (_pick, value) => {
3100
3100
  } = state$1;
3101
3101
  const options = getOptions(args);
3102
3102
  const resolveId = args[2];
3103
- const result = options.mode === 'quickPick' ? _pick.value : {
3104
- canceled: false,
3105
- inputValue: value
3106
- };
3103
+ let result;
3104
+ if (options.mode === 'quickPick') {
3105
+ result = options.acceptInput && _pick.value === undefined ? value : _pick.value;
3106
+ } else {
3107
+ result = {
3108
+ canceled: false,
3109
+ inputValue: value
3110
+ };
3111
+ }
3107
3112
  if (options.callbackOwner === 'quickPickWorker') {
3108
3113
  if (typeof resolveId !== 'number') {
3109
3114
  throw new TypeError('expected resolve id to be a number');
@@ -3637,6 +3642,15 @@ const createCustomPick = value => {
3637
3642
  uri: ''
3638
3643
  };
3639
3644
  };
3645
+ const shouldCloseBeforeSelect = (subId, pick) => {
3646
+ if (subId !== Commands$1) {
3647
+ return false;
3648
+ }
3649
+ const {
3650
+ id
3651
+ } = pick;
3652
+ return typeof id === 'string' && id.startsWith('ext.');
3653
+ };
3640
3654
  const selectIndex = async (state, index, button = /* left */0) => {
3641
3655
  const {
3642
3656
  items,
@@ -3651,6 +3665,10 @@ const selectIndex = async (state, index, button = /* left */0) => {
3651
3665
  if (!pick) {
3652
3666
  return state;
3653
3667
  }
3668
+ const closed = shouldCloseBeforeSelect(subId, pick);
3669
+ if (closed) {
3670
+ await closeWidget(state.uid);
3671
+ }
3654
3672
  const fn = getSelect(subId);
3655
3673
  const selectPickResult = await fn(pick, value);
3656
3674
  object(selectPickResult);
@@ -3660,7 +3678,9 @@ const selectIndex = async (state, index, button = /* left */0) => {
3660
3678
  } = selectPickResult;
3661
3679
  switch (command) {
3662
3680
  case Hide:
3663
- await closeWidget(state.uid);
3681
+ if (!closed) {
3682
+ await closeWidget(state.uid);
3683
+ }
3664
3684
  return state;
3665
3685
  case OpenLanguageMode:
3666
3686
  return loadContent({
@@ -4571,6 +4591,7 @@ const showQuickInput = async ({
4571
4591
  const QuickPick = 'QuickPick';
4572
4592
 
4573
4593
  const showQuickPick = async ({
4594
+ acceptInput = false,
4574
4595
  items,
4575
4596
  placeholder = '',
4576
4597
  waitUntil = 'selected'
@@ -4582,6 +4603,7 @@ const showQuickPick = async ({
4582
4603
  } = registerCallback();
4583
4604
  try {
4584
4605
  await invoke$1('Viewlet.openWidget', QuickPick, 'custom', [], id, {
4606
+ acceptInput,
4585
4607
  callbackOwner: 'quickPickWorker',
4586
4608
  customItemsId,
4587
4609
  mode: 'quickPick',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/quick-pick-worker",
3
- "version": "4.4.2",
3
+ "version": "4.5.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/lvce-editor/quick-pick-worker.git"