@lvce-editor/file-search-worker 5.5.0 → 5.7.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.
@@ -445,7 +445,7 @@ const callbacks = Object.create(null);
445
445
  const set$2 = (id, fn) => {
446
446
  callbacks[id] = fn;
447
447
  };
448
- const get$3 = id => {
448
+ const get$2 = id => {
449
449
  return callbacks[id];
450
450
  };
451
451
  const remove$1 = id => {
@@ -618,7 +618,7 @@ const warn$1 = (...args) => {
618
618
  console.warn(...args);
619
619
  };
620
620
  const resolve = (id, response) => {
621
- const fn = get$3(id);
621
+ const fn = get$2(id);
622
622
  if (!fn) {
623
623
  console.log(response);
624
624
  warn$1(`callback ${id} may already be disposed`);
@@ -780,7 +780,7 @@ const invokeAndTransfer = (ipc, method, ...params) => {
780
780
  };
781
781
 
782
782
  const commands = Object.create(null);
783
- const register$2 = commandMap => {
783
+ const register$1 = commandMap => {
784
784
  Object.assign(commands, commandMap);
785
785
  };
786
786
  const getCommand = key => {
@@ -850,7 +850,7 @@ const create$3 = async ({
850
850
  commandMap
851
851
  }) => {
852
852
  // TODO create a commandMap per rpc instance
853
- register$2(commandMap);
853
+ register$1(commandMap);
854
854
  const ipc = await listen$1(IpcChildWithModuleWorkerAndMessagePort$1);
855
855
  handleIpc(ipc);
856
856
  const rpc = createRpc(ipc);
@@ -867,12 +867,12 @@ const rpcs = Object.create(null);
867
867
  const set$1 = (id, rpc) => {
868
868
  rpcs[id] = rpc;
869
869
  };
870
- const get$2 = id => {
870
+ const get$1 = id => {
871
871
  return rpcs[id];
872
872
  };
873
873
 
874
874
  const invoke$1 = (method, ...params) => {
875
- const rpc = get$2(RendererWorker);
875
+ const rpc = get$1(RendererWorker);
876
876
  // @ts-ignore
877
877
  return rpc.invoke(method, ...params);
878
878
  };
@@ -891,310 +891,6 @@ const Script = 2;
891
891
 
892
892
  const minimumSliderSize = 20;
893
893
 
894
- const Command = '>';
895
- const Symbol$1 = '@';
896
- const WorkspaceSymbol$1 = '#';
897
- const GoToLine$1 = ':';
898
- const View$1 = 'view ';
899
- const None$2 = '';
900
-
901
- const getQuickPickPrefix = value => {
902
- if (value.startsWith(Command)) {
903
- return Command;
904
- }
905
- if (value.startsWith(Symbol$1)) {
906
- return Symbol$1;
907
- }
908
- if (value.startsWith(WorkspaceSymbol$1)) {
909
- return WorkspaceSymbol$1;
910
- }
911
- if (value.startsWith(GoToLine$1)) {
912
- return GoToLine$1;
913
- }
914
- if (value.startsWith(View$1)) {
915
- return View$1;
916
- }
917
- return None$2;
918
- };
919
-
920
- const CommandPalette = 'quickPick://commandPalette';
921
- const Commands = 'quickPick://commands';
922
- const File$2 = 'quickPick://file';
923
- const EveryThing = 'quickPick://everything';
924
- const Recent = 'quickPick://recent';
925
- const ColorTheme = 'quickPick://color-theme';
926
- const Symbol = 'quickPick://symbol';
927
- const View = 'quickPick://view';
928
- const WorkspaceSymbol = 'quickPick://workspace-symbol';
929
- const Custom = 'quickPick://custom';
930
- const GoToLine = 'quickPick://go-to-line';
931
-
932
- // TODO use numeric enum for quickpick entry id
933
- const getQuickPickProviderId = prefix => {
934
- switch (prefix) {
935
- case Command:
936
- return Commands;
937
- case Symbol$1:
938
- return Symbol;
939
- case WorkspaceSymbol$1:
940
- return WorkspaceSymbol;
941
- case GoToLine$1:
942
- return GoToLine;
943
- case View$1:
944
- return View;
945
- default:
946
- return File$2;
947
- }
948
- };
949
-
950
- const getVisibleItems$i = (picks, icons) => {
951
- return [];
952
- };
953
-
954
- const Hide = 'hide';
955
- const KeepOpen = '';
956
-
957
- const emptyObject = {};
958
- const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
959
- const i18nString = (key, placeholders = emptyObject) => {
960
- if (placeholders === emptyObject) {
961
- return key;
962
- }
963
- const replacer = (match, rest) => {
964
- return placeholders[rest];
965
- };
966
- return key.replaceAll(RE_PLACEHOLDER, replacer);
967
- };
968
-
969
- const Files = 'Files';
970
- const NoMatchingColorThemesFound = 'No matching color themes found';
971
- const NoMatchingResults = 'No matching results';
972
- const NoRecentlyOpenedFoldersFound = 'No recently opened folders found';
973
- const NoResults = 'No Results';
974
- const NoSymbolFound = 'No symbol found';
975
- const NoWorkspaceSymbolsFound = 'no workspace symbols found';
976
- const OpenRecent = 'Open Recent';
977
- const SelectColorTheme = 'Select Color Theme';
978
- const SelectToOpen = 'Select to open';
979
- const TypeNameOfCommandToRun = 'Type the name of a command to run.';
980
- const QuickOpen = 'Quick open';
981
-
982
- const noMatchingColorThemesFound = () => {
983
- return i18nString(NoMatchingColorThemesFound);
984
- };
985
- const selectColorTheme = () => {
986
- return i18nString(SelectColorTheme);
987
- };
988
- const typeNameofCommandToRun = () => {
989
- return i18nString(TypeNameOfCommandToRun);
990
- };
991
- const noMatchingResults = () => {
992
- return i18nString(NoMatchingResults);
993
- };
994
- const files = () => {
995
- return i18nString(Files);
996
- };
997
- const noResults = () => {
998
- return i18nString(NoResults);
999
- };
1000
- const selectToOpen = () => {
1001
- return i18nString(SelectToOpen);
1002
- };
1003
- const openRecent = () => {
1004
- return i18nString(OpenRecent);
1005
- };
1006
- const noRecentlyOpenedFoldersFound = () => {
1007
- return i18nString(NoRecentlyOpenedFoldersFound);
1008
- };
1009
- const noSymbolFound = () => {
1010
- return i18nString(NoSymbolFound);
1011
- };
1012
- const noWorkspaceSymbolsFound = () => {
1013
- return i18nString(NoWorkspaceSymbolsFound);
1014
- };
1015
- const quickOpen = () => {
1016
- return i18nString(QuickOpen);
1017
- };
1018
-
1019
- const name$9 = 'noop';
1020
- const getPlaceholder$9 = () => {
1021
- return '';
1022
- };
1023
- const getNoResults$9 = () => {
1024
- return noResults();
1025
- };
1026
- const getPicks$9 = async value => {
1027
- return [];
1028
- };
1029
- const selectPick$9 = async item => {
1030
- return {
1031
- command: Hide
1032
- };
1033
- };
1034
- const getFilterValue$9 = value => {
1035
- return value;
1036
- };
1037
- const getPickFilterValue$9 = pick => {
1038
- return pick;
1039
- };
1040
- const getVisibleItems$h = getVisibleItems$i;
1041
-
1042
- const QuickPickNoop = {
1043
- __proto__: null,
1044
- getFilterValue: getFilterValue$9,
1045
- getNoResults: getNoResults$9,
1046
- getPickFilterValue: getPickFilterValue$9,
1047
- getPicks: getPicks$9,
1048
- getPlaceholder: getPlaceholder$9,
1049
- getVisibleItems: getVisibleItems$h,
1050
- name: name$9,
1051
- selectPick: selectPick$9
1052
- };
1053
-
1054
- const state$b = {
1055
- provider: QuickPickNoop,
1056
- prefix: 'string-that-should-never-match-another-string'
1057
- };
1058
- const getVisibleItems$g = (picks, icons) => {
1059
- const items = picks.map(pick => pick.pick);
1060
- const visibleItems = state$b.provider.getVisibleItems(items, icons);
1061
- return visibleItems;
1062
- };
1063
-
1064
- const state$a = Object.create(null);
1065
- const register$1 = modules => {
1066
- Object.assign(state$a, modules);
1067
- };
1068
- const get$1 = moduleId => {
1069
- const module = state$a[moduleId];
1070
- if (!module) {
1071
- throw new Error(`unknown module "${moduleId}"`);
1072
- }
1073
- return module;
1074
- };
1075
-
1076
- // TODO avoid global variable
1077
-
1078
- // TODO don't store provider in state, only serialized value like provider-id
1079
-
1080
- /**
1081
- * @type {string}
1082
- */
1083
- const name$8 = 'everything';
1084
- const getPlaceholder$8 = () => {
1085
- return state$b.provider.getPlaceholder();
1086
- };
1087
- const getLabel$5 = () => {
1088
- return '';
1089
- };
1090
- const getNoResults$8 = () => {
1091
- return state$b.provider.getNoResults();
1092
- };
1093
- const getPicks$8 = async value => {
1094
- const prefix = getQuickPickPrefix(value);
1095
-
1096
- // TODO race condition
1097
- if (state$b.prefix !== prefix) {
1098
- state$b.prefix = prefix;
1099
- const providerId = getQuickPickProviderId(prefix);
1100
- const provider = get$1(providerId);
1101
- state$b.provider = provider;
1102
- }
1103
- // TODO this line is a bit duplicated with getFilterValue
1104
- const slicedValue = value.slice(prefix.length).trimStart();
1105
- const picks = await state$b.provider.getPicks(slicedValue);
1106
- return picks;
1107
- };
1108
- const selectPick$8 = item => {
1109
- const {
1110
- provider
1111
- } = state$b;
1112
- return provider.selectPick(item);
1113
- };
1114
- const openCommandPalette = () => {
1115
- // show('>')
1116
- };
1117
- const openView = () => {
1118
- // show('view ')
1119
- };
1120
- const getFilterValue$8 = value => {
1121
- return value.slice(state$b.prefix.length).trim();
1122
- };
1123
- const getPickFilterValue$8 = pick => {
1124
- const {
1125
- provider
1126
- } = state$b;
1127
- return provider.getPickFilterValue(pick);
1128
- };
1129
- const getPickDescription$d = pick => {
1130
- const {
1131
- provider
1132
- } = state$b;
1133
- // @ts-ignore
1134
- if (provider.getPickDescription) {
1135
- // @ts-ignore
1136
- return provider.getPickDescription(pick);
1137
- }
1138
- return '';
1139
- };
1140
- const getPickLabel$e = pick => {
1141
- const {
1142
- provider
1143
- } = state$b;
1144
- // @ts-ignore
1145
- return provider.getPickLabel(pick);
1146
- };
1147
- const getPickIcon$e = pick => {
1148
- const {
1149
- provider
1150
- } = state$b;
1151
- // @ts-ignore
1152
- return provider.getPickIcon(pick);
1153
- };
1154
- const getPickFileIcon$2 = pick => {
1155
- const {
1156
- provider
1157
- } = state$b;
1158
- // @ts-ignore
1159
- if (provider.getPickFileIcon) {
1160
- // @ts-ignore
1161
- return provider.getPickFileIcon(pick);
1162
- }
1163
- return undefined;
1164
- };
1165
- const isPrepared$8 = () => {
1166
- const {
1167
- provider
1168
- } = state$b;
1169
- // @ts-ignore
1170
- if (provider.isPrepared) {
1171
- // @ts-ignore
1172
- return provider.isPrepared();
1173
- }
1174
- return false;
1175
- };
1176
-
1177
- const QuickPickEntriesEverything = {
1178
- __proto__: null,
1179
- getFilterValue: getFilterValue$8,
1180
- getLabel: getLabel$5,
1181
- getNoResults: getNoResults$8,
1182
- getPickDescription: getPickDescription$d,
1183
- getPickFileIcon: getPickFileIcon$2,
1184
- getPickFilterValue: getPickFilterValue$8,
1185
- getPickIcon: getPickIcon$e,
1186
- getPickLabel: getPickLabel$e,
1187
- getPicks: getPicks$8,
1188
- getPlaceholder: getPlaceholder$8,
1189
- getVisibleItems: getVisibleItems$g,
1190
- isPrepared: isPrepared$8,
1191
- name: name$8,
1192
- openCommandPalette,
1193
- openView,
1194
- selectPick: selectPick$8,
1195
- state: state$b
1196
- };
1197
-
1198
894
  const Default$1 = 0;
1199
895
  const Finished = 2;
1200
896
 
@@ -1288,18 +984,16 @@ const handleWheel = (state, deltaMode, deltaY) => {
1288
984
  return setDeltaY(state, state.deltaY + deltaY);
1289
985
  };
1290
986
 
1291
- const create = (uid, uri, listItemHeight, x, y, width, height, platform, args) => {
987
+ const create = (uid, uri, listItemHeight, x, y, width, height, platform, args, workspaceUri) => {
1292
988
  const state = {
989
+ workspaceUri,
1293
990
  uid,
1294
991
  icons: [],
1295
992
  state: Default$1,
1296
993
  picks: [],
1297
994
  recentPicks: [],
1298
- recentPickIds: new Map(),
1299
- // TODO use object.create(null) instead
995
+ recentPickIds: Object.create(null),
1300
996
  versionId: 0,
1301
- provider: QuickPickEntriesEverything,
1302
- // TODO make this dynamic again
1303
997
  warned: [],
1304
998
  maxVisibleItems: 10,
1305
999
  uri,
@@ -1380,21 +1074,55 @@ const dispose = uid => {
1380
1074
  remove(uid);
1381
1075
  };
1382
1076
 
1383
- const emptyDirent = {
1384
- name: '',
1385
- path: '',
1386
- type: 0
1077
+ const setColorTheme = id => {
1078
+ return invoke$1(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
1079
+ };
1080
+
1081
+ const focusPick$1 = async pick => {
1082
+ const label = pick.label;
1083
+ await setColorTheme(/* colorThemeId */label);
1084
+ };
1085
+
1086
+ const CommandPalette = 'quickPick://commandPalette';
1087
+ const Commands = 'quickPick://commands';
1088
+ const File$2 = 'quickPick://file';
1089
+ const EveryThing = 'quickPick://everything';
1090
+ const Recent = 'quickPick://recent';
1091
+ const ColorTheme = 'quickPick://color-theme';
1092
+ const Symbol$1 = 'quickPick://symbol';
1093
+ const View$1 = 'quickPick://view';
1094
+ const WorkspaceSymbol$1 = 'quickPick://workspace-symbol';
1095
+ const Custom = 'quickPick://custom';
1096
+ const GoToLine$1 = 'quickPick://go-to-line';
1097
+ const Noop = 'quickPick://noop';
1098
+
1099
+ const noop$2 = async () => {};
1100
+ const getFn$2 = id => {
1101
+ switch (id) {
1102
+ case ColorTheme:
1103
+ return focusPick$1;
1104
+ default:
1105
+ return noop$2;
1106
+ }
1107
+ };
1108
+ const focusPick = (id, pick) => {
1109
+ const fn = getFn$2(id);
1110
+ return fn(pick);
1387
1111
  };
1388
1112
 
1389
1113
  const getIconsCached = (paths, fileIconCache) => {
1390
1114
  return paths.map(path => fileIconCache[path]);
1391
1115
  };
1392
1116
 
1117
+ const Directory = 3;
1393
1118
  const File$1 = 7;
1394
1119
 
1395
1120
  const getMissingIconRequests = (dirents, fileIconCache) => {
1396
1121
  const missingRequests = [];
1397
1122
  for (const dirent of dirents) {
1123
+ if (!dirent.path) {
1124
+ continue;
1125
+ }
1398
1126
  if (!(dirent.path in fileIconCache)) {
1399
1127
  missingRequests.push({
1400
1128
  type: File$1,
@@ -1435,9 +1163,13 @@ const updateIconCache = (iconCache, missingRequests, newIcons) => {
1435
1163
  return newFileIconCache;
1436
1164
  };
1437
1165
 
1438
- const getQuickPickFileIcons = async (provider, items, fileIconCache) => {
1166
+ const getQuickPickFileIcons = async (items, fileIconCache) => {
1439
1167
  const dirents = items.map(item => {
1440
- const dirent = provider.getPickFileIcon?.(item) || emptyDirent;
1168
+ const dirent = {
1169
+ type: item.direntType,
1170
+ name: item.label,
1171
+ path: item.uri
1172
+ };
1441
1173
  return dirent;
1442
1174
  });
1443
1175
  const missingRequests = getMissingIconRequests(dirents, fileIconCache);
@@ -1453,19 +1185,14 @@ const getQuickPickFileIcons = async (provider, items, fileIconCache) => {
1453
1185
 
1454
1186
  const focusIndex = async (state, index) => {
1455
1187
  const {
1456
- provider,
1188
+ uri,
1457
1189
  maxVisibleItems,
1458
1190
  items,
1459
1191
  minLineY,
1460
1192
  maxLineY,
1461
1193
  fileIconCache
1462
1194
  } = state;
1463
- // TODO get types working
1464
- // @ts-ignore
1465
- if (provider.focusPick) {
1466
- // @ts-ignore
1467
- await provider.focusPick(items[index].pick);
1468
- }
1195
+ await focusPick(uri, items[index]);
1469
1196
  if (index < minLineY + 1) {
1470
1197
  const minLineY = index;
1471
1198
  const maxLineY = Math.min(index + maxVisibleItems, items.length - 1);
@@ -1473,7 +1200,7 @@ const focusIndex = async (state, index) => {
1473
1200
  const {
1474
1201
  newFileIconCache,
1475
1202
  icons
1476
- } = await getQuickPickFileIcons(provider, sliced, fileIconCache);
1203
+ } = await getQuickPickFileIcons(sliced, fileIconCache);
1477
1204
 
1478
1205
  // TODO need to scroll up
1479
1206
  return {
@@ -1493,7 +1220,7 @@ const focusIndex = async (state, index) => {
1493
1220
  const {
1494
1221
  newFileIconCache,
1495
1222
  icons
1496
- } = await getQuickPickFileIcons(provider, sliced, fileIconCache);
1223
+ } = await getQuickPickFileIcons(sliced, fileIconCache);
1497
1224
  return {
1498
1225
  ...state,
1499
1226
  minLineY,
@@ -1507,7 +1234,7 @@ const focusIndex = async (state, index) => {
1507
1234
  const {
1508
1235
  newFileIconCache,
1509
1236
  icons
1510
- } = await getQuickPickFileIcons(provider, sliced, fileIconCache);
1237
+ } = await getQuickPickFileIcons(sliced, fileIconCache);
1511
1238
  return {
1512
1239
  ...state,
1513
1240
  focusedIndex: index,
@@ -1751,15 +1478,6 @@ const getNewValue = (value, inputType, data, selectionStart, selectionEnd) => {
1751
1478
  return fn(value, selectionStart, selectionEnd, data);
1752
1479
  };
1753
1480
 
1754
- const emptyMatches = [];
1755
-
1756
- const convertToPick = item => {
1757
- return {
1758
- pick: item,
1759
- matches: emptyMatches
1760
- };
1761
- };
1762
-
1763
1481
  const Diagonal = 1;
1764
1482
  const Left = 2;
1765
1483
 
@@ -1919,38 +1637,17 @@ const filterQuickPickItem = (pattern, word) => {
1919
1637
  return matches;
1920
1638
  };
1921
1639
 
1922
- // TODO this should be in FileSystem module
1923
- const pathBaseName = path => {
1924
- return path.slice(path.lastIndexOf('/') + 1);
1925
- };
1926
-
1927
- // TODO this should be in FileSystem module
1928
- const pathDirName = path => {
1929
- const pathSeparator = '/';
1930
- const index = path.lastIndexOf(pathSeparator);
1931
- if (index === -1) {
1932
- return '';
1933
- }
1934
- return path.slice(0, index);
1935
- };
1936
-
1937
- const filterQuickPickItems = (items, value, provider) => {
1640
+ const filterQuickPickItems = (items, value) => {
1938
1641
  if (!value) {
1939
- return items.map(convertToPick);
1642
+ return items;
1940
1643
  }
1941
1644
  const results = [];
1942
1645
  for (const item of items) {
1943
- let filterValue = '';
1944
- if (provider) {
1945
- // @ts-ignore
1946
- filterValue = provider.getPickLabel(item);
1947
- } else {
1948
- filterValue = pathBaseName(item);
1949
- }
1646
+ const filterValue = item.label;
1950
1647
  const matches = filterQuickPickItem(value, filterValue);
1951
1648
  if (matches.length > 0) {
1952
1649
  results.push({
1953
- pick: item,
1650
+ ...item,
1954
1651
  matches
1955
1652
  });
1956
1653
  }
@@ -1958,11 +1655,84 @@ const filterQuickPickItems = (items, value, provider) => {
1958
1655
  return results;
1959
1656
  };
1960
1657
 
1658
+ const Command = '>';
1659
+ const Symbol = '@';
1660
+ const WorkspaceSymbol = '#';
1661
+ const GoToLine = ':';
1662
+ const View = 'view ';
1663
+ const None$1 = '';
1664
+
1665
+ const getQuickPickPrefix = value => {
1666
+ if (value.startsWith(Command)) {
1667
+ return Command;
1668
+ }
1669
+ if (value.startsWith(Symbol)) {
1670
+ return Symbol;
1671
+ }
1672
+ if (value.startsWith(WorkspaceSymbol)) {
1673
+ return WorkspaceSymbol;
1674
+ }
1675
+ if (value.startsWith(GoToLine)) {
1676
+ return GoToLine;
1677
+ }
1678
+ if (value.startsWith(View)) {
1679
+ return View;
1680
+ }
1681
+ return None$1;
1682
+ };
1683
+
1684
+ const noop$1 = value => {
1685
+ return value;
1686
+ };
1687
+ const getFilterValueEverything = value => {
1688
+ const prefix = getQuickPickPrefix(value);
1689
+ const prefixLength = prefix.length;
1690
+ return value.slice(prefixLength).trim();
1691
+ };
1692
+ const getFn$1 = id => {
1693
+ switch (id) {
1694
+ case EveryThing:
1695
+ return getFilterValueEverything;
1696
+ default:
1697
+ return noop$1;
1698
+ }
1699
+ };
1700
+ const getFilterValue = (id, value) => {
1701
+ const fn = getFn$1(id);
1702
+ const filterValue = fn(value);
1703
+ return filterValue;
1704
+ };
1705
+
1706
+ /**
1707
+ * @deprecated
1708
+ */
1709
+ const select = Object.create(null);
1710
+ const getPick$1 = Object.create(null);
1711
+ const registerSelect = modules => {
1712
+ Object.assign(select, modules);
1713
+ };
1714
+ const registerGetPick = modules => {
1715
+ Object.assign(getPick$1, modules);
1716
+ };
1717
+ const getPicks$b = id => {
1718
+ const fn = getPick$1[id];
1719
+ return fn;
1720
+ };
1721
+ const getSelect = id => {
1722
+ const fn = select[id];
1723
+ return fn;
1724
+ };
1725
+
1726
+ const getPicks$a = (id, searchValue) => {
1727
+ const fn = getPicks$b(id);
1728
+ return fn(searchValue);
1729
+ };
1730
+
1961
1731
  // TODO when user types letters -> no need to query provider again -> just filter existing results
1962
1732
  const setValue = async (state, newValue) => {
1963
1733
  const {
1964
1734
  value,
1965
- provider,
1735
+ uri,
1966
1736
  minLineY,
1967
1737
  maxLineY,
1968
1738
  fileIconCache
@@ -1970,15 +1740,15 @@ const setValue = async (state, newValue) => {
1970
1740
  if (value === newValue) {
1971
1741
  return state;
1972
1742
  }
1973
- const newPicks = await provider.getPicks(newValue);
1974
- const filterValue = provider.getFilterValue(newValue);
1975
- const items = filterQuickPickItems(newPicks, filterValue, provider);
1743
+ const newPicks = await getPicks$a(uri, newValue);
1744
+ const filterValue = getFilterValue(uri, newValue);
1745
+ const items = filterQuickPickItems(newPicks, filterValue);
1976
1746
  const focusedIndex = items.length === 0 ? -1 : 0;
1977
1747
  const sliced = newPicks.slice(minLineY, maxLineY);
1978
1748
  const {
1979
1749
  newFileIconCache,
1980
1750
  icons
1981
- } = await getQuickPickFileIcons(provider, sliced, fileIconCache);
1751
+ } = await getQuickPickFileIcons(sliced, fileIconCache);
1982
1752
  return {
1983
1753
  ...state,
1984
1754
  picks: newPicks,
@@ -2032,15 +1802,19 @@ const getPick = (items, index) => {
2032
1802
  // }
2033
1803
  // index -= state.recentPicks.length
2034
1804
  if (index < items.length) {
2035
- return items[index].pick;
1805
+ return items[index];
2036
1806
  }
2037
1807
  console.warn('no pick matching index', index);
1808
+ return undefined;
2038
1809
  };
2039
1810
 
1811
+ const Hide = 'hide';
1812
+ const KeepOpen = '';
1813
+
2040
1814
  const selectIndex = async (state, index, button = /* left */0) => {
2041
1815
  const {
2042
1816
  minLineY,
2043
- provider,
1817
+ uri,
2044
1818
  items
2045
1819
  } = state;
2046
1820
  const actualIndex = index + minLineY;
@@ -2048,8 +1822,8 @@ const selectIndex = async (state, index, button = /* left */0) => {
2048
1822
  if (!pick) {
2049
1823
  return state;
2050
1824
  }
2051
- // @ts-ignore
2052
- const selectPickResult = await provider.selectPick(pick, actualIndex, button);
1825
+ const fn = getSelect(uri);
1826
+ const selectPickResult = await fn(pick);
2053
1827
  object(selectPickResult);
2054
1828
  string(selectPickResult.command);
2055
1829
  const {
@@ -2105,6 +1879,27 @@ const getDefaultValue = uri => {
2105
1879
  }
2106
1880
  };
2107
1881
 
1882
+ const state$3 = {
1883
+ args: []
1884
+ };
1885
+
1886
+ const noop = args => {};
1887
+ const setArgsCustom = args => {
1888
+ state$3.args = args;
1889
+ };
1890
+ const getFn = id => {
1891
+ switch (id) {
1892
+ case Custom:
1893
+ return setArgsCustom;
1894
+ default:
1895
+ return noop;
1896
+ }
1897
+ };
1898
+ const setArgs = (id, args) => {
1899
+ const fn = getFn(id);
1900
+ return fn(args);
1901
+ };
1902
+
2108
1903
  const loadContent = async state => {
2109
1904
  const {
2110
1905
  uri,
@@ -2112,23 +1907,18 @@ const loadContent = async state => {
2112
1907
  fileIconCache
2113
1908
  } = state;
2114
1909
  const value = getDefaultValue(uri);
2115
- const provider = get$1(uri);
2116
- // @ts-ignore
2117
- if (provider.setArgs) {
2118
- // @ts-ignore
2119
- provider.setArgs(args);
2120
- }
2121
- const newPicks = await provider.getPicks(value);
1910
+ setArgs(uri, args);
1911
+ const newPicks = await getPicks$a(uri, value);
2122
1912
  array(newPicks);
2123
- const filterValue = provider.getFilterValue(value);
2124
- const items = filterQuickPickItems(newPicks, filterValue, provider);
1913
+ const filterValue = getFilterValue(uri, value);
1914
+ const items = filterQuickPickItems(newPicks, filterValue);
2125
1915
  const minLineY = 0;
2126
1916
  const maxLineY = Math.min(minLineY + state.maxVisibleItems, newPicks.length);
2127
1917
  const sliced = newPicks.slice(minLineY, maxLineY);
2128
1918
  const {
2129
1919
  newFileIconCache,
2130
1920
  icons
2131
- } = await getQuickPickFileIcons(provider, sliced, fileIconCache);
1921
+ } = await getQuickPickFileIcons(sliced, fileIconCache);
2132
1922
  return {
2133
1923
  ...state,
2134
1924
  picks: newPicks,
@@ -2139,7 +1929,6 @@ const loadContent = async state => {
2139
1929
  maxLineY,
2140
1930
  value,
2141
1931
  cursorOffset: value.length,
2142
- provider,
2143
1932
  inputSource: Script,
2144
1933
  focused: true,
2145
1934
  fileIconCache: newFileIconCache,
@@ -2147,19 +1936,24 @@ const loadContent = async state => {
2147
1936
  };
2148
1937
  };
2149
1938
 
2150
- const state$9 = {
1939
+ const state$2 = {
2151
1940
  menuEntries: []
2152
1941
  };
2153
1942
  const getAll = () => {
2154
- return state$9.menuEntries;
1943
+ return state$2.menuEntries;
2155
1944
  };
2156
1945
  const add = menuEntries => {
2157
- state$9.menuEntries = [...state$9.menuEntries, ...menuEntries];
1946
+ state$2.menuEntries = [...state$2.menuEntries, ...menuEntries];
2158
1947
  };
2159
1948
 
2160
- const getVisible$1 = (provider, items, minLineY, maxLineY, icons) => {
1949
+ const getVisible$1 = (items, minLineY, maxLineY, icons) => {
2161
1950
  const range = items.slice(minLineY, maxLineY);
2162
- const protoVisibleItems = provider.getVisibleItems(range, icons);
1951
+ const protoVisibleItems = range.map((item, index) => {
1952
+ return {
1953
+ ...item,
1954
+ fileIcon: icons[index]
1955
+ };
1956
+ });
2163
1957
  return protoVisibleItems;
2164
1958
  };
2165
1959
 
@@ -2176,7 +1970,7 @@ const getVisible = (setSize, protoVisibleItems, minLineY, focusedIndex) => {
2176
1970
  };
2177
1971
 
2178
1972
  const createQuickPickViewModel = (oldState, newState) => {
2179
- const protoVisibleItems = getVisible$1(newState.provider, newState.items, newState.minLineY, newState.maxLineY, newState.icons);
1973
+ const protoVisibleItems = getVisible$1(newState.items, newState.minLineY, newState.maxLineY, newState.icons);
2180
1974
  const visibleItems = getVisible(newState.items.length, protoVisibleItems, newState.minLineY, newState.focusedIndex);
2181
1975
  const oldFocusedIndex = oldState.focusedIndex - oldState.minLineY;
2182
1976
  const newFocusedIndex = newState.focusedIndex - newState.minLineY;
@@ -2223,7 +2017,7 @@ const renderHeight = newState => {
2223
2017
 
2224
2018
  const ComboBox = 'combobox';
2225
2019
  const ListBox = 'listbox';
2226
- const None$1 = 'none';
2020
+ const None = 'none';
2227
2021
  const Option = 'option';
2228
2022
 
2229
2023
  const FileIcon = 'FileIcon';
@@ -2236,7 +2030,9 @@ const QuickPickItem = 'QuickPickItem';
2236
2030
  const QuickPickItemActive$1 = 'QuickPickItemActive';
2237
2031
  const QuickPickItemDescription = 'QuickPickItemDescription';
2238
2032
  const QuickPickItemLabel = 'QuickPickItemLabel';
2033
+ const QuickPickMaskIcon = 'QuickPickMaskIcon';
2239
2034
  const QuickPickItems$1 = 'QuickPickItems';
2035
+ const MaskIcon = 'MaskIcon';
2240
2036
  const Viewlet = 'Viewlet';
2241
2037
 
2242
2038
  const HandleBeforeInput = 'handleBeforeInput';
@@ -2250,8 +2046,34 @@ const QuickPick = 'QuickPick';
2250
2046
  const QuickPickItems = 'QuickPickItems';
2251
2047
  const QuickPickItemActive = 'QuickPickItemActive';
2252
2048
 
2253
- const Div = 4;
2254
- const Input = 6;
2049
+ const emptyObject = {};
2050
+ const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
2051
+ const i18nString = (key, placeholders = emptyObject) => {
2052
+ if (placeholders === emptyObject) {
2053
+ return key;
2054
+ }
2055
+ const replacer = (match, rest) => {
2056
+ return placeholders[rest];
2057
+ };
2058
+ return key.replaceAll(RE_PLACEHOLDER, replacer);
2059
+ };
2060
+
2061
+ const NoResults = 'No Results';
2062
+ const TypeNameOfCommandToRun = 'Type the name of a command to run.';
2063
+ const QuickOpen = 'Quick open';
2064
+
2065
+ const typeNameofCommandToRun = () => {
2066
+ return i18nString(TypeNameOfCommandToRun);
2067
+ };
2068
+ const noResults = () => {
2069
+ return i18nString(NoResults);
2070
+ };
2071
+ const quickOpen = () => {
2072
+ return i18nString(QuickOpen);
2073
+ };
2074
+
2075
+ const Div = 4;
2076
+ const Input = 6;
2255
2077
  const Span = 8;
2256
2078
  const Img = 17;
2257
2079
 
@@ -2285,6 +2107,41 @@ const getQuickPickHeaderVirtualDom = () => {
2285
2107
  }, getQuickPickInputVirtualDom()];
2286
2108
  };
2287
2109
 
2110
+ const emptyHighlightSections = [];
2111
+
2112
+ const getHighlightSections = (highlights, label) => {
2113
+ if (highlights.length === 0) {
2114
+ return emptyHighlightSections;
2115
+ }
2116
+ const sections = [];
2117
+ let position = 0;
2118
+ for (let i = 0; i < highlights.length; i += 2) {
2119
+ const highlightStart = highlights[i];
2120
+ const highlightEnd = highlights[i + 1];
2121
+ if (position < highlightStart) {
2122
+ const beforeText = label.slice(position, highlightStart);
2123
+ sections.push({
2124
+ highlighted: false,
2125
+ text: beforeText
2126
+ });
2127
+ }
2128
+ const highlightText = label.slice(highlightStart, highlightEnd);
2129
+ sections.push({
2130
+ highlighted: true,
2131
+ text: highlightText
2132
+ });
2133
+ position = highlightEnd;
2134
+ }
2135
+ if (position < label.length) {
2136
+ const afterText = label.slice(position);
2137
+ sections.push({
2138
+ highlighted: false,
2139
+ text: afterText
2140
+ });
2141
+ }
2142
+ return sections;
2143
+ };
2144
+
2288
2145
  const mergeClassNames = (...classNames) => {
2289
2146
  return classNames.filter(Boolean).join(' ');
2290
2147
  };
@@ -2302,32 +2159,34 @@ const quickPickHighlight = {
2302
2159
  className: QuickPickHighlight,
2303
2160
  childCount: 1
2304
2161
  };
2305
- const addHighlights = (dom, highlights, label) => {
2162
+ const getHighlights = (highlights, label) => {
2306
2163
  const labelDom = {
2307
2164
  type: Div,
2308
2165
  className: QuickPickItemLabel,
2309
2166
  childCount: 0
2310
2167
  };
2311
- dom.push(labelDom);
2312
- let position = 0;
2313
- for (let i = 0; i < highlights.length; i += 2) {
2314
- const highlightStart = highlights[i];
2315
- const highlightEnd = highlights[i + 1];
2316
- if (position < highlightStart) {
2317
- const beforeText = label.slice(position, highlightStart);
2318
- labelDom.childCount++;
2319
- dom.push(text(beforeText));
2320
- }
2321
- const highlightText = label.slice(highlightStart, highlightEnd);
2168
+ const nodes = [labelDom];
2169
+ const sections = getHighlightSections(highlights, label);
2170
+ if (sections.length === 0) {
2322
2171
  labelDom.childCount++;
2323
- dom.push(quickPickHighlight, text(highlightText));
2324
- position = highlightEnd;
2325
- }
2326
- if (position < label.length) {
2327
- const afterText = label.slice(position);
2328
- labelDom.childCount++;
2329
- dom.push(text(afterText));
2172
+ nodes.push(text(label));
2173
+ } else {
2174
+ for (const section of sections) {
2175
+ if (section.highlighted) {
2176
+ labelDom.childCount++;
2177
+ nodes.push(quickPickHighlight, text(section.text));
2178
+ } else {
2179
+ labelDom.childCount++;
2180
+ nodes.push(text(section.text));
2181
+ }
2182
+ }
2330
2183
  }
2184
+ return nodes;
2185
+ };
2186
+
2187
+ const addHighlights = (dom, highlights, label) => {
2188
+ const domHighlights = getHighlights(highlights, label);
2189
+ dom.push(...domHighlights);
2331
2190
  };
2332
2191
 
2333
2192
  const getFileIconVirtualDom = icon => {
@@ -2335,7 +2194,7 @@ const getFileIconVirtualDom = icon => {
2335
2194
  type: Img,
2336
2195
  className: FileIcon,
2337
2196
  src: icon,
2338
- role: None$1,
2197
+ role: None,
2339
2198
  childCount: 0
2340
2199
  };
2341
2200
  };
@@ -2364,7 +2223,7 @@ const getQuickPickItemVirtualDom = visibleItem => {
2364
2223
  const parent = dom[0];
2365
2224
  if (isActive) {
2366
2225
  // @ts-ignore
2367
- parent.id = 'QuickPickItemActive';
2226
+ parent.id = QuickPickItemActive;
2368
2227
  parent.className += ' ' + QuickPickItemActive$1;
2369
2228
  }
2370
2229
  if (fileIcon) {
@@ -2374,7 +2233,7 @@ const getQuickPickItemVirtualDom = visibleItem => {
2374
2233
  parent.childCount++;
2375
2234
  dom.push({
2376
2235
  type: Div,
2377
- className: mergeClassNames(`QuickPickMaskIcon`, 'MaskIcon', `MaskIcon${icon}`),
2236
+ className: mergeClassNames(QuickPickMaskIcon, MaskIcon, `MaskIcon${icon}`),
2378
2237
  childCount: 0
2379
2238
  });
2380
2239
  }
@@ -2516,7 +2375,7 @@ const selectCurrentIndex = state => {
2516
2375
 
2517
2376
  const findLabelIndex = (items, label) => {
2518
2377
  for (let i = 0; i < items.length; i++) {
2519
- if (items[i].pick.label === label) {
2378
+ if (items[i].label === label) {
2520
2379
  return i;
2521
2380
  }
2522
2381
  }
@@ -2573,132 +2432,29 @@ const commandMap = {
2573
2432
  'QuickPick.selectIndex': wrapCommand(selectIndex),
2574
2433
  'QuickPick.selectItem': wrapCommand(selectItem),
2575
2434
  'QuickPick.setDeltaY': wrapCommand(setDeltaY),
2576
- 'QuickPick.setValue': wrapCommand(setValue),
2577
- // deprecated
2578
- 'QuickPick.loadEntries2': get$1
2579
- };
2580
-
2581
- const getPickDescription$c = value => {
2582
- return '';
2583
- };
2584
- const getPickIcon$d = pick => {
2585
- return '';
2586
- };
2587
- const getPickLabel$d = pick => {
2588
- return pick;
2589
- };
2590
- const getVisibleItems$f = (picks, icons) => {
2591
- const visibleItems = picks.map((item, index) => {
2592
- const pick = item.pick;
2593
- return {
2594
- description: getPickDescription$c(),
2595
- fileIcon: '',
2596
- icon: getPickIcon$d(),
2597
- label: getPickLabel$d(pick),
2598
- matches: []
2599
- };
2600
- });
2601
- return visibleItems;
2435
+ 'QuickPick.setValue': wrapCommand(setValue)
2602
2436
  };
2603
2437
 
2604
2438
  const getColorThemeNames = async () => {
2605
2439
  return invoke$1(/* Ajax.getJson */'ColorTheme.getColorThemeNames');
2606
2440
  };
2607
2441
 
2608
- const getPicks$7 = async searchValue => {
2609
- const colorThemeNames = await getColorThemeNames();
2610
- return colorThemeNames;
2611
- };
2612
-
2613
- const setColorTheme = id => {
2614
- return invoke$1(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
2615
- };
2616
-
2617
- const selectPick$7 = async pick => {
2618
- await setColorTheme(/* colorThemeId */pick);
2619
- return {
2620
- command: Hide
2621
- };
2622
- };
2623
-
2624
- const focusPick = async pick => {
2625
- await setColorTheme(/* colorThemeId */pick);
2626
- };
2627
-
2628
- const getPlaceholder$7 = () => {
2629
- return selectColorTheme();
2630
- };
2631
- const getLabel$4 = () => {
2632
- return selectColorTheme();
2633
- };
2634
- const getVisibleItems$e = getVisibleItems$f;
2635
- const getFilterValue$7 = value => {
2636
- return value;
2637
- };
2638
- const getNoResults$7 = () => {
2639
- return {
2640
- label: noMatchingColorThemesFound()
2442
+ const toProtoVisibleItem$2 = name => {
2443
+ const pick = {
2444
+ label: name,
2445
+ description: '',
2446
+ fileIcon: '',
2447
+ icon: '',
2448
+ matches: [],
2449
+ direntType: 0,
2450
+ uri: ''
2641
2451
  };
2642
- };
2643
- const getPickFilterValue$7 = pick => {
2644
2452
  return pick;
2645
2453
  };
2646
- const getPickLabel$c = pick => {
2647
- return pick;
2648
- };
2649
- const getPickIcon$c = pick => {
2650
- return '';
2651
- };
2652
- const state$8 = {};
2653
- const getPickDescription$b = value => {
2654
- return '';
2655
- };
2656
- const isPrepared$7 = () => {
2657
- return false;
2658
- };
2659
- const name$7 = '';
2660
- const getHelpEntries$2 = () => {
2661
- return [];
2662
- };
2663
-
2664
- const QuickPickEntriesColorTheme = {
2665
- __proto__: null,
2666
- focusPick,
2667
- getFilterValue: getFilterValue$7,
2668
- getHelpEntries: getHelpEntries$2,
2669
- getLabel: getLabel$4,
2670
- getNoResults: getNoResults$7,
2671
- getPickDescription: getPickDescription$b,
2672
- getPickFilterValue: getPickFilterValue$7,
2673
- getPickIcon: getPickIcon$c,
2674
- getPickLabel: getPickLabel$c,
2675
- getPicks: getPicks$7,
2676
- getPlaceholder: getPlaceholder$7,
2677
- getVisibleItems: getVisibleItems$e,
2678
- isPrepared: isPrepared$7,
2679
- name: name$7,
2680
- selectPick: selectPick$7,
2681
- state: state$8
2682
- };
2683
-
2684
- const getPickIcon$b = () => {
2685
- return '';
2686
- };
2687
- const getPickLabel$b = pick => {
2688
- return pick.label;
2689
- };
2690
- const getVisibleItems$d = (picks, icons) => {
2691
- const visibleItems = picks.map((item, index) => {
2692
- const pick = item;
2693
- return {
2694
- description: pick.description || '',
2695
- fileIcon: '',
2696
- icon: getPickIcon$b(),
2697
- label: getPickLabel$b(pick),
2698
- matches: []
2699
- };
2700
- });
2701
- return visibleItems;
2454
+ const getPicks$9 = async searchValue => {
2455
+ const colorThemeNames = await getColorThemeNames();
2456
+ const picks = colorThemeNames.map(toProtoVisibleItem$2);
2457
+ return picks;
2702
2458
  };
2703
2459
 
2704
2460
  const handleError = async (error, notify = true, prefix = '') => {
@@ -2753,230 +2509,76 @@ const getExtensionPicks = async () => {
2753
2509
  return [];
2754
2510
  }
2755
2511
  };
2756
- const getPicks$6 = async () => {
2512
+ const toProtoVisibleItem$1 = item => {
2513
+ const pick = {
2514
+ label: item.label,
2515
+ description: '',
2516
+ fileIcon: '',
2517
+ icon: '',
2518
+ matches: [],
2519
+ direntType: 0,
2520
+ uri: ''
2521
+ };
2522
+ // @ts-ignore
2523
+ pick.id = item.id;
2524
+ return pick;
2525
+ };
2526
+ const getPicks$8 = async () => {
2527
+ // TODO get picks in parallel
2757
2528
  const builtinPicks = await getBuiltinPicks();
2758
2529
  const extensionPicks = await getExtensionPicks();
2759
2530
  const allPicks = [...builtinPicks, ...extensionPicks];
2760
- return allPicks;
2531
+ const converted = allPicks.map(toProtoVisibleItem$1);
2532
+ return converted;
2761
2533
  };
2762
2534
 
2763
- const shouldHide = item => {
2764
- if (item.id === 'Viewlet.openWidget' && item.args[0] === 'QuickPick') {
2765
- return false;
2766
- }
2767
- return true;
2768
- };
2769
- const selectPickBuiltin = async item => {
2770
- const args = item.args || [];
2771
- // TODO ids should be all numbers for efficiency -> also directly can call command
2772
- await invoke$1(item.id, ...args);
2773
- if (shouldHide(item)) {
2774
- return {
2775
- command: Hide
2776
- };
2777
- }
2778
- return {
2779
- command: KeepOpen
2780
- };
2781
- };
2782
- const selectPickExtension = async item => {
2783
- const id = item.id.slice(4); // TODO lots of string allocation with 'ext.' find a better way to separate builtin commands from extension commands
2784
- try {
2785
- await invoke$1('ExtensionHost.executeCommand', id);
2786
- } catch (error) {
2787
- await handleError(error, false);
2788
- await showErrorDialog(error);
2789
- }
2790
- return {
2791
- command: Hide
2792
- };
2793
- };
2794
- const selectPick$6 = async item => {
2795
- if (item.id.startsWith('ext.')) {
2796
- return selectPickExtension(item);
2797
- }
2798
- return selectPickBuiltin(item);
2799
- };
2800
-
2801
- const name$6 = 'command';
2802
- const state$7 = {};
2803
- const isPrepared$6 = () => {
2804
- return false;
2805
- };
2806
- const getPickDescription$a = () => {
2807
- return '';
2808
- };
2809
- const getPlaceholder$6 = () => {
2810
- return typeNameofCommandToRun();
2811
- };
2812
- const getLabel$3 = () => {
2813
- return '';
2814
- };
2815
- const getNoResults$6 = () => {
2816
- return {
2817
- label: noMatchingResults()
2818
- };
2819
- };
2820
- const getVisibleItems$c = getVisibleItems$d;
2821
- const getFilterValue$6 = value => {
2822
- return value.trim();
2823
- };
2824
- const getPickFilterValue$6 = pick => {
2825
- return pick.label;
2826
- };
2827
- const getPickLabel$a = pick => {
2828
- return pick.label;
2829
- };
2830
- const getPickIcon$a = () => {
2831
- return '';
2535
+ const getPicks$7 = async searchValue => {
2536
+ const items = state$3.args[1] || [];
2537
+ return items;
2832
2538
  };
2833
2539
 
2834
- const QuickPickEntriesCommand = {
2835
- __proto__: null,
2836
- getFilterValue: getFilterValue$6,
2837
- getLabel: getLabel$3,
2838
- getNoResults: getNoResults$6,
2839
- getPickDescription: getPickDescription$a,
2840
- getPickFilterValue: getPickFilterValue$6,
2841
- getPickIcon: getPickIcon$a,
2842
- getPickLabel: getPickLabel$a,
2843
- getPicks: getPicks$6,
2844
- getPlaceholder: getPlaceholder$6,
2845
- getVisibleItems: getVisibleItems$c,
2846
- isPrepared: isPrepared$6,
2847
- name: name$6,
2848
- selectPick: selectPick$6,
2849
- state: state$7
2850
- };
2851
-
2852
- const Tag$1 = 'Tag';
2853
- const Cloud$1 = 'Cloud';
2854
- const SourceControl$1 = 'SourceControl';
2855
- const None = '';
2856
-
2857
- const SourceControl = 1;
2858
- const Cloud = 2;
2859
- const Tag = 3;
2860
-
2861
- const getPickDescription$9 = pick => {
2862
- return pick.description || '';
2863
- };
2864
- const getPickLabel$9 = pick => {
2865
- return pick.label;
2866
- };
2867
- const convertIcon$1 = icon => {
2868
- switch (icon) {
2869
- case SourceControl:
2870
- return SourceControl$1;
2871
- case Cloud:
2872
- return Cloud$1;
2873
- case Tag:
2874
- return Tag$1;
2540
+ // TODO use numeric enum for quickpick entry id
2541
+ const getQuickPickProviderId = prefix => {
2542
+ switch (prefix) {
2543
+ case Command:
2544
+ return Commands;
2545
+ case Symbol:
2546
+ return Symbol$1;
2547
+ case WorkspaceSymbol:
2548
+ return WorkspaceSymbol$1;
2549
+ case GoToLine:
2550
+ return GoToLine$1;
2551
+ case View:
2552
+ return View$1;
2875
2553
  default:
2876
- return None;
2554
+ return File$2;
2877
2555
  }
2878
2556
  };
2879
- const getPickIcon$9 = pick => {
2880
- return convertIcon$1(pick.icon);
2881
- };
2882
- const getVisibleItems$b = (picks, icons) => {
2883
- const visibleItems = picks.map((pick, index) => ({
2884
- description: getPickDescription$9(pick),
2885
- fileIcon: '',
2886
- icon: getPickIcon$9(pick),
2887
- label: getPickLabel$9(pick),
2888
- matches: []
2889
- }));
2890
- return visibleItems;
2891
- };
2892
2557
 
2893
- const name$5 = 'custom';
2894
- const state$6 = {
2895
- args: []
2896
- };
2897
- const setArgs = args => {
2898
- state$6.args = args;
2899
- };
2900
- const getPlaceholder$5 = () => {
2901
- return '';
2902
- };
2903
- const getLabel$2 = () => {
2904
- return 'Custom';
2558
+ const state$1 = {
2559
+ provider: Noop,
2560
+ prefix: 'string-that-should-never-match-another-string'
2905
2561
  };
2906
2562
 
2907
- // TODO help entries should not be here
2908
- const getHelpEntries$1 = () => {
2909
- return [];
2910
- };
2911
- const getNoResults$5 = () => {
2912
- return {
2913
- label: noMatchingResults()
2914
- };
2915
- };
2916
- const getPicks$5 = async searchValue => {
2917
- const items = state$6.args[1] || [];
2918
- return items;
2919
- };
2920
- const selectPick$5 = async pick => {
2921
- const {
2922
- args
2923
- } = state$6;
2924
- const resolve = args[2];
2925
- resolve(pick);
2926
- return {
2927
- command: Hide
2928
- };
2929
- };
2930
- const getFilterValue$5 = value => {
2931
- return value;
2932
- };
2933
- const getPickFilterValue$5 = pick => {
2934
- return pick;
2935
- };
2936
- const getPickLabel$8 = pick => {
2937
- return pick.label;
2938
- };
2939
- const getPickDescription$8 = pick => {
2940
- return pick.description || '';
2941
- };
2942
- const convertIcon = icon => {
2943
- switch (icon) {
2944
- case SourceControl:
2945
- return SourceControl$1;
2946
- case Cloud:
2947
- return Cloud$1;
2948
- case Tag:
2949
- return Tag$1;
2950
- default:
2951
- return None;
2563
+ const getPicks$6 = async value => {
2564
+ const prefix = getQuickPickPrefix(value);
2565
+ const providerId = getQuickPickProviderId(prefix);
2566
+
2567
+ // TODO race condition
2568
+ if (state$1.prefix !== prefix) {
2569
+ state$1.prefix = prefix;
2570
+ state$1.provider = providerId;
2952
2571
  }
2572
+ // TODO this line is a bit duplicated with getFilterValue
2573
+ const slicedValue = value.slice(prefix.length).trimStart();
2574
+ const picks = await getPicks$a(providerId, slicedValue);
2575
+ return picks;
2953
2576
  };
2954
- const getPickIcon$8 = pick => {
2955
- return convertIcon(pick.icon);
2956
- };
2957
- const isPrepared$5 = () => {
2958
- return true;
2959
- };
2960
- const getVisibleItems$a = getVisibleItems$b;
2961
2577
 
2962
- const QuickPickEntriesCustom = {
2963
- __proto__: null,
2964
- getFilterValue: getFilterValue$5,
2965
- getHelpEntries: getHelpEntries$1,
2966
- getLabel: getLabel$2,
2967
- getNoResults: getNoResults$5,
2968
- getPickDescription: getPickDescription$8,
2969
- getPickFilterValue: getPickFilterValue$5,
2970
- getPickIcon: getPickIcon$8,
2971
- getPickLabel: getPickLabel$8,
2972
- getPicks: getPicks$5,
2973
- getPlaceholder: getPlaceholder$5,
2974
- getVisibleItems: getVisibleItems$a,
2975
- isPrepared: isPrepared$5,
2976
- name: name$5,
2977
- selectPick: selectPick$5,
2978
- setArgs,
2979
- state: state$6
2578
+ const emptyMatches = [];
2579
+
2580
+ const getWorkspacePath = async () => {
2581
+ return invoke$1('Workspace.getPath');
2980
2582
  };
2981
2583
 
2982
2584
  const RE_PROTOCOL = /^([a-z-]+):\/\//;
@@ -2988,51 +2590,12 @@ const getProtocol = uri => {
2988
2590
  return '';
2989
2591
  };
2990
2592
 
2991
- const getVisibleItems$9 = (files, icons) => {
2992
- const visibleItems = files.map((item, i) => {
2993
- const pick = item.pick;
2994
- const label = getPickLabel$7(pick);
2995
- const description = getPickDescription$7(pick);
2996
- const icon = getPickIcon$7();
2997
- const fileIcon = icons[i];
2998
- return {
2999
- label,
3000
- description,
3001
- icon,
3002
- fileIcon,
3003
- matches: item.matches
3004
- };
3005
- });
3006
- return visibleItems;
3007
- };
3008
- const getPickLabel$7 = pick => {
3009
- if (typeof pick === 'object') {
3010
- pick = pick.pick;
3011
- }
3012
- const baseName = pathBaseName(pick);
3013
- return baseName;
3014
- };
3015
- const getPickDescription$7 = pick => {
3016
- if (typeof pick === 'object') {
3017
- pick = pick.pick;
3018
- }
3019
- const dirName = pathDirName(pick);
3020
- return dirName;
3021
- };
3022
- const getPickIcon$7 = () => {
3023
- return '';
3024
- };
3025
-
3026
- const getWorkspacePath = async () => {
3027
- return invoke$1('Workspace.getPath');
3028
- };
3029
-
3030
- const state$5 = Object.create(null);
2593
+ const state = Object.create(null);
3031
2594
  const register = modules => {
3032
- Object.assign(state$5, modules);
2595
+ Object.assign(state, modules);
3033
2596
  };
3034
2597
  const getModule = protocol => {
3035
- return state$5[protocol];
2598
+ return state[protocol];
3036
2599
  };
3037
2600
 
3038
2601
  const searchFile$5 = async (path, value, prepare, assetDir) => {
@@ -3043,459 +2606,222 @@ const searchFile$5 = async (path, value, prepare, assetDir) => {
3043
2606
  return result;
3044
2607
  };
3045
2608
 
2609
+ // TODO this should be in FileSystem module
2610
+ const pathBaseName = path => {
2611
+ return path.slice(path.lastIndexOf('/') + 1);
2612
+ };
2613
+
2614
+ // TODO this should be in FileSystem module
2615
+ const pathDirName = path => {
2616
+ const pathSeparator = '/';
2617
+ const index = path.lastIndexOf(pathSeparator);
2618
+ if (index === -1) {
2619
+ return '';
2620
+ }
2621
+ return path.slice(0, index);
2622
+ };
2623
+
3046
2624
  const searchFile$4 = async (path, value) => {
3047
2625
  const prepare = true;
3048
- // @ts-ignore
3049
- const files = await searchFile$5(/* path */path, /* searchTerm */value, prepare);
2626
+ const files = await searchFile$5(/* path */path, /* searchTerm */value, prepare, '');
3050
2627
  return files;
3051
2628
  };
3052
- const getPicks$4 = async searchValue => {
2629
+ const convertToPick = uri => {
2630
+ const baseName = pathBaseName(uri);
2631
+ const dirName = pathDirName(uri);
2632
+ return {
2633
+ description: dirName,
2634
+ direntType: File$1,
2635
+ fileIcon: '',
2636
+ icon: '',
2637
+ label: baseName,
2638
+ matches: emptyMatches,
2639
+ uri
2640
+ };
2641
+ };
2642
+
2643
+ // TODO handle files differently
2644
+ // e.g. when there are many files, don't need
2645
+ // to compute the fileIcon for all files
2646
+
2647
+ const getPicks$5 = async searchValue => {
3053
2648
  // TODO cache workspace path
3054
2649
  const workspace = await getWorkspacePath();
3055
2650
  if (!workspace) {
3056
2651
  return [];
3057
2652
  }
3058
2653
  const files = await searchFile$4(workspace, searchValue);
3059
- return files;
2654
+ const picks = files.map(convertToPick);
2655
+ return picks;
3060
2656
  };
3061
2657
 
3062
- const openUri = async uri => {
3063
- await invoke$1(/* Main.openUri */'Main.openUri', /* uri */uri);
2658
+ const getRecentlyOpened = () => {
2659
+ return invoke$1(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
3064
2660
  };
3065
2661
 
3066
- const selectPick$4 = async pick => {
3067
- if (typeof pick === 'object') {
3068
- pick = pick.pick;
3069
- }
3070
- const workspace = await getWorkspacePath();
3071
- const absolutePath = `${workspace}/${pick}`;
3072
- await openUri(absolutePath);
2662
+ const toProtoVisibleItem = uri => {
3073
2663
  return {
3074
- command: Hide
3075
- };
3076
- };
3077
-
3078
- const state$4 = {};
3079
- const name$4 = 'file';
3080
- const getPlaceholder$4 = () => {
3081
- return '';
3082
- };
3083
- const getLabel$1 = () => {
3084
- return files();
3085
- };
3086
- const getNoResults$4 = () => {
3087
- return {
3088
- label: noMatchingResults()
3089
- };
3090
- };
3091
- const getFilterValue$4 = value => {
3092
- return value;
3093
- };
3094
- const getPickFilterValue$4 = pick => {
3095
- if (typeof pick === 'object') {
3096
- pick = pick.pick;
3097
- }
3098
- return pick;
3099
- };
3100
- const getPickLabel$6 = pick => {
3101
- if (typeof pick === 'object') {
3102
- pick = pick.pick;
3103
- }
3104
- const baseName = pathBaseName(pick);
3105
- return baseName;
3106
- };
3107
- const getPickDescription$6 = pick => {
3108
- if (typeof pick === 'object') {
3109
- pick = pick.pick;
3110
- }
3111
- const dirName = pathDirName(pick);
3112
- return dirName;
3113
- };
3114
- const getPickIcon$6 = () => {
3115
- return '';
3116
- };
3117
- const getPickFileIcon$1 = pick => {
3118
- if (typeof pick === 'object') {
3119
- pick = pick.pick;
3120
- }
3121
- if (typeof pick === 'object') {
3122
- pick = pick.pick;
3123
- }
3124
- const baseName = pathBaseName(pick);
3125
- return {
3126
- type: File$1,
3127
- name: baseName,
3128
- path: pick
2664
+ label: uri,
2665
+ description: '',
2666
+ fileIcon: '',
2667
+ icon: '',
2668
+ matches: [],
2669
+ direntType: Directory,
2670
+ uri: uri
3129
2671
  };
3130
2672
  };
3131
- const isPrepared$4 = () => {
3132
- const workspace = '';
3133
- // TODO protocol should always be defined. For files it should use file protocol
3134
- const protocol = getProtocol(workspace);
3135
- return !protocol;
3136
- };
3137
- const getVisibleItems$8 = getVisibleItems$9;
3138
-
3139
- const QuickPickEntriesFile = {
3140
- __proto__: null,
3141
- getFilterValue: getFilterValue$4,
3142
- getLabel: getLabel$1,
3143
- getNoResults: getNoResults$4,
3144
- getPickDescription: getPickDescription$6,
3145
- getPickFileIcon: getPickFileIcon$1,
3146
- getPickFilterValue: getPickFilterValue$4,
3147
- getPickIcon: getPickIcon$6,
3148
- getPickLabel: getPickLabel$6,
3149
- getPicks: getPicks$4,
3150
- getPlaceholder: getPlaceholder$4,
3151
- getVisibleItems: getVisibleItems$8,
3152
- isPrepared: isPrepared$4,
3153
- name: name$4,
3154
- selectPick: selectPick$4,
3155
- state: state$4
2673
+ const getPicks$4 = async () => {
2674
+ const recentlyOpened = await getRecentlyOpened();
2675
+ const picks = recentlyOpened.map(toProtoVisibleItem);
2676
+ return picks;
3156
2677
  };
3157
2678
 
3158
- const getRecentlyOpened = () => {
3159
- return invoke$1(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
2679
+ const getPicks$3 = async () => {
2680
+ const picks = [];
2681
+ return picks;
3160
2682
  };
3161
2683
 
3162
- const getPickDescription$5 = pick => {
3163
- return pathDirName(pick);
3164
- };
3165
- const getPickIcon$5 = () => {
3166
- return '';
3167
- };
3168
- const getPickLabel$5 = pick => {
3169
- return pathBaseName(pick);
3170
- };
3171
- const getVisibleItems$7 = (picks, icons) => {
3172
- const visibleItems = picks.map((item, index) => {
3173
- const pick = item.pick;
3174
- const fileIcon = icons[index];
3175
- return {
3176
- description: getPickDescription$5(pick),
3177
- fileIcon,
3178
- icon: getPickIcon$5(),
3179
- label: getPickLabel$5(pick),
3180
- matches: pick.matches || []
3181
- };
3182
- });
3183
- return visibleItems;
2684
+ const getPicks$2 = async () => {
2685
+ // const views = ViewService.getViews()
2686
+ // const picks = views.map(toPick)
2687
+ // return picks
2688
+ return [];
3184
2689
  };
3185
2690
 
3186
- const openWorkspaceFolder = uri => {
3187
- return invoke$1(/* Workspace.setPath */'Workspace.setPath', /* path */uri);
2691
+ const getPicks$1 = async () => {
2692
+ const picks = [];
2693
+ return picks;
3188
2694
  };
3189
2695
 
3190
- // TODO selectPick should be independent of show/hide
3191
- const selectPick$3 = async pick => {
3192
- const path = pick;
3193
- await openWorkspaceFolder(path);
2696
+ const selectPick$7 = async pick => {
2697
+ const id = pick.label;
2698
+ await setColorTheme(/* colorThemeId */id);
3194
2699
  return {
3195
2700
  command: Hide
3196
2701
  };
3197
2702
  };
3198
2703
 
3199
- const getPlaceholder$3 = () => {
3200
- return selectToOpen();
3201
- };
3202
- const getLabel = () => {
3203
- return openRecent();
2704
+ const shouldHide = item => {
2705
+ if (item.id === 'Viewlet.openWidget' && item.args[0] === 'QuickPick') {
2706
+ return false;
2707
+ }
2708
+ return true;
3204
2709
  };
3205
- const getNoResults$3 = () => {
2710
+ const selectPickBuiltin = async item => {
2711
+ const args = item.args || [];
2712
+ // TODO ids should be all numbers for efficiency -> also directly can call command
2713
+ await invoke$1(item.id, ...args);
2714
+ if (shouldHide(item)) {
2715
+ return {
2716
+ command: Hide
2717
+ };
2718
+ }
3206
2719
  return {
3207
- label: noRecentlyOpenedFoldersFound()
2720
+ command: KeepOpen
3208
2721
  };
3209
2722
  };
3210
-
3211
- // TODO could also change api so that getPicks returns an array of anything
3212
- // and the transformPick gets the label for each pick
3213
- // This would make the code more module since the code for getting the picks
3214
- // would be more independent of the specific data format of the quickpick provider
3215
-
3216
- const getPicks$3 = async () => {
3217
- const recentlyOpened = await getRecentlyOpened();
3218
- return recentlyOpened;
3219
- };
3220
- const getVisibleItems$6 = getVisibleItems$7;
3221
- const getFilterValue$3 = value => {
3222
- return pathBaseName(value);
3223
- };
3224
- const getPickFilterValue$3 = pick => {
3225
- return pathBaseName(pick);
3226
- };
3227
- const getPickLabel$4 = pick => {
3228
- return pathBaseName(pick);
3229
- };
3230
- const getPickDescription$4 = pick => {
3231
- return pathDirName(pick);
3232
- };
3233
- const getPickIcon$4 = () => {
3234
- return '';
3235
- };
3236
- const getPickFileIcon = pick => {
3237
- if (typeof pick === 'object') {
3238
- pick = pick.pick;
3239
- }
3240
- if (typeof pick === 'object') {
3241
- pick = pick.pick;
2723
+ const selectPickExtension = async item => {
2724
+ const id = item.id.slice(4); // TODO lots of string allocation with 'ext.' find a better way to separate builtin commands from extension commands
2725
+ try {
2726
+ await invoke$1('ExtensionHost.executeCommand', id);
2727
+ } catch (error) {
2728
+ await handleError(error, false);
2729
+ await showErrorDialog(error);
3242
2730
  }
3243
- const baseName = pathBaseName(pick);
3244
2731
  return {
3245
- type: File$1,
3246
- name: baseName,
3247
- path: pick
2732
+ command: Hide
3248
2733
  };
3249
2734
  };
3250
- const state$3 = {};
3251
- const isPrepared$3 = () => {
3252
- return false;
3253
- };
3254
- const name$3 = '';
3255
-
3256
- const QuickPickEntriesOpenRecent = {
3257
- __proto__: null,
3258
- getFilterValue: getFilterValue$3,
3259
- getLabel,
3260
- getNoResults: getNoResults$3,
3261
- getPickDescription: getPickDescription$4,
3262
- getPickFileIcon,
3263
- getPickFilterValue: getPickFilterValue$3,
3264
- getPickIcon: getPickIcon$4,
3265
- getPickLabel: getPickLabel$4,
3266
- getPicks: getPicks$3,
3267
- getPlaceholder: getPlaceholder$3,
3268
- getVisibleItems: getVisibleItems$6,
3269
- isPrepared: isPrepared$3,
3270
- name: name$3,
3271
- selectPick: selectPick$3,
3272
- state: state$3
3273
- };
3274
-
3275
- const getVisibleItems$5 = picks => {
3276
- return [];
2735
+ const selectPick$6 = async item => {
2736
+ // @ts-ignore
2737
+ const id = item.id;
2738
+ if (id.startsWith('ext.')) {
2739
+ return selectPickExtension(item);
2740
+ }
2741
+ return selectPickBuiltin(item);
3277
2742
  };
3278
2743
 
3279
- const selectPick$2 = async item => {
2744
+ const selectPick$5 = async pick => {
2745
+ const {
2746
+ args
2747
+ } = state$3;
2748
+ const resolve = args[2];
2749
+ resolve(pick);
3280
2750
  return {
3281
2751
  command: Hide
3282
2752
  };
3283
2753
  };
3284
2754
 
3285
- const name$2 = 'symbol';
3286
- const getPlaceholder$2 = () => {
3287
- return '';
3288
- };
3289
- const getNoResults$2 = () => {
3290
- return {
3291
- label: noSymbolFound()
3292
- };
3293
- };
3294
- const getPicks$2 = async () => {
3295
- const picks = [];
3296
- return picks;
3297
- };
3298
- const getVisibleItems$4 = getVisibleItems$5;
3299
- const getFilterValue$2 = value => {
3300
- return value;
3301
- };
3302
- const state$2 = {};
3303
- const getPickDescription$3 = value => {
3304
- return '';
3305
- };
3306
- const isPrepared$2 = () => {
3307
- return false;
3308
- };
3309
- const getPickFilterValue$2 = value => {
3310
- return value;
3311
- };
3312
- const getPickLabel$3 = value => {
3313
- return value;
3314
- };
3315
- const getPickIcon$3 = value => {
3316
- return '';
2755
+ const selectPick$4 = item => {
2756
+ const {
2757
+ provider
2758
+ } = state$1;
2759
+ const fn = getSelect(provider);
2760
+ return fn(item);
3317
2761
  };
3318
2762
 
3319
- const QuickPickEntriesSymbol = {
3320
- __proto__: null,
3321
- getFilterValue: getFilterValue$2,
3322
- getNoResults: getNoResults$2,
3323
- getPickDescription: getPickDescription$3,
3324
- getPickFilterValue: getPickFilterValue$2,
3325
- getPickIcon: getPickIcon$3,
3326
- getPickLabel: getPickLabel$3,
3327
- getPicks: getPicks$2,
3328
- getPlaceholder: getPlaceholder$2,
3329
- getVisibleItems: getVisibleItems$4,
3330
- isPrepared: isPrepared$2,
3331
- name: name$2,
3332
- selectPick: selectPick$2,
3333
- state: state$2
3334
- };
3335
-
3336
- const getPickDescription$2 = () => {
3337
- return '';
3338
- };
3339
- const getPickIcon$2 = value => {
3340
- return '';
3341
- };
3342
- const getPickLabel$2 = value => {
3343
- return value;
3344
- };
3345
- const getVisibleItems$3 = picks => {
3346
- const visibleItems = picks.map((pick, index) => ({
3347
- description: getPickDescription$2(),
3348
- fileIcon: '',
3349
- icon: getPickIcon$2(),
3350
- label: getPickLabel$2(pick),
3351
- matches: []
3352
- }));
3353
- return visibleItems;
2763
+ const openUri = async uri => {
2764
+ await invoke$1(/* Main.openUri */'Main.openUri', /* uri */uri);
3354
2765
  };
3355
2766
 
3356
- const selectPick$1 = async item => {
3357
- // Command.execute(/* openView */ 549, /* viewName */ item.label)
3358
- // return {
3359
- // command: QuickPickReturnValue.Hide,
3360
- // }
2767
+ const selectPick$3 = async pick => {
2768
+ const description = pick.description;
2769
+ const fileName = pick.label;
2770
+ const workspace = await getWorkspacePath();
2771
+ const absolutePath = `${workspace}/${description}/${fileName}`;
2772
+ await openUri(absolutePath);
2773
+ return {
2774
+ command: Hide
2775
+ };
3361
2776
  };
3362
2777
 
3363
- // TODO probably not needed
3364
-
3365
- const getPlaceholder$1 = () => {
3366
- return typeNameofCommandToRun();
3367
- };
3368
- const getHelpEntries = () => {
3369
- return undefined;
3370
- };
3371
- const getPicks$1 = async () => {
3372
- // const views = ViewService.getViews()
3373
- // const picks = views.map(toPick)
3374
- // return picks
3375
- return [];
3376
- };
3377
- const getFilterValue$1 = value => {
3378
- return value;
3379
- };
3380
- const getPickFilterValue$1 = value => {
3381
- return value;
3382
- };
3383
- const getPickLabel$1 = value => {
3384
- return value;
3385
- };
3386
- const getPickIcon$1 = value => {
3387
- return '';
3388
- };
3389
- const state$1 = {};
3390
- const getNoResults$1 = () => {
3391
- return '';
3392
- };
3393
- const name$1 = '';
3394
- const isPrepared$1 = () => {
3395
- return true;
3396
- };
3397
- const getPickDescription$1 = () => {
3398
- return '';
2778
+ const openWorkspaceFolder = uri => {
2779
+ return invoke$1(/* Workspace.setPath */'Workspace.setPath', /* path */uri);
3399
2780
  };
3400
- const getVisibleItems$2 = getVisibleItems$3;
3401
2781
 
3402
- const QuickPickEntriesView = {
3403
- __proto__: null,
3404
- getFilterValue: getFilterValue$1,
3405
- getHelpEntries,
3406
- getNoResults: getNoResults$1,
3407
- getPickDescription: getPickDescription$1,
3408
- getPickFilterValue: getPickFilterValue$1,
3409
- getPickIcon: getPickIcon$1,
3410
- getPickLabel: getPickLabel$1,
3411
- getPicks: getPicks$1,
3412
- getPlaceholder: getPlaceholder$1,
3413
- getVisibleItems: getVisibleItems$2,
3414
- isPrepared: isPrepared$1,
3415
- name: name$1,
3416
- selectPick: selectPick$1,
3417
- state: state$1
3418
- };
3419
-
3420
- const getVisibleItems$1 = picks => {
3421
- const visibleItems = picks.map((pick, index) => ({
3422
- description: '',
3423
- fileIcon: '',
3424
- icon: '',
3425
- label: pick.label || '',
3426
- matches: []
3427
- }));
3428
- return visibleItems;
2782
+ // TODO selectPick should be independent of show/hide
2783
+ const selectPick$2 = async pick => {
2784
+ const path = `${pick.description}/${pick.label}`;
2785
+ await openWorkspaceFolder(path);
2786
+ return {
2787
+ command: Hide
2788
+ };
3429
2789
  };
3430
2790
 
3431
- const selectPick = async item => {
2791
+ const selectPick$1 = async item => {
3432
2792
  return {
3433
2793
  command: Hide
3434
2794
  };
3435
2795
  };
3436
2796
 
3437
- const name = 'workspace-symbol';
3438
- const getPlaceholder = () => {
3439
- return '';
3440
- };
3441
- const state = {};
3442
- const getPickIcon = () => {
3443
- return '';
3444
- };
3445
- const isPrepared = () => {
3446
- return false;
3447
- };
3448
- const getPickLabel = () => {
3449
- return '';
3450
- };
3451
- const getPickFilterValue = () => {
3452
- return '';
3453
- };
3454
- const getPickDescription = () => {
3455
- return '';
3456
- };
3457
- const getNoResults = () => {
2797
+ const selectPick = async item => {
3458
2798
  return {
3459
- label: noWorkspaceSymbolsFound()
2799
+ command: Hide
3460
2800
  };
3461
2801
  };
3462
- const getPicks = async () => {
3463
- const picks = [];
3464
- return picks;
3465
- };
3466
- const getFilterValue = value => {
3467
- return value;
3468
- };
3469
- const getVisibleItems = getVisibleItems$1;
3470
2802
 
3471
- const QuickPickEntriesWorkspaceSymbol = {
3472
- __proto__: null,
3473
- getFilterValue,
3474
- getNoResults,
3475
- getPickDescription,
3476
- getPickFilterValue,
3477
- getPickIcon,
3478
- getPickLabel,
3479
- getPicks,
3480
- getPlaceholder,
3481
- getVisibleItems,
3482
- isPrepared,
3483
- name,
3484
- selectPick,
3485
- state
3486
- };
3487
-
3488
- const quickPickEntriesModules = {
3489
- [ColorTheme]: QuickPickEntriesColorTheme,
3490
- [CommandPalette]: QuickPickEntriesEverything,
3491
- [Commands]: QuickPickEntriesCommand,
3492
- [Custom]: QuickPickEntriesCustom,
3493
- [EveryThing]: QuickPickEntriesEverything,
3494
- [File$2]: QuickPickEntriesFile,
3495
- [Recent]: QuickPickEntriesOpenRecent,
3496
- [Symbol]: QuickPickEntriesSymbol,
3497
- [View]: QuickPickEntriesView,
3498
- [WorkspaceSymbol]: QuickPickEntriesWorkspaceSymbol
2803
+ const selectPicks = {
2804
+ [ColorTheme]: selectPick$7,
2805
+ [CommandPalette]: selectPick$4,
2806
+ [Commands]: selectPick$6,
2807
+ [Custom]: selectPick$5,
2808
+ [EveryThing]: selectPick$4,
2809
+ [File$2]: selectPick$3,
2810
+ [Recent]: selectPick$2,
2811
+ [Symbol$1]: selectPick$1,
2812
+ [WorkspaceSymbol$1]: selectPick
2813
+ };
2814
+ const getPicks = {
2815
+ [ColorTheme]: getPicks$9,
2816
+ [CommandPalette]: getPicks$6,
2817
+ [Commands]: getPicks$8,
2818
+ [Custom]: getPicks$7,
2819
+ [EveryThing]: getPicks$6,
2820
+ [File$2]: getPicks$5,
2821
+ [Recent]: getPicks$4,
2822
+ [Symbol$1]: getPicks$3,
2823
+ [View$1]: getPicks$2,
2824
+ [WorkspaceSymbol$1]: getPicks$1
3499
2825
  };
3500
2826
 
3501
2827
  const Memfs = 'memfs';
@@ -3546,11 +2872,7 @@ const searchFile = async (path, value, prepare) => {
3546
2872
  };
3547
2873
  const stdout = await invoke('SearchFile.searchFile', options);
3548
2874
  const lines = splitLines(stdout);
3549
- if (!prepare) {
3550
- return lines;
3551
- }
3552
- const filtered = filterQuickPickItems(lines, value);
3553
- return filtered;
2875
+ return lines;
3554
2876
  };
3555
2877
 
3556
2878
  const searchModules = {
@@ -3563,7 +2885,8 @@ const searchModules = {
3563
2885
 
3564
2886
  const listen = async () => {
3565
2887
  register(searchModules);
3566
- register$1(quickPickEntriesModules);
2888
+ registerSelect(selectPicks);
2889
+ registerGetPick(getPicks);
3567
2890
  const rpc = await WebWorkerRpcClient.create({
3568
2891
  commandMap: commandMap
3569
2892
  });