@lvce-editor/quick-pick-worker 4.26.0 → 4.28.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.
@@ -2329,6 +2329,78 @@ const getNewValue = (value, inputType, data, selectionStart, selectionEnd) => {
2329
2329
  return fn(value, selectionStart, selectionEnd, data);
2330
2330
  };
2331
2331
 
2332
+ const Command = '>';
2333
+ const Symbol$2 = '@';
2334
+ const WorkspaceSymbol$1 = '#';
2335
+ const GoToLine$1 = ':';
2336
+ const View$2 = 'view ';
2337
+ const None$1 = '';
2338
+ const Help$1 = '?';
2339
+ const GoToColumn = '::';
2340
+
2341
+ const getQuickPickPrefix = value => {
2342
+ if (value.startsWith(Command)) {
2343
+ return Command;
2344
+ }
2345
+ if (value.startsWith(Symbol$2)) {
2346
+ return Symbol$2;
2347
+ }
2348
+ if (value.startsWith(WorkspaceSymbol$1)) {
2349
+ return WorkspaceSymbol$1;
2350
+ }
2351
+ if (value.startsWith(GoToColumn)) {
2352
+ return GoToColumn;
2353
+ }
2354
+ if (value.startsWith(GoToLine$1)) {
2355
+ return GoToLine$1;
2356
+ }
2357
+ if (value.startsWith(View$2)) {
2358
+ return View$2;
2359
+ }
2360
+ return None$1;
2361
+ };
2362
+
2363
+ const getQuickPickSubProviderId = (id, prefix) => {
2364
+ if (id === File$1) {
2365
+ return prefix === Command ? Commands$1 : File$1;
2366
+ }
2367
+ if (id !== EveryThing$1) {
2368
+ return id;
2369
+ }
2370
+ switch (prefix) {
2371
+ case Command:
2372
+ return Commands$1;
2373
+ case GoToColumn:
2374
+ return GoToColumn$1;
2375
+ case GoToLine$1:
2376
+ return GoToLine$2;
2377
+ case Help$1:
2378
+ return Help$2;
2379
+ case Symbol$2:
2380
+ return Symbol$3;
2381
+ case View$2:
2382
+ return View$3;
2383
+ case WorkspaceSymbol$1:
2384
+ return WorkspaceSymbol$2;
2385
+ default:
2386
+ return File$1;
2387
+ }
2388
+ };
2389
+
2390
+ // Keep this aligned with file-search-worker's SearchFileWithRipGrep limit.
2391
+ const maxFileSearchResults = 9_999_999;
2392
+ const canReuseFilePicks = (providerId, previousValue, newValue, pickCount) => {
2393
+ if (providerId !== File$1 && providerId !== EveryThing$1) {
2394
+ return false;
2395
+ }
2396
+ if (newValue.length <= previousValue.length || !newValue.startsWith(previousValue)) {
2397
+ return false;
2398
+ }
2399
+ const previousSubProviderId = getQuickPickSubProviderId(providerId, getQuickPickPrefix(previousValue));
2400
+ const newSubProviderId = getQuickPickSubProviderId(providerId, getQuickPickPrefix(newValue));
2401
+ return previousSubProviderId === File$1 && newSubProviderId === File$1 && pickCount < maxFileSearchResults;
2402
+ };
2403
+
2332
2404
  const Diagonal = 1;
2333
2405
  const Left = 2;
2334
2406
 
@@ -2553,37 +2625,6 @@ const filterQuickPickItems = (items, value, rankCommands = false) => {
2553
2625
  return rankCommands ? rankCommandPicks(results, value) : results;
2554
2626
  };
2555
2627
 
2556
- const Command = '>';
2557
- const Symbol$2 = '@';
2558
- const WorkspaceSymbol$1 = '#';
2559
- const GoToLine$1 = ':';
2560
- const View$2 = 'view ';
2561
- const None$1 = '';
2562
- const Help$1 = '?';
2563
- const GoToColumn = '::';
2564
-
2565
- const getQuickPickPrefix = value => {
2566
- if (value.startsWith(Command)) {
2567
- return Command;
2568
- }
2569
- if (value.startsWith(Symbol$2)) {
2570
- return Symbol$2;
2571
- }
2572
- if (value.startsWith(WorkspaceSymbol$1)) {
2573
- return WorkspaceSymbol$1;
2574
- }
2575
- if (value.startsWith(GoToColumn)) {
2576
- return GoToColumn;
2577
- }
2578
- if (value.startsWith(GoToLine$1)) {
2579
- return GoToLine$1;
2580
- }
2581
- if (value.startsWith(View$2)) {
2582
- return View$2;
2583
- }
2584
- return None$1;
2585
- };
2586
-
2587
2628
  const noop = value => {
2588
2629
  return value;
2589
2630
  };
@@ -3751,33 +3792,6 @@ const getPicks = (id, searchValue, args, {
3751
3792
  });
3752
3793
  };
3753
3794
 
3754
- const getQuickPickSubProviderId = (id, prefix) => {
3755
- if (id === File$1) {
3756
- return prefix === Command ? Commands$1 : File$1;
3757
- }
3758
- if (id !== EveryThing$1) {
3759
- return id;
3760
- }
3761
- switch (prefix) {
3762
- case Command:
3763
- return Commands$1;
3764
- case GoToColumn:
3765
- return GoToColumn$1;
3766
- case GoToLine$1:
3767
- return GoToLine$2;
3768
- case Help$1:
3769
- return Help$2;
3770
- case Symbol$2:
3771
- return Symbol$3;
3772
- case View$2:
3773
- return View$3;
3774
- case WorkspaceSymbol$1:
3775
- return WorkspaceSymbol$2;
3776
- default:
3777
- return File$1;
3778
- }
3779
- };
3780
-
3781
3795
  const requestVersions = new Map();
3782
3796
  const requestVersionGenerator = {
3783
3797
  value: 0
@@ -3793,8 +3807,6 @@ const isStaticQuickInput = args => {
3793
3807
  const options = args.at(-1);
3794
3808
  return options?.mode === 'quickInput' && options.quickInputId === undefined;
3795
3809
  };
3796
-
3797
- // TODO when user types letters -> no need to query provider again -> just filter existing results
3798
3810
  const setValue = async (state, newValue) => {
3799
3811
  const {
3800
3812
  args,
@@ -3821,7 +3833,8 @@ const setValue = async (state, newValue) => {
3821
3833
  const prefix = getQuickPickPrefix(newValue);
3822
3834
  const subId = getQuickPickSubProviderId(providerId, prefix);
3823
3835
  const quickInput = isQuickInput(args);
3824
- const newPicks = isStaticQuickInput(args) || subId === LanguageMode$1 ? state.picks : await getPicks(subId, newValue, args, {
3836
+ const reuseFilePicks = !state.initial && canReuseFilePicks(providerId, value, newValue, state.picks.length);
3837
+ const newPicks = isStaticQuickInput(args) || subId === LanguageMode$1 || reuseFilePicks ? state.picks : await getPicks(subId, newValue, args, {
3825
3838
  applicationId: state.applicationId,
3826
3839
  assetDir,
3827
3840
  platform
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/quick-pick-worker",
3
- "version": "4.26.0",
3
+ "version": "4.28.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/lvce-editor/quick-pick-worker.git"