@lvce-editor/text-search-worker 5.7.0 → 5.9.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.
@@ -1143,6 +1143,9 @@ const createMockRpc = ({
1143
1143
  const invoke = (method, ...params) => {
1144
1144
  invocations.push([method, ...params]);
1145
1145
  const command = commandMap[method];
1146
+ if (!command) {
1147
+ throw new Error(`command ${method} not found`);
1148
+ }
1146
1149
  return command(...params);
1147
1150
  };
1148
1151
  const mockRpc = {
@@ -1271,8 +1274,30 @@ const clearSearchResults$1 = state => {
1271
1274
  };
1272
1275
  };
1273
1276
 
1277
+ const File$1 = 1;
1278
+ const Match = 2;
1279
+
1280
+ const getPaths = items => {
1281
+ const paths = [];
1282
+ for (const item of items) {
1283
+ if (item.type === File$1) {
1284
+ paths.push(item.text);
1285
+ }
1286
+ }
1287
+ return paths;
1288
+ };
1274
1289
  const collapseAll$1 = async state => {
1275
- return state;
1290
+ const {
1291
+ items
1292
+ } = state;
1293
+ if (items.length === 0) {
1294
+ return state;
1295
+ }
1296
+ const paths = getPaths(items);
1297
+ return {
1298
+ ...state,
1299
+ collapsedPaths: paths
1300
+ };
1276
1301
  };
1277
1302
 
1278
1303
  const PreserveCase$2 = 1 << 0; // 1
@@ -1299,6 +1324,16 @@ const collapseDetails = state => {
1299
1324
  };
1300
1325
  };
1301
1326
 
1327
+ const Alert = 'alert';
1328
+ const Button$3 = 'button';
1329
+ const CheckBox = 'checkbox';
1330
+ const None$1 = 'none';
1331
+ const ScrollBar$1 = 'scrollbar';
1332
+ const Status = 'status';
1333
+ const ToolBar = 'toolbar';
1334
+ const Tree$1 = 'tree';
1335
+ const TreeItem$1 = 'treeitem';
1336
+
1302
1337
  const Actions = 'Actions';
1303
1338
  const Badge = 'Badge';
1304
1339
  const Chevron = 'Chevron';
@@ -1325,7 +1360,7 @@ const MaskIconRegex = 'MaskIconRegex';
1325
1360
  const MaskIconReplaceAll = 'MaskIconReplaceAll';
1326
1361
  const MaskIconWholeWord = 'MaskIconWholeWord';
1327
1362
  const MultilineInputBox = 'MultilineInputBox';
1328
- const ScrollBar$1 = 'ScrollBar';
1363
+ const ScrollBar = 'ScrollBar';
1329
1364
  const ScrollBarThumb = 'ScrollBarThumb';
1330
1365
  const ScrollBarVertical = 'ScrollBarVertical';
1331
1366
  const Search$2 = 'Search';
@@ -1349,14 +1384,16 @@ const SearchToggleButton = 'SearchToggleButton';
1349
1384
  const SearchToggleButtonExpanded = 'SearchToggleButtonExpanded';
1350
1385
  const SourceControlBadge = 'SourceControlBadge';
1351
1386
  const ToggleDetails = 'ToggleDetails';
1352
- const Tree$1 = 'Tree';
1353
- const TreeItem$1 = 'TreeItem';
1387
+ const Tree = 'Tree';
1388
+ const TreeItem = 'TreeItem';
1354
1389
  const TreeItemActive = 'TreeItemActive';
1355
1390
  const TreeItems$1 = 'TreeItems';
1356
1391
  const Viewlet = 'Viewlet';
1357
1392
  const ViewletSearchMessage = 'ViewletSearchMessage';
1358
1393
  const ViewletSearchMessageIndented = 'ViewletSearchMessageIndented';
1359
1394
 
1395
+ const File = 7;
1396
+
1360
1397
  const Button$2 = 1;
1361
1398
  const Div = 4;
1362
1399
  const Span = 8;
@@ -1367,6 +1404,19 @@ const Del = 21;
1367
1404
  const H4 = 24;
1368
1405
  const TextArea = 62;
1369
1406
 
1407
+ const Button$1 = 'event.button';
1408
+ const ClientX = 'event.clientX';
1409
+ const ClientY = 'event.clientY';
1410
+ const DeltaMode = 'event.deltaMode';
1411
+ const DeltaY = 'event.deltaY';
1412
+ const TargetName = 'event.target.name';
1413
+ const TargetValue = 'event.target.value';
1414
+
1415
+ const Search$1 = 18;
1416
+
1417
+ const Electron = 2;
1418
+ const Remote = 3;
1419
+
1370
1420
  const DebugWorker = 55;
1371
1421
  const RendererWorker$1 = 1;
1372
1422
  const SearchProcess = 77;
@@ -1465,6 +1515,11 @@ const sendMessagePortToMarkdownWorker = async (port, rpcId) => {
1465
1515
  // @ts-ignore
1466
1516
  await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToMarkdownWorker', port, command, rpcId);
1467
1517
  };
1518
+ const sendMessagePortToIconThemeWorker = async (port, rpcId) => {
1519
+ const command = 'IconTheme.handleMessagePort';
1520
+ // @ts-ignore
1521
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToIconThemeWorker', port, command, rpcId);
1522
+ };
1468
1523
  const sendMessagePortToFileSystemWorker = async (port, rpcId) => {
1469
1524
  const command = 'FileSystem.handleMessagePort';
1470
1525
  // @ts-ignore
@@ -1483,7 +1538,7 @@ const setWebViewPort = async (uid, port, origin, portType) => {
1483
1538
  const setFocus = key => {
1484
1539
  return invoke$2('Focus.setFocus', key);
1485
1540
  };
1486
- const getFileIcon$2 = async options => {
1541
+ const getFileIcon = async options => {
1487
1542
  return invoke$2('IconTheme.getFileIcon', options);
1488
1543
  };
1489
1544
  const getColorThemeNames = async () => {
@@ -1548,7 +1603,7 @@ const handleDebugResumed = async params => {
1548
1603
  const openWidget = async name => {
1549
1604
  await invoke$2('Viewlet.openWidget', name);
1550
1605
  };
1551
- const getIcons = async requests => {
1606
+ const getIcons$1 = async requests => {
1552
1607
  const icons = await invoke$2('IconTheme.getIcons', requests);
1553
1608
  return icons;
1554
1609
  };
@@ -1691,11 +1746,11 @@ const RendererWorker = {
1691
1746
  getExtension,
1692
1747
  getExtensionCommands,
1693
1748
  getFileHandles,
1694
- getFileIcon: getFileIcon$2,
1749
+ getFileIcon,
1695
1750
  getFilePathElectron,
1696
1751
  getFolderIcon,
1697
1752
  getFolderSize,
1698
- getIcons,
1753
+ getIcons: getIcons$1,
1699
1754
  getKeyBindings: getKeyBindings$1,
1700
1755
  getLogsDir,
1701
1756
  getMarkdownDom,
@@ -1731,6 +1786,7 @@ const RendererWorker = {
1731
1786
  sendMessagePortToErrorWorker,
1732
1787
  sendMessagePortToExtensionHostWorker,
1733
1788
  sendMessagePortToFileSystemWorker,
1789
+ sendMessagePortToIconThemeWorker,
1734
1790
  sendMessagePortToMarkdownWorker,
1735
1791
  sendMessagePortToRendererProcess,
1736
1792
  sendMessagePortToSearchProcess: sendMessagePortToSearchProcess$1,
@@ -1778,24 +1834,37 @@ const createLazyRpc = rpcId => {
1778
1834
  };
1779
1835
 
1780
1836
  const {
1781
- getFileIcon: getFileIcon$1,
1782
1837
  invoke: invoke$1,
1783
1838
  openUri: openUri$1,
1784
1839
  sendMessagePortToSearchProcess,
1785
1840
  set: set$1,
1786
1841
  showContextMenu,
1787
- writeClipBoardText
1842
+ writeClipBoardText,
1843
+ getIcons
1788
1844
  } = RendererWorker;
1789
1845
 
1790
1846
  const copy = async state => {
1791
1847
  const {
1792
1848
  items,
1793
- listFocusedIndex
1849
+ focusedIndex
1794
1850
  } = state;
1795
- if (listFocusedIndex === -1) {
1851
+ if (focusedIndex === -1) {
1852
+ return state;
1853
+ }
1854
+ const item = items[focusedIndex];
1855
+ await writeClipBoardText(item.text);
1856
+ return state;
1857
+ };
1858
+
1859
+ const copyPath = async state => {
1860
+ const {
1861
+ items,
1862
+ focusedIndex
1863
+ } = state;
1864
+ if (focusedIndex === -1) {
1796
1865
  return state;
1797
1866
  }
1798
- const item = items[listFocusedIndex];
1867
+ const item = items[focusedIndex];
1799
1868
  await writeClipBoardText(item.text);
1800
1869
  return state;
1801
1870
  };
@@ -1805,7 +1874,9 @@ const minimumSliderSize = 20;
1805
1874
  const {
1806
1875
  get: get$1,
1807
1876
  set,
1808
- wrapCommand
1877
+ wrapCommand,
1878
+ registerCommands,
1879
+ getCommandIds
1809
1880
  } = create$3();
1810
1881
 
1811
1882
  const List = 1;
@@ -1881,7 +1952,10 @@ const create = (uid, x, y, width, height, workspacePath, assetDir, itemHeight, v
1881
1952
  incrementalSearch: false,
1882
1953
  searchId: '',
1883
1954
  useChevrons: true,
1884
- useFileIcons: true
1955
+ useFileIcons: true,
1956
+ limitHit: false,
1957
+ limitHitWarning: '',
1958
+ limit: 20_000
1885
1959
  };
1886
1960
  set(uid, state, state);
1887
1961
  return state;
@@ -1996,7 +2070,7 @@ const ReplaceAll$1 = 'Replace All';
1996
2070
  const ReplacedManyOccurrencesInManyFiles = "Replaced {PH1} occurrences across {PH2} files with '{PH3}'";
1997
2071
  const ReplacedOneOccurrenceInOneFile = "Replaced 1 occurrence across 1 file with '{PH1}'";
1998
2072
  const ReplaceForHistory = 'Replace (⇅ for history)';
1999
- const Search$1 = 'Search';
2073
+ const Search = 'Search';
2000
2074
  const SearchForHistory = 'Search (⇅ for history)';
2001
2075
  const SearchOnlyOpenEditors$1 = 'Search Only Open Editors';
2002
2076
  const ToggleReplace$1 = 'Toggle Replace';
@@ -2004,6 +2078,7 @@ const ToggleSearchDetails$1 = 'Toggle Search Details';
2004
2078
  const UseExcludeSettings$1 = 'Use Exclude Settings';
2005
2079
  const UseRegularExpression$1 = 'Use Regular Expression';
2006
2080
  const ViewAsTree = 'View as Tree';
2081
+ const TheResultSetOnlyContainsASubSetOfMatches = 'The result set only contains a subset of all matches. Be more specific in your search to narrow down the results.';
2007
2082
 
2008
2083
  const noResults = () => {
2009
2084
  return i18nString(NoResults);
@@ -2096,6 +2171,9 @@ const replaceAll$1 = () => {
2096
2171
  const replace = () => {
2097
2172
  return i18nString(Replace);
2098
2173
  };
2174
+ const theResultSetOnlyContainsASubSetOfMatches = () => {
2175
+ return i18nString(TheResultSetOnlyContainsASubSetOfMatches);
2176
+ };
2099
2177
  const refresh$1 = () => {
2100
2178
  return i18nString(Refresh$1);
2101
2179
  };
@@ -2133,7 +2211,7 @@ const searchForHistory = () => {
2133
2211
  return i18nString(SearchForHistory);
2134
2212
  };
2135
2213
  const search = () => {
2136
- return i18nString(Search$1);
2214
+ return i18nString(Search);
2137
2215
  };
2138
2216
  const replaceForHistory = () => {
2139
2217
  return i18nString(ReplaceForHistory);
@@ -2152,13 +2230,10 @@ const getStatusMessage = (resultCount, fileResultCount) => {
2152
2230
  return manyResultsInManyFiles(resultCount, fileResultCount);
2153
2231
  };
2154
2232
 
2155
- const File = 1;
2156
- const Match = 2;
2157
-
2158
2233
  const getSetSize = (items, index) => {
2159
2234
  let setSize = 0;
2160
2235
  for (let i = index + 1; i < items.length; i++) {
2161
- if (items[i].type === File) {
2236
+ if (items[i].type === File$1) {
2162
2237
  break;
2163
2238
  }
2164
2239
  setSize++;
@@ -2177,7 +2252,7 @@ const getRemoveIndicesFile = (items, item, index, matchCount, fileCount) => {
2177
2252
  };
2178
2253
  const getRemoveIndicesMatch = (items, index, matchCount, fileCount) => {
2179
2254
  for (let i = index; i >= 0; i--) {
2180
- if (items[i].type === File) {
2255
+ if (items[i].type === File$1) {
2181
2256
  const setSize = getSetSize(items, i);
2182
2257
  if (setSize === 1) {
2183
2258
  return {
@@ -2202,7 +2277,7 @@ const getRemoveIndicesMatch = (items, index, matchCount, fileCount) => {
2202
2277
  const getRemoveIndices = (items, index, matchCount, fileCount) => {
2203
2278
  const item = items[index];
2204
2279
  switch (item.type) {
2205
- case File:
2280
+ case File$1:
2206
2281
  return getRemoveIndicesFile(items, item, index, matchCount, fileCount);
2207
2282
  case Match:
2208
2283
  return getRemoveIndicesMatch(items, index, matchCount, fileCount);
@@ -2415,12 +2490,6 @@ const focusSearchValueNext = state => {
2415
2490
  return focusMatchCase$1(state);
2416
2491
  };
2417
2492
 
2418
- const commandIds = ['clearSearchResults', 'collapseAll', 'collapseDetails', 'copy', 'dismissItem', 'dispose', 'expandDetails', 'focusFirst', 'focusIndex', 'focusLast', 'focusMatchCase', 'focusMatchCasePrevious', 'focusMatchWholeWord', 'focusNext', 'focusNextInput', 'focusNextPage', 'focusPreserveCasePrevious', 'focusPrevious', 'focusPreviousInput', 'focusPreviousPage', 'focusRegex', 'focusRegexNext', 'focusReplaceAll', 'focusReplaceValue', 'focusReplaceValueNext', 'focusReplaceValuePrevious', 'focusSearchValue', 'focusSearchValueNext', 'handleClick', 'handleClickAt', 'handleContextMenu', 'handleContextMenuKeyboard', 'handleContextMenuMouseAt', 'handleExcludeInput', 'handleFocusIn', 'handleHeaderClick', 'handleHeaderContextMenu', 'handleHeaderFocusIn', 'handleHeaderFocusOut', 'handleIconThemeChange', 'handleIconThemeChange', 'handleIncludeInput', 'handleInput', 'handleInput2', 'handleListBlur', 'handleListFocus', 'handleReplaceInput', 'handleScrollBarCaptureLost', 'handleScrollBarClick', 'handleScrollBarMove', 'handleScrollBarThumbPointerMove', 'handleTouchEnd', 'handleTouchMove', 'handleTouchStart', 'handleUpdate', 'handleWheel', 'nextHistoryResult', 'previousHistoryResult', 'refresh', 'replaceAll', 'rerender', 'scrollDown', 'selectIndex', 'submit', 'toggleMatchCase', 'toggleMatchWholeWord', 'togglePreserveCase', 'toggleReplace', 'toggleSearchDetails', 'toggleUseRegularExpression', 'viewAsTree'];
2419
-
2420
- const getCommandIds = () => {
2421
- return commandIds;
2422
- };
2423
-
2424
2493
  const Tab = 2;
2425
2494
  const Enter = 3;
2426
2495
  const End = 255;
@@ -2538,18 +2607,26 @@ const handleUpdateError = async (state, update, error) => {
2538
2607
  };
2539
2608
  };
2540
2609
 
2541
- const getFileIcon = async result => {
2542
- if (result.type === File) {
2543
- return getFileIcon$1({
2544
- name: result.text
2545
- });
2610
+ const getFileName$1 = text => {
2611
+ if (text.startsWith('./')) {
2612
+ return text.slice(2);
2546
2613
  }
2547
- return '';
2614
+ return text;
2548
2615
  };
2549
2616
  const getFileIcons = async matches => {
2617
+ const requests = [];
2618
+ for (const item of matches) {
2619
+ if (item.type === File$1) {
2620
+ const fileName = getFileName$1(item.text);
2621
+ requests.push({
2622
+ type: File,
2623
+ name: fileName,
2624
+ path: `/${fileName}`
2625
+ });
2626
+ }
2627
+ }
2628
+ const icons = await getIcons(requests);
2550
2629
  // TODO cache file icons
2551
- const promises = matches.map(getFileIcon);
2552
- const icons = await Promise.all(promises);
2553
2630
  return icons;
2554
2631
  };
2555
2632
 
@@ -2574,7 +2651,7 @@ const getTextSearchResultCounts = results => {
2574
2651
  let fileCount = 0;
2575
2652
  for (const result of results) {
2576
2653
  switch (result.type) {
2577
- case File:
2654
+ case File$1:
2578
2655
  fileCount++;
2579
2656
  break;
2580
2657
  case Match:
@@ -2637,11 +2714,15 @@ const handleUpdateFull = async (state, update) => {
2637
2714
  includeValue,
2638
2715
  excludeValue,
2639
2716
  assetDir,
2640
- platform
2717
+ platform,
2718
+ limit
2641
2719
  } = partialNewState;
2642
2720
  const root = state.workspacePath;
2643
2721
  const scheme = getProtocol(root);
2644
- const results = await textSearch$6(root, value, {
2722
+ const {
2723
+ results,
2724
+ limitHit
2725
+ } = await textSearch$6(root, value, {
2645
2726
  threads,
2646
2727
  isCaseSensitive: Boolean(flags & MatchCase$2),
2647
2728
  useRegularExpression: Boolean(flags & UseRegularExpression$2),
@@ -2652,7 +2733,8 @@ const handleUpdateFull = async (state, update) => {
2652
2733
  query: value,
2653
2734
  scheme,
2654
2735
  flags,
2655
- matchWholeWord: Boolean(flags & MatchWholeWord$2)
2736
+ matchWholeWord: Boolean(flags & MatchWholeWord$2),
2737
+ limit
2656
2738
  }, assetDir, platform);
2657
2739
  if (!Array.isArray(results)) {
2658
2740
  throw new TypeError('results must be of type array');
@@ -2671,23 +2753,29 @@ const handleUpdateFull = async (state, update) => {
2671
2753
  const finalDeltaY = Math.max(contentHeight - listHeight, 0);
2672
2754
  const visible = results.slice(0, maxLineY);
2673
2755
  const icons = await getFileIcons(visible);
2756
+
2757
+ // TODO add info message if limit was hit
2758
+
2759
+ const limitHitWarning = limitHit ? theResultSetOnlyContainsASubSetOfMatches() : '';
2674
2760
  return {
2675
2761
  ...partialNewState,
2676
- minLineY: 0,
2677
2762
  deltaY: 0,
2678
- value,
2763
+ fileCount,
2764
+ finalDeltaY,
2765
+ icons,
2679
2766
  items: results,
2767
+ limitHit,
2768
+ limitHitWarning,
2680
2769
  listItems: results,
2681
- message,
2770
+ loaded: true,
2771
+ matchCount: resultCount,
2682
2772
  maxLineY: maxLineY,
2773
+ message,
2774
+ minLineY: 0,
2683
2775
  scrollBarHeight,
2684
- finalDeltaY,
2776
+ searchInputErrorMessage: '',
2685
2777
  threads,
2686
- fileCount,
2687
- matchCount: resultCount,
2688
- loaded: true,
2689
- icons,
2690
- searchInputErrorMessage: ''
2778
+ value
2691
2779
  };
2692
2780
  };
2693
2781
 
@@ -2786,6 +2874,7 @@ const handleUpdateIncremental = async (state, update) => {
2786
2874
  threads,
2787
2875
  includeValue,
2788
2876
  excludeValue,
2877
+ limit,
2789
2878
  uid,
2790
2879
  assetDir,
2791
2880
  platform
@@ -2813,7 +2902,8 @@ const handleUpdateIncremental = async (state, update) => {
2813
2902
  query: value,
2814
2903
  scheme,
2815
2904
  flags,
2816
- matchWholeWord: Boolean(flags & MatchWholeWord$2)
2905
+ matchWholeWord: Boolean(flags & MatchWholeWord$2),
2906
+ limit
2817
2907
  }, assetDir, platform, searchId, uid);
2818
2908
  return state;
2819
2909
  };
@@ -2948,7 +3038,7 @@ const getReplaceElements = (items, workspacePath, replacement) => {
2948
3038
  end,
2949
3039
  start
2950
3040
  } = match;
2951
- if (type === File) {
3041
+ if (type === File$1) {
2952
3042
  changes = [];
2953
3043
  const fileName = getFileName(text);
2954
3044
  const absolutePath = `${workspacePath}/${fileName}`;
@@ -2978,6 +3068,7 @@ const replaceAll = async state => {
2978
3068
  matchCount
2979
3069
  } = state;
2980
3070
  const bulkEdits = getReplaceElements(items, workspacePath, replacement);
3071
+ // TODO this function should return an error message if an error occurred during bulk edit
2981
3072
  await applyBulkReplacement(bulkEdits);
2982
3073
  const fileCount = bulkEdits.length;
2983
3074
  const message = getReplacedMessage(fileCount, matchCount, replacement);
@@ -3141,7 +3232,10 @@ const handleInput2 = (state, inputName, value, inputSource = Script) => {
3141
3232
  };
3142
3233
 
3143
3234
  const handleListBlur = state => {
3144
- return state;
3235
+ return {
3236
+ ...state,
3237
+ listFocused: false
3238
+ };
3145
3239
  };
3146
3240
 
3147
3241
  const handleSharedInput = (state, name, value, inputSource = Script) => {
@@ -3166,9 +3260,6 @@ const launchSearchProcessNode = async () => {
3166
3260
  return rpc;
3167
3261
  };
3168
3262
 
3169
- const Electron = 2;
3170
- const Remote = 3;
3171
-
3172
3263
  const initialize = async platform => {
3173
3264
  if (platform === Electron) {
3174
3265
  setFactory(launchSearchProcessElectron);
@@ -3503,7 +3594,7 @@ const getFilteredResults = (results, collapsedPaths) => {
3503
3594
  const filteredResults = [];
3504
3595
  let isExcluded = false;
3505
3596
  for (const result of results) {
3506
- if (result.type === File) {
3597
+ if (result.type === File$1) {
3507
3598
  filteredResults.push(result);
3508
3599
  isExcluded = collapsedPaths.includes(result.text) ? true : false;
3509
3600
  }
@@ -3554,7 +3645,7 @@ const selectIndexFile = async (state, searchResult, index) => {
3554
3645
  const getFileIndex = (items, index) => {
3555
3646
  for (let i = index; i >= 0; i--) {
3556
3647
  const item = items[i];
3557
- if (item.type === File) {
3648
+ if (item.type === File$1) {
3558
3649
  return i;
3559
3650
  }
3560
3651
  }
@@ -3605,7 +3696,7 @@ const selectIndexPreview = async (state, searchResult, index) => {
3605
3696
 
3606
3697
  const getSelectHandler = type => {
3607
3698
  switch (type) {
3608
- case File:
3699
+ case File$1:
3609
3700
  return selectIndexFile;
3610
3701
  case Match:
3611
3702
  return selectIndexPreview;
@@ -3684,12 +3775,18 @@ const getSavedExcludeValue = savedState => {
3684
3775
  }
3685
3776
  return '';
3686
3777
  };
3778
+ const getSavedCollapsedPaths = savedState => {
3779
+ if (savedState && typeof savedState === 'object' && 'collapsedPaths' in savedState && Array.isArray(savedState.collapsedPaths) && savedState.collapsedPaths.every(item => typeof item === 'string')) {
3780
+ return savedState.collapsedPaths;
3781
+ }
3782
+ return [];
3783
+ };
3687
3784
 
3688
3785
  const restoreState = savedState => {
3689
3786
  return {
3690
3787
  savedValue: getSavedValue(savedState),
3691
3788
  replacement: getSavedReplacement(savedState),
3692
- savedCollapsedPaths: [],
3789
+ savedCollapsedPaths: getSavedCollapsedPaths(savedState),
3693
3790
  threads: 1,
3694
3791
  flags: getSavedFlags(savedState),
3695
3792
  includeValue: getSavedIncludeValue(savedState),
@@ -3709,7 +3806,7 @@ const loadContent = async (state, savedState) => {
3709
3806
  excludeValue
3710
3807
  } = restoreState(savedState);
3711
3808
  if (savedValue) {
3712
- return handleUpdate(state, {
3809
+ const result = await handleUpdate(state, {
3713
3810
  value: savedValue,
3714
3811
  threads,
3715
3812
  inputSource: Script,
@@ -3719,6 +3816,10 @@ const loadContent = async (state, savedState) => {
3719
3816
  includeValue,
3720
3817
  excludeValue
3721
3818
  });
3819
+ return {
3820
+ ...result,
3821
+ loaded: true
3822
+ };
3722
3823
  }
3723
3824
  return {
3724
3825
  ...state,
@@ -3814,14 +3915,14 @@ const renderFocusContext = (oldState, newState) => {
3814
3915
  return ['Viewlet.setFocusContext', newState.focus];
3815
3916
  };
3816
3917
 
3817
- const None$1 = 0;
3918
+ const None = 0;
3818
3919
  const Collapsed = 1;
3819
3920
  const Expanded = 2;
3820
3921
 
3821
3922
  const getMatchCount = (results, startIndex) => {
3822
3923
  for (let i = startIndex + 1; i < results.length; i++) {
3823
3924
  const result = results[i];
3824
- if (result.type === File) {
3925
+ if (result.type === File$1) {
3825
3926
  return i - startIndex - 1;
3826
3927
  }
3827
3928
  }
@@ -3856,7 +3957,7 @@ const getDisplayResultMatch = (setSize, searchTermLength, replacement, text, pos
3856
3957
  return {
3857
3958
  badgeText: '',
3858
3959
  depth: 1,
3859
- expanded: None$1,
3960
+ expanded: None,
3860
3961
  focused,
3861
3962
  icon: '',
3862
3963
  matchLength: searchTermLength,
@@ -3880,7 +3981,7 @@ const getDisplayResult = (results, fileIcons, i, setSize, searchTermLength, repl
3880
3981
  const focused = i === focusedIndex;
3881
3982
  const relativeIndex = i - minLineY;
3882
3983
  switch (type) {
3883
- case File:
3984
+ case File$1:
3884
3985
  return getSearchDisplayResultFile(results, fileIcons, i, setSize, collapsedPaths, text, posInSet, relativeIndex, focused, originalResults);
3885
3986
  case Match:
3886
3987
  return getDisplayResultMatch(setSize, searchTermLength, replacement, text, posInSet, start, focused);
@@ -3901,6 +4002,8 @@ const getDisplayResults = (results, itemHeight, resultCount, searchTerm, minLine
3901
4002
  };
3902
4003
 
3903
4004
  const createViewModel = state => {
4005
+ // TODO add viewmodel to state, not needing to have separate states and making it easier to compare
4006
+ // visible items in diff
3904
4007
  const {
3905
4008
  listItems,
3906
4009
  itemHeight,
@@ -4172,38 +4275,28 @@ const diff = (oldNodes, newNodes) => {
4172
4275
  return patches;
4173
4276
  };
4174
4277
 
4175
- const Alert = 'alert';
4176
- const Button$1 = 'button';
4177
- const CheckBox = 'checkbox';
4178
- const None = 'none';
4179
- const ScrollBar = 'scrollbar';
4180
- const Status = 'status';
4181
- const ToolBar = 'toolbar';
4182
- const Tree = 'tree';
4183
- const TreeItem = 'treeitem';
4184
-
4185
- const HandleClick = 'handleClick';
4186
- const HandleContextMenu = 'handleContextMenu';
4187
- const HandleHeaderContextMenu = 'handleHeaderContextMenu';
4188
- const HandleExcludeInput = 'handleExcludeInput';
4189
- const HandleHeaderClick2 = 'handleHeaderClick2';
4190
- const HandleHeaderFocusIn = 'handleHeaderFocusIn';
4191
- const HandleHeaderFocusOut = 'handleHeaderFocusOut';
4192
- const HandleIncludeInput = 'handleIncludeInput';
4193
- const HandleInput = 'handleInput';
4194
- const HandleInput2 = 'handleInput2';
4195
- const HandleListBlur = 'handleListBlur';
4196
- const HandleListFocus = 'handleListFocus';
4197
- const HandleReplaceInput = 'handleReplaceInput';
4198
- const HandleScrollBarPointerDown = 'handleScrollBarPointerDown';
4199
- const HandleToggleButtonClick = 'handleToggleButtonClick';
4200
- const HandleWheel = 'handleWheel';
4278
+ const HandleClick = 1;
4279
+ const HandleContextMenu = 2;
4280
+ const HandleHeaderContextMenu = 3;
4281
+ const HandleExcludeInput = 4;
4282
+ const HandleHeaderClick2 = 5;
4283
+ const HandleHeaderFocusIn = 6;
4284
+ const HandleHeaderFocusOut = 7;
4285
+ const HandleIncludeInput = 8;
4286
+ const HandleInput = 9;
4287
+ const HandleInput2 = 10;
4288
+ const HandleListBlur = 11;
4289
+ const HandleListFocus = 12;
4290
+ const HandleReplaceInput = 13;
4291
+ const HandleScrollBarPointerDown = 14;
4292
+ const HandleToggleButtonClick = 15;
4293
+ const HandleWheel = 16;
4201
4294
 
4202
4295
  const getSearchDetailsToggleVirtualDom = () => {
4203
4296
  return [{
4204
4297
  type: Div,
4205
4298
  className: ToggleDetails,
4206
- role: Button$1,
4299
+ role: Button$3,
4207
4300
  tabIndex: 0,
4208
4301
  ariaLabel: toggleSearchDetails(),
4209
4302
  title: toggleSearchDetails(),
@@ -4347,7 +4440,7 @@ const getOutSideButtonsDom = outsideButtons => {
4347
4440
  preNodes: [{
4348
4441
  type: Div,
4349
4442
  className: SearchFieldContainer,
4350
- role: None,
4443
+ role: None$1,
4351
4444
  childCount: 1 + outsideButtons.length
4352
4445
  }],
4353
4446
  postNodes: outsideButtons.flatMap(getSearchFieldButtonVirtualDom)
@@ -4363,7 +4456,7 @@ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, out
4363
4456
  const dom = [...preNodes, {
4364
4457
  type: Div,
4365
4458
  className: searchFieldClassName,
4366
- role: None,
4459
+ role: None$1,
4367
4460
  childCount: 2
4368
4461
  }, {
4369
4462
  type: TextArea,
@@ -4415,6 +4508,26 @@ const getSearchHeaderDetailsVirtualDom = (flags, message) => {
4415
4508
  return getSearchHeaderDetailsCollapsedVirtualDom(message);
4416
4509
  };
4417
4510
 
4511
+ const SearchWarningMessage = 'SearchWarningMessage';
4512
+
4513
+ const getSearchHeaderLimitHitVirtualDom = limitHitWarning => {
4514
+ if (!limitHitWarning) {
4515
+ // TODO remove unused dom node
4516
+ return [{
4517
+ type: Div,
4518
+ childCount: 0
4519
+ }];
4520
+ }
4521
+ const dom = [{
4522
+ type: Div,
4523
+ className: SearchWarningMessage,
4524
+ childCount: 1
4525
+ },
4526
+ // TODO warning triangle here
4527
+ text(limitHitWarning)];
4528
+ return dom;
4529
+ };
4530
+
4418
4531
  const getInputActionsInput = flags => {
4419
4532
  const inside = [{
4420
4533
  icon: MaskIconCaseSensitive,
@@ -4498,12 +4611,12 @@ const getSearchHeaderTopVirtualDom = (flags, searchInputErrorMessage, matchCount
4498
4611
  const dom = [{
4499
4612
  type: Div,
4500
4613
  className: SearchHeaderTop,
4501
- role: None,
4614
+ role: None$1,
4502
4615
  childCount: 2
4503
4616
  }, ...getSearchToggleVirtualDom(replaceExpanded), {
4504
4617
  type: Div,
4505
4618
  className: SearchHeaderTopRight,
4506
- role: None,
4619
+ role: None$1,
4507
4620
  childCount: replaceExpanded ? 2 : 1
4508
4621
  }, ...getSearchFieldVirtualDom(SearchValue, searchPlaceholder, HandleInput2, inputActions.inside, inputActions.outside, '', Boolean(searchInputErrorMessage))];
4509
4622
  if (flags & ReplaceExpanded) {
@@ -4515,15 +4628,15 @@ const getSearchHeaderTopVirtualDom = (flags, searchInputErrorMessage, matchCount
4515
4628
  const parentNode = {
4516
4629
  type: Div,
4517
4630
  className: SearchHeader,
4518
- role: None,
4519
- childCount: 2,
4631
+ role: None$1,
4632
+ childCount: 3,
4520
4633
  onClick: HandleHeaderClick2,
4521
4634
  onFocusIn: HandleHeaderFocusIn,
4522
4635
  onFocusOut: HandleHeaderFocusOut,
4523
4636
  onContextMenu: HandleHeaderContextMenu
4524
4637
  };
4525
- const getSearchHeaderVirtualDom = (flags, message, searchInputErrorMessage, matchCount, focus) => {
4526
- const dom = [parentNode, ...getSearchHeaderTopVirtualDom(flags, searchInputErrorMessage, matchCount, focus), ...getSearchHeaderDetailsVirtualDom(flags, message)];
4638
+ const getSearchHeaderVirtualDom = (flags, message, searchInputErrorMessage, matchCount, focus, limitHitWarning) => {
4639
+ const dom = [parentNode, ...getSearchHeaderTopVirtualDom(flags, searchInputErrorMessage, matchCount, focus), ...getSearchHeaderDetailsVirtualDom(flags, message), ...getSearchHeaderLimitHitVirtualDom(limitHitWarning)];
4527
4640
  return dom;
4528
4641
  };
4529
4642
 
@@ -4547,10 +4660,10 @@ const getScrollBarVirtualDom = (scrollBarHeight, scrollBarY, scrollBarValue) =>
4547
4660
  }
4548
4661
  return [{
4549
4662
  type: Div,
4550
- className: mergeClassNames(ScrollBar$1, ScrollBarVertical),
4663
+ className: mergeClassNames(ScrollBar, ScrollBarVertical),
4551
4664
  childCount: 1,
4552
4665
  onPointerDown: HandleScrollBarPointerDown,
4553
- role: ScrollBar,
4666
+ role: ScrollBar$1,
4554
4667
  ariaControls: TreeItems,
4555
4668
  ariaValueNow: scrollBarValue
4556
4669
  }, {
@@ -4614,7 +4727,7 @@ const getFileIconVirtualDom = icon => {
4614
4727
  type: Img,
4615
4728
  className: FileIcon,
4616
4729
  src: icon,
4617
- role: None,
4730
+ role: None$1,
4618
4731
  childCount: 0
4619
4732
  };
4620
4733
  };
@@ -4703,9 +4816,9 @@ const getSearchRemoveVirtualDom = () => {
4703
4816
 
4704
4817
  const getSearchResultClassName = focused => {
4705
4818
  if (focused) {
4706
- return TreeItem$1 + ' ' + TreeItemActive;
4819
+ return TreeItem + ' ' + TreeItemActive;
4707
4820
  }
4708
- return TreeItem$1;
4821
+ return TreeItem;
4709
4822
  };
4710
4823
 
4711
4824
  const PaddingRight = '12px';
@@ -4728,7 +4841,7 @@ const getSearchResultVirtualDom = rowInfo => {
4728
4841
  const childCount = getChildCount(icon, expanded, badgeText);
4729
4842
  const dom = [{
4730
4843
  type: Div,
4731
- role: TreeItem,
4844
+ role: TreeItem$1,
4732
4845
  className: getSearchResultClassName(focused),
4733
4846
  title,
4734
4847
  ariaSetSize: setSize,
@@ -4763,26 +4876,26 @@ const getSearchResultsVirtualDom = (visibleItems, focusOutline, scrollbarHeight,
4763
4876
  const childCount = scrollbarHeight === 0 ? 1 : 2;
4764
4877
  return [{
4765
4878
  type: Div,
4766
- className: mergeClassNames(Viewlet, List$1, Tree$1, focusOutline ? FocusOutline : Empty),
4767
- role: Tree,
4879
+ className: mergeClassNames(Viewlet, List$1, Tree, focusOutline ? FocusOutline : Empty),
4880
+ role: Tree$1,
4768
4881
  tabIndex: 0,
4769
4882
  childCount
4770
4883
  }, ...getTreeItemsVirtualDom(visibleItems, deltaY, itemHeight), ...getScrollBarVirtualDom(scrollbarHeight, scrollBarY, scrollBarValue)];
4771
4884
  };
4772
4885
 
4773
- const getSearchVirtualDom = (visibleItems, flags, message, focusOutline, searchInputErrorMessage, scrollBarHeight, scrollBarY, scrollBarValue, deltaY, itemHeight, matchCount, focus = 0) => {
4886
+ const getSearchVirtualDom = (visibleItems, flags, message, focusOutline, searchInputErrorMessage, scrollBarHeight, scrollBarY, scrollBarValue, deltaY, itemHeight, matchCount, limitHitWarning, focus = 0) => {
4774
4887
  const errorDom = getSearchInputErrorVirtualDom(searchInputErrorMessage);
4775
4888
  const childCount = 2 + (errorDom.length > 0 ? 1 : 0);
4776
4889
  return [{
4777
4890
  type: Div,
4778
4891
  className: mergeClassNames(Viewlet, Search$2),
4779
4892
  childCount
4780
- }, ...getSearchHeaderVirtualDom(flags, message, searchInputErrorMessage, matchCount, focus), ...errorDom, ...getSearchResultsVirtualDom(visibleItems, focusOutline, scrollBarHeight, scrollBarY, scrollBarValue, deltaY, itemHeight)];
4893
+ }, ...getSearchHeaderVirtualDom(flags, message, searchInputErrorMessage, matchCount, focus, limitHitWarning), ...errorDom, ...getSearchResultsVirtualDom(visibleItems, focusOutline, scrollBarHeight, scrollBarY, scrollBarValue, deltaY, itemHeight)];
4781
4894
  };
4782
4895
 
4783
4896
  const renderItems = (oldState, newState) => {
4784
4897
  const viewModel = createViewModel(newState);
4785
- const dom = getSearchVirtualDom(viewModel.displayResults, viewModel.flags, viewModel.message, viewModel.focusOutline, viewModel.searchInputErrorMessage, viewModel.scrollBarHeight, viewModel.scrollBarY, viewModel.scrollBarValue, viewModel.deltaY, viewModel.itemHeight, viewModel.matchCount, viewModel.focus);
4898
+ const dom = getSearchVirtualDom(viewModel.displayResults, viewModel.flags, viewModel.message, viewModel.focusOutline, viewModel.searchInputErrorMessage, viewModel.scrollBarHeight, viewModel.scrollBarY, viewModel.scrollBarValue, viewModel.deltaY, viewModel.itemHeight, viewModel.matchCount, newState.limitHitWarning, viewModel.focus);
4786
4899
  return ['Viewlet.setDom2', newState.uid, dom];
4787
4900
  };
4788
4901
 
@@ -4845,7 +4958,7 @@ const getIconVirtualDom = (icon, type = Div) => {
4845
4958
  return {
4846
4959
  type,
4847
4960
  className: mergeClassNames(MaskIcon, `MaskIcon${icon}`),
4848
- role: None,
4961
+ role: None$1,
4849
4962
  childCount: 0
4850
4963
  };
4851
4964
  };
@@ -4927,22 +5040,22 @@ const renderActions = uid => {
4927
5040
  const renderEventListeners = () => {
4928
5041
  return [{
4929
5042
  name: HandleInput2,
4930
- params: ['handleInput2', 'event.target.name', 'event.target.value', User]
5043
+ params: ['handleInput2', TargetName, TargetValue, User]
4931
5044
  }, {
4932
5045
  name: HandleExcludeInput,
4933
- params: ['handleExcludeInput', 'event.target.value']
5046
+ params: ['handleExcludeInput', TargetValue]
4934
5047
  }, {
4935
5048
  name: HandleIncludeInput,
4936
- params: ['handleIncludeInput', 'event.target.value']
5049
+ params: ['handleIncludeInput', TargetValue]
4937
5050
  }, {
4938
5051
  name: HandleReplaceInput,
4939
- params: ['handleReplaceInput', 'event.target.value']
5052
+ params: ['handleReplaceInput', TargetValue]
4940
5053
  }, {
4941
5054
  name: HandleInput,
4942
- params: ['handleInput', 'event.target.value', User]
5055
+ params: ['handleInput', TargetValue, User]
4943
5056
  }, {
4944
5057
  name: HandleClick,
4945
- params: ['handleClickAt', 'event.clientX', 'event.clientY']
5058
+ params: ['handleClickAt', ClientX, ClientY]
4946
5059
  }, {
4947
5060
  name: HandleToggleButtonClick,
4948
5061
  params: ['handleToggleButtonClick']
@@ -4954,7 +5067,7 @@ const renderEventListeners = () => {
4954
5067
  params: ['handleListBlur']
4955
5068
  }, {
4956
5069
  name: HandleContextMenu,
4957
- params: ['handleContextMenu', 'event.button', 'event.clientX', 'event.clientY'],
5070
+ params: ['handleContextMenu', Button$1, ClientX, ClientY],
4958
5071
  preventDefault: true
4959
5072
  }, {
4960
5073
  name: HandleHeaderContextMenu,
@@ -4962,11 +5075,11 @@ const renderEventListeners = () => {
4962
5075
  preventDefault: true
4963
5076
  }, {
4964
5077
  name: HandleWheel,
4965
- params: ['handleWheel', 'event.deltaMode', 'event.deltaY'],
5078
+ params: ['handleWheel', DeltaMode, DeltaY],
4966
5079
  passive: true
4967
5080
  }, {
4968
5081
  name: HandleHeaderClick2,
4969
- params: ['handleHeaderClick', 'event.target.name']
5082
+ params: ['handleHeaderClick', TargetName]
4970
5083
  }, {
4971
5084
  name: HandleHeaderFocusIn,
4972
5085
  params: ['handleHeaderFocusIn']
@@ -4975,7 +5088,7 @@ const renderEventListeners = () => {
4975
5088
  params: ['handleHeaderFocusOut']
4976
5089
  }, {
4977
5090
  name: HandleScrollBarPointerDown,
4978
- params: ['handleScrollBarClick', 'event.deltaY']
5091
+ params: ['handleScrollBarClick', DeltaY]
4979
5092
  }];
4980
5093
  };
4981
5094
 
@@ -4984,7 +5097,7 @@ const getDom = state => {
4984
5097
  const focusOutline = state.listFocused && state.listFocusedIndex === -1;
4985
5098
  const scrollBarValue = state.deltaY / state.finalDeltaY * 100;
4986
5099
  const scrollBarY = getScrollBarY$1(state.deltaY, state.finalDeltaY, state.height - state.headerHeight, state.scrollBarHeight);
4987
- const dom = getSearchVirtualDom(displayResults, state.flags, state.message, focusOutline, state.searchInputErrorMessage, state.scrollBarHeight, scrollBarY, scrollBarValue, state.deltaY, state.itemHeight, state.matchCount, state.focus);
5100
+ const dom = getSearchVirtualDom(displayResults, state.flags, state.message, focusOutline, state.searchInputErrorMessage, state.scrollBarHeight, scrollBarY, scrollBarValue, state.deltaY, state.itemHeight, state.matchCount, state.limitHitWarning, state.focus);
4988
5101
  return dom;
4989
5102
  };
4990
5103
 
@@ -5060,7 +5173,8 @@ const saveState = uid => {
5060
5173
  flags,
5061
5174
  includeValue,
5062
5175
  excludeValue,
5063
- history
5176
+ history,
5177
+ collapsedPaths
5064
5178
  } = newState;
5065
5179
  return {
5066
5180
  value,
@@ -5068,7 +5182,8 @@ const saveState = uid => {
5068
5182
  flags,
5069
5183
  includeValue,
5070
5184
  excludeValue,
5071
- history
5185
+ history,
5186
+ collapsedPaths
5072
5187
  };
5073
5188
  };
5074
5189
 
@@ -5165,6 +5280,12 @@ const focusReplaceAll = state => {
5165
5280
  return focusElement(state, FocusSearchReplaceAll);
5166
5281
  };
5167
5282
 
5283
+ const setLimit = (state, limit) => {
5284
+ return handleUpdate(state, {
5285
+ limit
5286
+ });
5287
+ };
5288
+
5168
5289
  const getNewHistory = (history, newValue) => {
5169
5290
  const newHistory = [...history, newValue];
5170
5291
  const maxHistoryLength = 100;
@@ -5195,8 +5316,6 @@ const show = async (x, y, id, ...args) => {
5195
5316
  await showContextMenu(x, y, id, ...args);
5196
5317
  };
5197
5318
 
5198
- const Search = 18;
5199
-
5200
5319
  const handleContextMenuKeyboard = async state => {
5201
5320
  const {
5202
5321
  x
@@ -5204,12 +5323,12 @@ const handleContextMenuKeyboard = async state => {
5204
5323
  const {
5205
5324
  y
5206
5325
  } = state; // TODO
5207
- await show(x, y, Search);
5326
+ await show(x, y, Search$1);
5208
5327
  return state;
5209
5328
  };
5210
5329
 
5211
5330
  const handleContextMenuMouseAt = async (state, x, y) => {
5212
- await show(x, y, Search);
5331
+ await show(x, y, Search$1);
5213
5332
  return state;
5214
5333
  };
5215
5334
 
@@ -5233,6 +5352,7 @@ const commandMap = {
5233
5352
  'TextSearch.collapseAll': wrapCommand(collapseAll$1),
5234
5353
  'TextSearch.collapseDetails': wrapCommand(collapseDetails),
5235
5354
  'TextSearch.copy': wrapCommand(copy),
5355
+ 'TextSearch.copyPath': wrapCommand(copyPath),
5236
5356
  'TextSearch.diff2': diff2,
5237
5357
  'TextSearch.dismissItem': wrapCommand(dismissItem),
5238
5358
  'TextSearch.expandDetails': wrapCommand(expandDetails),
@@ -5284,6 +5404,7 @@ const commandMap = {
5284
5404
  'TextSearch.replaceAll': wrapCommand(replaceAll),
5285
5405
  'TextSearch.rerender': rerender,
5286
5406
  'TextSearch.selectIndex': wrapCommand(selectIndex),
5407
+ 'TextSearch.setLimit': wrapCommand(setLimit),
5287
5408
  'TextSearch.submit': wrapCommand(submit),
5288
5409
  'TextSearch.toggleMatchCase': wrapCommand(toggleMatchCase),
5289
5410
  'TextSearch.toggleMatchWholeWord': wrapCommand(toggleMatchWholeWord),
@@ -5314,20 +5435,44 @@ const commandMap = {
5314
5435
  const textSearch$5 = async (scheme, root, query) => {
5315
5436
  string(scheme);
5316
5437
  string(query);
5317
- const result = await invoke$1('ExtensionHostTextSearch.executeTextSearchProvider', scheme, query);
5318
- return result;
5438
+ const results = await invoke$1('ExtensionHostTextSearch.executeTextSearchProvider', scheme, query);
5439
+ return {
5440
+ results,
5441
+ limitHit: false
5442
+ };
5319
5443
  };
5320
5444
 
5321
5445
  const textSearch$4 = async (scheme, root, query, options, assetDir) => {
5322
- return invoke$1('ExtensionHostTextSearch.textSearchFetch', scheme, root, query, options, assetDir);
5446
+ const results = await invoke$1('ExtensionHostTextSearch.textSearchFetch', scheme, root, query, options, assetDir);
5447
+ return {
5448
+ results,
5449
+ limitHit: false
5450
+ };
5323
5451
  };
5324
5452
 
5325
5453
  const textSearch$3 = async (scheme, root, query) => {
5326
- return invoke$1('ExtensionHostTextSearch.textSearchHtml', scheme, root, query);
5454
+ const results = await invoke$1('ExtensionHostTextSearch.textSearchHtml', scheme, root, query);
5455
+ return {
5456
+ results,
5457
+ limitHit: false
5458
+ };
5327
5459
  };
5328
5460
 
5329
5461
  const textSearch$2 = async (scheme, root, query, options, assetDir) => {
5330
- return invoke$1('ExtensionHostTextSearch.textSearchMemory', scheme, root, query, options, assetDir);
5462
+ try {
5463
+ // @ts-ignore
5464
+ const result = await invoke$1('ExtensionHostTextSearch.textSearchMemory2', scheme, root, query, options, assetDir);
5465
+ if (!result || !result.results) {
5466
+ throw new Error(`new api not supported`);
5467
+ }
5468
+ return result;
5469
+ } catch {
5470
+ const results = await invoke$1('ExtensionHostTextSearch.textSearchMemory', scheme, root, query, options, assetDir);
5471
+ return {
5472
+ results,
5473
+ limitHit: false
5474
+ };
5475
+ }
5331
5476
  };
5332
5477
 
5333
5478
  const textSearch$1 = async (scheme, root, query, options, assetDir, platform) => {
@@ -5341,14 +5486,18 @@ const textSearch$1 = async (scheme, root, query, options, assetDir, platform) =>
5341
5486
  };
5342
5487
  if (platform === Remote || platform === Electron) {
5343
5488
  const result = await invoke('TextSearch.search', actualOptions);
5344
- // TODO api is weird
5345
- // @ts-ignore
5346
- return result.results;
5489
+ return {
5490
+ results: result.results,
5491
+ limitHit: result.limitHit
5492
+ };
5347
5493
  }
5348
5494
  // TODO always create search process messageport rpc to have one api, in web can send the messageport to renderer worker
5349
- const results = await invoke$1('SearchProcess.invoke', 'TextSearch.search', actualOptions);
5495
+ const result = await invoke$1('SearchProcess.invoke', 'TextSearch.search', actualOptions);
5350
5496
  // TODO api is weird
5351
- return results.results;
5497
+ return {
5498
+ results: result.results,
5499
+ limitHit: result.limitHit
5500
+ };
5352
5501
  };
5353
5502
 
5354
5503
  const textSearch = async (scheme, root, query) => {
@@ -5364,7 +5513,10 @@ const textSearch = async (scheme, root, query) => {
5364
5513
  }]]);
5365
5514
  }
5366
5515
  }
5367
- return results;
5516
+ return {
5517
+ results,
5518
+ limitHit: false
5519
+ };
5368
5520
  };
5369
5521
 
5370
5522
  const textSearchProviderMap = {
@@ -5379,6 +5531,7 @@ const textSearchProviderMap = {
5379
5531
  };
5380
5532
 
5381
5533
  const listen = async () => {
5534
+ registerCommands(commandMap);
5382
5535
  add(textSearchProviderMap);
5383
5536
  const rpc = await WebWorkerRpcClient.create({
5384
5537
  commandMap: commandMap
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/text-search-worker",
3
- "version": "5.7.0",
3
+ "version": "5.9.0",
4
4
  "description": "Text Search Worker",
5
5
  "keywords": [
6
6
  "text-search"