@lvce-editor/file-search-worker 6.15.0 → 6.17.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.
@@ -2059,12 +2059,10 @@ const toProtoVisibleItem$3 = name => {
2059
2059
  };
2060
2060
  return pick;
2061
2061
  };
2062
- const getPicks$c = async (searchValue, args) => {
2063
- if (!args || !Array.isArray(args)) {
2064
- args = ['', 0];
2065
- }
2066
- const platform = args.at(-1);
2067
- const assetDir = args.at(-2);
2062
+ const getPicks$c = async (searchValue, args, {
2063
+ assetDir = '',
2064
+ platform = 0
2065
+ } = {}) => {
2068
2066
  const colorThemeNames = await getColorThemeNames(assetDir, platform);
2069
2067
  const picks = colorThemeNames.map(toProtoVisibleItem$3);
2070
2068
  return picks;
@@ -2168,12 +2166,10 @@ const toProtoVisibleItem$2 = item => {
2168
2166
  // @ts-ignore
2169
2167
  return pick;
2170
2168
  };
2171
- const getPicks$b = async (value, args) => {
2172
- if (!args || !Array.isArray(args)) {
2173
- args = ['', 0];
2174
- }
2175
- const platform = args.at(-1);
2176
- const assetDir = args.at(-2);
2169
+ const getPicks$b = async (value, args, {
2170
+ assetDir = '',
2171
+ platform = 0
2172
+ } = {}) => {
2177
2173
  // TODO get picks in parallel
2178
2174
  const builtinPicks = await getBuiltinPicks();
2179
2175
  const extensionPicks = await getExtensionPicks(assetDir, platform);
@@ -2426,14 +2422,22 @@ const getPicksGoToLineBase = async () => {
2426
2422
  }];
2427
2423
  };
2428
2424
 
2425
+ const parseGotoline = value => {
2426
+ const lineString = value.slice(GoToLine$1.length);
2427
+ const wantedLine = Number.parseInt(lineString, 10);
2428
+ if (Number.isNaN(wantedLine)) {
2429
+ return -1;
2430
+ }
2431
+ return wantedLine;
2432
+ };
2433
+
2429
2434
  const getPicks$8 = async value => {
2430
2435
  if (value === GoToLine$1) {
2431
2436
  return getPicksGoToLineBase();
2432
2437
  }
2433
2438
  if (value.startsWith(GoToLine$1)) {
2434
- const lineString = value.slice(GoToLine$1.length);
2435
- const wantedLine = Number.parseInt(lineString, 10);
2436
- if (Number.isNaN(wantedLine)) {
2439
+ const wantedLine = parseGotoline(value);
2440
+ if (wantedLine === -1) {
2437
2441
  return getPicksGoToLineBase();
2438
2442
  }
2439
2443
  const rowIndex = wantedLine - 1;
@@ -2736,9 +2740,15 @@ const getSelect = id => {
2736
2740
  return fn;
2737
2741
  };
2738
2742
 
2739
- const getPicks = (id, searchValue, args) => {
2743
+ const getPicks = (id, searchValue, args, {
2744
+ assetDir,
2745
+ platform
2746
+ }) => {
2740
2747
  const fn = getPicks$1(id);
2741
- return fn(searchValue, args);
2748
+ return fn(searchValue, args, {
2749
+ assetDir,
2750
+ platform
2751
+ });
2742
2752
  };
2743
2753
 
2744
2754
  const getQuickPickSubProviderId = (id, prefix) => {
@@ -2769,11 +2779,13 @@ const getQuickPickSubProviderId = (id, prefix) => {
2769
2779
  const setValue = async (state, newValue) => {
2770
2780
  const {
2771
2781
  args,
2782
+ assetDir,
2772
2783
  fileIconCache,
2773
2784
  height,
2774
2785
  itemHeight,
2775
2786
  maxLineY,
2776
2787
  minLineY,
2788
+ platform,
2777
2789
  providerId,
2778
2790
  value
2779
2791
  } = state;
@@ -2782,7 +2794,10 @@ const setValue = async (state, newValue) => {
2782
2794
  }
2783
2795
  const prefix = getQuickPickPrefix(newValue);
2784
2796
  const subId = getQuickPickSubProviderId(providerId, prefix);
2785
- const newPicks = await getPicks(subId, newValue, args);
2797
+ const newPicks = await getPicks(subId, newValue, args, {
2798
+ assetDir,
2799
+ platform
2800
+ });
2786
2801
  const filterValue = getFilterValue(providerId, subId, newValue);
2787
2802
  const items = filterQuickPickItems(newPicks, filterValue);
2788
2803
  const focusedIndex = items.length === 0 ? -1 : 0;
@@ -2973,7 +2988,6 @@ const getQuickPickProviderId = prefix => {
2973
2988
  };
2974
2989
 
2975
2990
  const loadContent = async state => {
2976
- // @ts-ignore
2977
2991
  const {
2978
2992
  args,
2979
2993
  assetDir,
@@ -2987,7 +3001,10 @@ const loadContent = async state => {
2987
3001
  const value = getDefaultValue(id);
2988
3002
  const prefix = getQuickPickPrefix(value);
2989
3003
  const subId = getQuickPickSubProviderId(id, prefix);
2990
- const newPicks = await getPicks(subId, value, [...args, assetDir, platform]);
3004
+ const newPicks = await getPicks(subId, value, args, {
3005
+ assetDir,
3006
+ platform
3007
+ });
2991
3008
  array(newPicks);
2992
3009
  const filterValue = getFilterValue(id, subId, value);
2993
3010
  const items = filterQuickPickItems(newPicks, filterValue);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/file-search-worker",
3
- "version": "6.15.0",
3
+ "version": "6.17.0",
4
4
  "keywords": [
5
5
  "text-search"
6
6
  ],