@lvce-editor/file-search-worker 3.11.0 → 3.13.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.
@@ -863,10 +863,38 @@ const Script = 2;
863
863
 
864
864
  const minimumSliderSize = 20;
865
865
 
866
+ const RendererWorker = 1;
867
+
868
+ const rpcs = Object.create(null);
869
+ const set$1 = (id, rpc) => {
870
+ rpcs[id] = rpc;
871
+ };
872
+ const get$1 = id => {
873
+ return rpcs[id];
874
+ };
875
+
876
+ const invoke$1 = (method, ...params) => {
877
+ const rpc = get$1(RendererWorker);
878
+ // @ts-ignore
879
+ return rpc.invoke(method, ...params);
880
+ };
881
+
866
882
  const handleError = async (error, notify = true, prefix = '') => {
867
883
  console.error(error);
868
884
  };
869
- const showErrorDialog = async () => {};
885
+ const showErrorDialog = async error => {
886
+ const code = error.code;
887
+ const message = error.message;
888
+ const stack = error.stack;
889
+ const name = error.name;
890
+ const errorInfo = {
891
+ code,
892
+ message,
893
+ stack,
894
+ name
895
+ };
896
+ await invoke$1('ErrorHandling.showErrorDialog', errorInfo);
897
+ };
870
898
  const warn = (...args) => {
871
899
  console.warn(...args);
872
900
  };
@@ -950,22 +978,6 @@ const noWorkspaceSymbolsFound = () => {
950
978
  return i18nString(NoWorkspaceSymbolsFound);
951
979
  };
952
980
 
953
- const RendererWorker = 1;
954
-
955
- const rpcs = Object.create(null);
956
- const set$1 = (id, rpc) => {
957
- rpcs[id] = rpc;
958
- };
959
- const get$1 = id => {
960
- return rpcs[id];
961
- };
962
-
963
- const invoke$1 = (method, ...params) => {
964
- const rpc = get$1(RendererWorker);
965
- // @ts-ignore
966
- return rpc.invoke(method, ...params);
967
- };
968
-
969
981
  const name$8 = 'command';
