@lvce-editor/quick-pick-worker 4.19.3 → 4.20.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.
@@ -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: [],
@@ -2174,7 +2175,7 @@ const focusIndex = async (state, index) => {
2174
2175
  await focusPick(providerId, items[index]);
2175
2176
  if (index < minLineY + 1) {
2176
2177
  const minLineY = index;
2177
- const maxLineY = Math.min(index + maxVisibleItems, items.length - 1);
2178
+ const maxLineY = Math.min(index + maxVisibleItems, items.length);
2178
2179
  const sliced = items.slice(minLineY, maxLineY);
2179
2180
  const {
2180
2181
  icons,
@@ -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$2('ExtensionHost.getCommands', assetDir, platform) : await invoke$2('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;
@@ -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$2('ExtensionHost.executeCommand', id);
3487
+ } else {
3488
+ await invoke$2('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
  };
@@ -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
  });
@@ -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 {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/quick-pick-worker",
3
- "version": "4.19.3",
3
+ "version": "4.20.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/lvce-editor/quick-pick-worker.git"