@lvce-editor/quick-pick-worker 4.24.0 → 4.24.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.
@@ -4271,6 +4271,13 @@ const selectIndex = async (state, index, button = /* left */0) => {
4271
4271
  void fn(pick, value, state.applicationId);
4272
4272
  return state;
4273
4273
  }
4274
+ // Restore the editor focus before a builtin command opens or focuses another view.
4275
+ // Closing afterward can steal that view's focus while the user is already typing.
4276
+ const commandId = pick.id;
4277
+ const closeBeforeBuiltin = subId === Commands$1 && shouldHide(pick) && commandId !== 'QuickPick.showColorTheme' && commandId !== 'QuickPick.changeLanguageMode';
4278
+ if (closeBeforeBuiltin) {
4279
+ await closeWidget(state.uid);
4280
+ }
4274
4281
  const selectPickResult = await fn(pick, value, state.applicationId);
4275
4282
  object(selectPickResult);
4276
4283
  string(selectPickResult.command);
@@ -4279,7 +4286,9 @@ const selectIndex = async (state, index, button = /* left */0) => {
4279
4286
  } = selectPickResult;
4280
4287
  switch (command) {
4281
4288
  case Hide:
4282
- await closeWidget(state.uid);
4289
+ if (!closeBeforeBuiltin) {
4290
+ await closeWidget(state.uid);
4291
+ }
4283
4292
  if (selectPickResult.itemCommand) {
4284
4293
  await invoke$3(selectPickResult.itemCommand, ...(selectPickResult.itemCommandArgs || []));
4285
4294
  }
@@ -5201,6 +5210,11 @@ const applyRender = (oldState, newState, diffResult) => {
5201
5210
  if (item === RenderFocusedIndex) {
5202
5211
  continue;
5203
5212
  }
5213
+ if (item === RenderFocus) {
5214
+ // Register shortcuts before rendering/focusing the input. Waiting for its
5215
+ // DOM focus event leaves a round trip where Enter can be lost.
5216
+ commands.push(['Viewlet.setFocusContext', newState.uid, FocusQuickPickInput]);
5217
+ }
5204
5218
  const fn = getRenderer(item);
5205
5219
  commands.push(fn(oldState, newState));
5206
5220
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/quick-pick-worker",
3
- "version": "4.24.0",
3
+ "version": "4.24.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/lvce-editor/quick-pick-worker.git"