970
982
  const getPlaceholder$b = () => {
971
983
  return typeNameofCommandToRun();
@@ -1050,8 +1062,7 @@ const selectPickExtension = async item => {
1050
1062
  await invoke$1('ExtensionHost.executeCommand', id);
1051
1063
  } catch (error) {
1052
1064
  await handleError(error, false);
1053
- // @ts-ignore
1054
- await showErrorDialog();
1065
+ await showErrorDialog(error);
1055
1066
  }
1056
1067
  return {
1057
1068
  command: Hide
@@ -3001,6 +3012,63 @@ const handleBlur = async state => {
3001
3012
  return state;
3002
3013
  };
3003
3014
 
3015
+ const getPick = (items, index) => {
3016
+ array(items);
3017
+ number(index);
3018
+ // if (index < state.recentPicks.length) {
3019
+ // return state.recentPicks[index]
3020
+ // }
3021
+ // index -= state.recentPicks.length
3022
+ if (index < items.length) {
3023
+ return items[index].pick;
3024
+ }
3025
+ console.warn('no pick matching index', index);
3026
+ };
3027
+
3028
+ const selectIndex = async (state, index, button = /* left */0) => {
3029
+ const {
3030
+ minLineY,
3031
+ provider,
3032
+ items
3033
+ } = state;
3034
+ const actualIndex = index + minLineY;
3035
+ const pick = getPick(items, actualIndex);
3036
+ const selectPickResult = await provider.selectPick(pick, actualIndex, button);
3037
+ object(selectPickResult);
3038
+ string(selectPickResult.command);
3039
+ const {
3040
+ command
3041
+ } = selectPickResult;
3042
+ switch (command) {
3043
+ case Hide:
3044
+ await closeWidget(state.uid);
3045
+ return state;
3046
+ default:
3047
+ return state;
3048
+ }
3049
+
3050
+ // TODO recent picks should be per provider
3051
+ // if (!state.recentPickIds.has(pick.id)) {
3052
+ // state.recentPicks.unshift(pick)
3053
+ // state.recentPickIds.add(pick.id)
3054
+ // }
3055
+ // if (state.recentPicks.length > RECENT_PICKS_MAX_SIZE) {
3056
+ // const last = state.recentPicks.pop()
3057
+ // state.recentPickIds.delete(last.id)
3058
+ // }
3059
+ };
3060
+
3061
+ const handleClickAt = (state, x, y) => {
3062
+ const {
3063
+ top,
3064
+ headerHeight,
3065
+ itemHeight
3066
+ } = state;
3067
+ const relativeY = y - top - headerHeight;
3068
+ const index = Math.floor(relativeY / itemHeight);
3069
+ return selectIndex(state, index);
3070
+ };
3071
+
3004
3072
  const getDefaultValue = uri => {
3005
3073
  switch (uri) {
3006
3074
  case 'quickPick://everything':
@@ -3297,6 +3365,7 @@ const QuickPickEntriesOpenRecent = {
3297
3365
  };
3298
3366
 
3299
3367
  const CommandPalette = 'quickPick://commandPalette';
3368
+ const Commands = 'quickPick://commands';
3300
3369
  const File = 'quickPick://file';
3301
3370
  const EveryThing = 'quickPick://everything';
3302
3371
  const Number$1 = 'quickPick://number';
@@ -3310,6 +3379,7 @@ const Custom = 'quickPick://custom';
3310
3379
  const load = moduleId => {
3311
3380
  switch (moduleId) {
3312
3381
  case CommandPalette:
3382
+ case Commands:
3313
3383
  case File:
3314
3384
  case EveryThing:
3315
3385
  case WorkspaceSymbol:
@@ -3736,52 +3806,6 @@ const doRender = async uid => {
3736
3806
  return applyRender(oldState, newState, diffResult);
3737
3807
  };
3738
3808
 
3739
- const getPick = (items, index) => {
3740
- array(items);
3741
- number(index);
3742
- // if (index < state.recentPicks.length) {
3743
- // return state.recentPicks[index]
3744
- // }
3745
- // index -= state.recentPicks.length
3746
- if (index < items.length) {
3747
- return items[index].pick;
3748
- }
3749
- console.warn('no pick matching index', index);
3750
- };
3751
-
3752
- const selectIndex = async (state, index, button = /* left */0) => {
3753
- const {
3754
- minLineY,
3755
- provider,
3756
- items
3757
- } = state;
3758
- const actualIndex = index + minLineY;
3759
- const pick = getPick(items, actualIndex);
3760
- const selectPickResult = await provider.selectPick(pick, actualIndex, button);
3761
- object(selectPickResult);
3762
- string(selectPickResult.command);
3763
- const {
3764
- command
3765
- } = selectPickResult;
3766
- switch (command) {
3767
- case Hide:
3768
- await closeWidget(state.uid);
3769
- return state;
3770
- default:
3771
- return state;
3772
- }
3773
-
3774
- // TODO recent picks should be per provider
3775
- // if (!state.recentPickIds.has(pick.id)) {
3776
- // state.recentPicks.unshift(pick)
3777
- // state.recentPickIds.add(pick.id)
3778
- // }
3779
- // if (state.recentPicks.length > RECENT_PICKS_MAX_SIZE) {
3780
- // const last = state.recentPicks.pop()
3781
- // state.recentPickIds.delete(last.id)
3782
- // }
3783
- };
3784
-
3785
3809
  const selectCurrentIndex = state => {
3786
3810
  return selectIndex(state, state.focusedIndex);
3787
3811
  };
@@ -3816,8 +3840,8 @@ const wrapCommand = fn => {
3816
3840
  };
3817
3841
 
3818
3842
  const commandMap = {
3843
+ 'QuickPick.addMenuEntries': add,
3819
3844
  'QuickPick.create2': create$1,
3820
- 'QuickPick.handleInput': wrapCommand(handleInput),
3821
3845
  'QuickPick.focusFirst': wrapCommand(focusFirst),
3822
3846
  'QuickPick.focusIndex': wrapCommand(focusIndex),
3823
3847
  'QuickPick.focusLast': wrapCommand(focusLast),
@@ -3827,6 +3851,8 @@ const commandMap = {
3827
3851
  'QuickPick.getKeyBindings': getKeyBindings,
3828
3852
  'QuickPick.handleBeforeInput': wrapCommand(handleBeforeInput),
3829
3853
  'QuickPick.handleBlur': wrapCommand(handleBlur),
3854
+ 'QuickPick.handleClickAt': wrapCommand(handleClickAt),
3855
+ 'QuickPick.handleInput': wrapCommand(handleInput),
3830
3856
  'QuickPick.handleWheel': wrapCommand(handleWheel),
3831
3857
  'QuickPick.loadContent': wrapCommand(loadContent),
3832
3858
  'QuickPick.loadEntries2': load,
@@ -3835,7 +3861,6 @@ const commandMap = {
3835
3861
  'QuickPick.selectIndex': wrapCommand(selectIndex),
3836
3862
  'QuickPick.selectItem': wrapCommand(selectItem),
3837
3863
  'QuickPick.setDeltaY': wrapCommand(setDeltaY),
3838
- 'QuickPick.addMenuEntries': add,
3839
3864
  'SearchFile.filter': filterQuickPickItems,
3840
3865
  'SearchFile.searchFile': searchFile$1,
3841
3866
  'SearchFile.searchFileWithFetch': searchFile$4,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/file-search-worker",
3
- "version": "3.11.0",
3
+ "version": "3.13.0",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "text-search"