@lvce-editor/file-search-worker 5.4.0 → 5.6.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.
@@ -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
 
@@ -1217,7 +913,7 @@ const create$2 = () => {
1217
913
  };
1218
914
 
1219
915
  const {
1220
- get,
916
+ get: get$1,
1221
917
  set,
1222
918
  remove
1223
919
  } = create$2();
@@ -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,
@@ -1372,7 +1066,7 @@ const diff2 = uid => {
1372
1066
  const {
1373
1067
  oldState,
1374
1068
  newState
1375
- } = get(uid);
1069
+ } = get$1(uid);
1376
1070
  return diff(oldState, newState);
1377
1071
  };
1378
1072
 
@@ -1380,24 +1074,18 @@ const dispose = uid => {
1380
1074
  remove(uid);
1381
1075
  };
1382
1076
 
1383
- const emptyDirent = {
1384
- name: '',
1385
- path: '',
1386
- type: 0
1387
- };
1388
-
1389
1077
  const getIconsCached = (paths, fileIconCache) => {
1390
1078
  return paths.map(path => fileIconCache[path]);
1391
1079
  };
1392
1080
 
1393
- const File$1 = 7;
1081
+ const File$2 = 7;
1394
1082
 
1395
1083
  const getMissingIconRequests = (dirents, fileIconCache) => {
1396
1084
  const missingRequests = [];
1397
1085
  for (const dirent of dirents) {
1398
1086
  if (!(dirent.path in fileIconCache)) {
1399
1087
  missingRequests.push({
1400
- type: File$1,
1088
+ type: File$2,
1401
1089
  name: dirent.name,
1402
1090
  path: dirent.path
1403
1091
  });
@@ -1411,7 +1099,7 @@ const requestFileIcons = async requests => {
1411
1099
  if (!request.name) {
1412
1100
  return '';
1413
1101
  }
1414
- return request.type === File$1 ? invoke$1('IconTheme.getFileIcon', {
1102
+ return request.type === File$2 ? invoke$1('IconTheme.getFileIcon', {
1415
1103
  name: request.name
1416
1104
  }) : invoke$1('IconTheme.getFolderIcon', {
1417
1105
  name: request.name
@@ -1437,7 +1125,11 @@ const updateIconCache = (iconCache, missingRequests, newIcons) => {
1437
1125
 
1438
1126
  const getQuickPickFileIcons = async (provider, items, fileIconCache) => {
1439
1127
  const dirents = items.map(item => {
1440
- const dirent = provider.getPickFileIcon?.(item) || emptyDirent;
1128
+ const dirent = {
1129
+ type: item.direntType,
1130
+ name: item.label,
1131
+ path: item.uri
1132
+ };
1441
1133
  return dirent;
1442
1134
  });
1443
1135
  const missingRequests = getMissingIconRequests(dirents, fileIconCache);
@@ -1451,20 +1143,42 @@ const getQuickPickFileIcons = async (provider, items, fileIconCache) => {
1451
1143
  };
1452
1144
  };
1453
1145
 
1146
+ const state$b = Object.create(null);
1147
+ const register$1 = modules => {
1148
+ Object.assign(state$b, modules);
1149
+ };
1150
+ const get = moduleId => {
1151
+ const module = state$b[moduleId];
1152
+ if (!module) {
1153
+ throw new Error(`unknown module "${moduleId}"`);
1154
+ }
1155
+ return module;
1156
+ };
1157
+ const getProperty = (moduleId, property) => {
1158
+ const m = get(moduleId);
1159
+ const fn = m[property];
1160
+ return fn;
1161
+ };
1162
+ const getPicks$b = id => {
1163
+ return getProperty(id, 'getPicks');
1164
+ };
1165
+
1454
1166
  const focusIndex = async (state, index) => {
1455
1167
  const {
1456
- provider,
1168
+ uri,
1457
1169
  maxVisibleItems,
1458
1170
  items,
1459
1171
  minLineY,
1460
1172
  maxLineY,
1461
1173
  fileIconCache
1462
1174
  } = state;
1175
+ const provider = get(uri);
1176
+
1463
1177
  // TODO get types working
1464
1178
  // @ts-ignore
1465
1179
  if (provider.focusPick) {
1466
1180
  // @ts-ignore
1467
- await provider.focusPick(items[index].pick);
1181
+ await provider.focusPick(items[index]);
1468
1182
  }
1469
1183
  if (index < minLineY + 1) {
1470
1184
  const minLineY = index;
@@ -1751,15 +1465,6 @@ const getNewValue = (value, inputType, data, selectionStart, selectionEnd) => {
1751
1465
  return fn(value, selectionStart, selectionEnd, data);
1752
1466
  };
1753
1467
 
1754
- const emptyMatches = [];
1755
-
1756
- const convertToPick = item => {
1757
- return {
1758
- pick: item,
1759
- matches: emptyMatches
1760
- };
1761
- };
1762
-
1763
1468
  const Diagonal = 1;
1764
1469
  const Left = 2;
1765
1470
 
@@ -1919,38 +1624,17 @@ const filterQuickPickItem = (pattern, word) => {
1919
1624
  return matches;
1920
1625
  };
1921
1626
 
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) => {
1627
+ const filterQuickPickItems = (items, value) => {
1938
1628
  if (!value) {
1939
- return items.map(convertToPick);
1629
+ return items;
1940
1630
  }
1941
1631
  const results = [];
1942
1632
  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
- }
1633
+ const filterValue = item.label;
1950
1634
  const matches = filterQuickPickItem(value, filterValue);
1951
1635
  if (matches.length > 0) {
1952
1636
  results.push({
1953
- pick: item,
1637
+ ...item,
1954
1638
  matches
1955
1639
  });
1956
1640
  }
@@ -1958,11 +1642,16 @@ const filterQuickPickItems = (items, value, provider) => {
1958
1642
  return results;
1959
1643
  };
1960
1644
 
1645
+ const getPicks$a = (id, searchValue) => {
1646
+ const fn = getPicks$b(id);
1647
+ return fn(searchValue);
1648
+ };
1649
+
1961
1650
  // TODO when user types letters -> no need to query provider again -> just filter existing results
1962
1651
  const setValue = async (state, newValue) => {
1963
1652
  const {
1964
1653
  value,
1965
- provider,
1654
+ uri,
1966
1655
  minLineY,
1967
1656
  maxLineY,
1968
1657
  fileIconCache
@@ -1970,9 +1659,11 @@ const setValue = async (state, newValue) => {
1970
1659
  if (value === newValue) {
1971
1660
  return state;
1972
1661
  }
1973
- const newPicks = await provider.getPicks(newValue);
1662
+ const provider = get(uri);
1663
+ const newPicks = await getPicks$a(uri, newValue);
1664
+ // @ts-ignore
1974
1665
  const filterValue = provider.getFilterValue(newValue);
1975
- const items = filterQuickPickItems(newPicks, filterValue, provider);
1666
+ const items = filterQuickPickItems(newPicks, filterValue);
1976
1667
  const focusedIndex = items.length === 0 ? -1 : 0;
1977
1668
  const sliced = newPicks.slice(minLineY, maxLineY);
1978
1669
  const {
@@ -2032,19 +1723,27 @@ const getPick = (items, index) => {
2032
1723
  // }
2033
1724
  // index -= state.recentPicks.length
2034
1725
  if (index < items.length) {
2035
- return items[index].pick;
1726
+ return items[index];
2036
1727
  }
2037
1728
  console.warn('no pick matching index', index);
1729
+ return undefined;
2038
1730
  };
2039
1731
 
1732
+ const Hide = 'hide';
1733
+ const KeepOpen = '';
1734
+
2040
1735
  const selectIndex = async (state, index, button = /* left */0) => {
2041
1736
  const {
2042
1737
  minLineY,
2043
- provider,
1738
+ uri,
2044
1739
  items
2045
1740
  } = state;
1741
+ const provider = get(uri);
2046
1742
  const actualIndex = index + minLineY;
2047
1743
  const pick = getPick(items, actualIndex);
1744
+ if (!pick) {
1745
+ return state;
1746
+ }
2048
1747
  // @ts-ignore
2049
1748
  const selectPickResult = await provider.selectPick(pick, actualIndex, button);
2050
1749
  object(selectPickResult);
@@ -2109,16 +1808,17 @@ const loadContent = async state => {
2109
1808
  fileIconCache
2110
1809
  } = state;
2111
1810
  const value = getDefaultValue(uri);
2112
- const provider = get$1(uri);
1811
+ const provider = get(uri);
2113
1812
  // @ts-ignore
2114
1813
  if (provider.setArgs) {
2115
1814
  // @ts-ignore
2116
1815
  provider.setArgs(args);
2117
1816
  }
2118
- const newPicks = await provider.getPicks(value);
1817
+ const newPicks = await getPicks$a(uri, value);
2119
1818
  array(newPicks);
1819
+ // @ts-ignore
2120
1820
  const filterValue = provider.getFilterValue(value);
2121
- const items = filterQuickPickItems(newPicks, filterValue, provider);
1821
+ const items = filterQuickPickItems(newPicks, filterValue);
2122
1822
  const minLineY = 0;
2123
1823
  const maxLineY = Math.min(minLineY + state.maxVisibleItems, newPicks.length);
2124
1824
  const sliced = newPicks.slice(minLineY, maxLineY);
@@ -2136,7 +1836,6 @@ const loadContent = async state => {
2136
1836
  maxLineY,
2137
1837
  value,
2138
1838
  cursorOffset: value.length,
2139
- provider,
2140
1839
  inputSource: Script,
2141
1840
  focused: true,
2142
1841
  fileIconCache: newFileIconCache,
@@ -2144,19 +1843,24 @@ const loadContent = async state => {
2144
1843
  };
2145
1844
  };
2146
1845
 
2147
- const state$9 = {
1846
+ const state$a = {
2148
1847
  menuEntries: []
2149
1848
  };
2150
1849
  const getAll = () => {
2151
- return state$9.menuEntries;
1850
+ return state$a.menuEntries;
2152
1851
  };
2153
1852
  const add = menuEntries => {
2154
- state$9.menuEntries = [...state$9.menuEntries, ...menuEntries];
1853
+ state$a.menuEntries = [...state$a.menuEntries, ...menuEntries];
2155
1854
  };
2156
1855
 
2157
- const getVisible$1 = (provider, items, minLineY, maxLineY, icons) => {
1856
+ const getVisible$1 = (items, minLineY, maxLineY, icons) => {
2158
1857
  const range = items.slice(minLineY, maxLineY);
2159
- const protoVisibleItems = provider.getVisibleItems(range, icons);
1858
+ const protoVisibleItems = range.map((item, index) => {
1859
+ return {
1860
+ ...item,
1861
+ fileIcon: icons[index]
1862
+ };
1863
+ });
2160
1864
  return protoVisibleItems;
2161
1865
  };
2162
1866
 
@@ -2173,7 +1877,7 @@ const getVisible = (setSize, protoVisibleItems, minLineY, focusedIndex) => {
2173
1877
  };
2174
1878
 
2175
1879
  const createQuickPickViewModel = (oldState, newState) => {
2176
- const protoVisibleItems = getVisible$1(newState.provider, newState.items, newState.minLineY, newState.maxLineY, newState.icons);
1880
+ const protoVisibleItems = getVisible$1(newState.items, newState.minLineY, newState.maxLineY, newState.icons);
2177
1881
  const visibleItems = getVisible(newState.items.length, protoVisibleItems, newState.minLineY, newState.focusedIndex);
2178
1882
  const oldFocusedIndex = oldState.focusedIndex - oldState.minLineY;
2179
1883
  const newFocusedIndex = newState.focusedIndex - newState.minLineY;
@@ -2200,52 +1904,116 @@ const SetValue = 'setValue';
2200
1904
  const renderCursorOffset = newState => {
2201
1905
  return ['Viewlet.send', newState.uid, /* method */SetCursorOffset, /* cursorOffset */newState.cursorOffset];
2202
1906
  };
2203
-
2204
- const QuickPickInput = 'QuickPickInput';
2205
-
2206
- const renderFocus = newState => {
2207
- return ['Viewlet.focusElementByName', QuickPickInput];
1907
+
1908
+ const QuickPickInput = 'QuickPickInput';
1909
+
1910
+ const renderFocus = newState => {
1911
+ return ['Viewlet.focusElementByName', QuickPickInput];
1912
+ };
1913
+
1914
+ const renderFocusedIndex = newState => {
1915
+ return ['Viewlet.send', newState.uid, /* method */SetFocusedIndex, /* oldFocusedIndex */newState.oldFocusedIndex, /* newFocusedIndex */newState.newFocusedIndex];
1916
+ };
1917
+
1918
+ const renderHeight = newState => {
1919
+ if (newState.height === 0) {
1920
+ return ['Viewlet.send', newState.uid, /* method */SetItemsHeight, /* height */20];
1921
+ }
1922
+ return ['Viewlet.send', newState.uid, /* method */SetItemsHeight, /* height */newState.height];
1923
+ };
1924
+
1925
+ const ComboBox = 'combobox';
1926
+ const ListBox = 'listbox';
1927
+ const None$2 = 'none';
1928
+ const Option = 'option';
1929
+
1930
+ const FileIcon = 'FileIcon';
1931
+ const InputBox = 'InputBox';
1932
+ const Label = 'Label';
1933
+ const QuickPick$1 = 'QuickPick';
1934
+ const QuickPickHeader = 'QuickPickHeader';
1935
+ const QuickPickHighlight = 'QuickPickHighlight';
1936
+ const QuickPickItem = 'QuickPickItem';
1937
+ const QuickPickItemActive$1 = 'QuickPickItemActive';
1938
+ const QuickPickItemDescription = 'QuickPickItemDescription';
1939
+ const QuickPickItemLabel = 'QuickPickItemLabel';
1940
+ const QuickPickMaskIcon = 'QuickPickMaskIcon';
1941
+ const QuickPickItems$1 = 'QuickPickItems';
1942
+ const MaskIcon = 'MaskIcon';
1943
+ const Viewlet = 'Viewlet';
1944
+
1945
+ const HandleBeforeInput = 'handleBeforeInput';
1946
+ const HandleBlur = 'handleBlur';
1947
+ const HandleFocus = 'handleFocus';
1948
+ const HandleInput = 'handleInput';
1949
+ const HandlePointerDown = 'handlePointerDown';
1950
+ const HandleWheel = 'handleWheel';
1951
+
1952
+ const QuickPick = 'QuickPick';
1953
+ const QuickPickItems = 'QuickPickItems';
1954
+ const QuickPickItemActive = 'QuickPickItemActive';
1955
+
1956
+ const emptyObject = {};
1957
+ const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
1958
+ const i18nString = (key, placeholders = emptyObject) => {
1959
+ if (placeholders === emptyObject) {
1960
+ return key;
1961
+ }
1962
+ const replacer = (match, rest) => {
1963
+ return placeholders[rest];
1964
+ };
1965
+ return key.replaceAll(RE_PLACEHOLDER, replacer);
1966
+ };
1967
+
1968
+ const Files = 'Files';
1969
+ const NoMatchingColorThemesFound = 'No matching color themes found';
1970
+ const NoMatchingResults = 'No matching results';
1971
+ const NoRecentlyOpenedFoldersFound = 'No recently opened folders found';
1972
+ const NoResults = 'No Results';
1973
+ const NoSymbolFound = 'No symbol found';
1974
+ const NoWorkspaceSymbolsFound = 'no workspace symbols found';
1975
+ const OpenRecent = 'Open Recent';
1976
+ const SelectColorTheme = 'Select Color Theme';
1977
+ const SelectToOpen = 'Select to open';
1978
+ const TypeNameOfCommandToRun = 'Type the name of a command to run.';
1979
+ const QuickOpen = 'Quick open';
1980
+
1981
+ const noMatchingColorThemesFound = () => {
1982
+ return i18nString(NoMatchingColorThemesFound);
1983
+ };
1984
+ const selectColorTheme = () => {
1985
+ return i18nString(SelectColorTheme);
1986
+ };
1987
+ const typeNameofCommandToRun = () => {
1988
+ return i18nString(TypeNameOfCommandToRun);
1989
+ };
1990
+ const noMatchingResults = () => {
1991
+ return i18nString(NoMatchingResults);
1992
+ };
1993
+ const files = () => {
1994
+ return i18nString(Files);
1995
+ };
1996
+ const noResults = () => {
1997
+ return i18nString(NoResults);
1998
+ };
1999
+ const selectToOpen = () => {
2000
+ return i18nString(SelectToOpen);
2001
+ };
2002
+ const openRecent = () => {
2003
+ return i18nString(OpenRecent);
2208
2004
  };
2209
-
2210
- const renderFocusedIndex = newState => {
2211
- return ['Viewlet.send', newState.uid, /* method */SetFocusedIndex, /* oldFocusedIndex */newState.oldFocusedIndex, /* newFocusedIndex */newState.newFocusedIndex];
2005
+ const noRecentlyOpenedFoldersFound = () => {
2006
+ return i18nString(NoRecentlyOpenedFoldersFound);
2212
2007
  };
2213
-
2214
- const renderHeight = newState => {
2215
- if (newState.height === 0) {
2216
- return ['Viewlet.send', newState.uid, /* method */SetItemsHeight, /* height */20];
2217
- }
2218
- return ['Viewlet.send', newState.uid, /* method */SetItemsHeight, /* height */newState.height];
2008
+ const noSymbolFound = () => {
2009
+ return i18nString(NoSymbolFound);
2010
+ };
2011
+ const noWorkspaceSymbolsFound = () => {
2012
+ return i18nString(NoWorkspaceSymbolsFound);
2013
+ };
2014
+ const quickOpen = () => {
2015
+ return i18nString(QuickOpen);
2219
2016
  };
2220
-
2221
- const ComboBox = 'combobox';
2222
- const ListBox = 'listbox';
2223
- const None$1 = 'none';
2224
- const Option = 'option';
2225
-
2226
- const FileIcon = 'FileIcon';
2227
- const InputBox = 'InputBox';
2228
- const Label = 'Label';
2229
- const QuickPick$1 = 'QuickPick';
2230
- const QuickPickHeader = 'QuickPickHeader';
2231
- const QuickPickHighlight = 'QuickPickHighlight';
2232
- const QuickPickItem = 'QuickPickItem';
2233
- const QuickPickItemActive$1 = 'QuickPickItemActive';
2234
- const QuickPickItemDescription = 'QuickPickItemDescription';
2235
- const QuickPickItemLabel = 'QuickPickItemLabel';
2236
- const QuickPickItems$1 = 'QuickPickItems';
2237
- const Viewlet = 'Viewlet';
2238
-
2239
- const HandleBeforeInput = 'handleBeforeInput';
2240
- const HandleBlur = 'handleBlur';
2241
- const HandleFocus = 'handleFocus';
2242
- const HandleInput = 'handleInput';
2243
- const HandlePointerDown = 'handlePointerDown';
2244
- const HandleWheel = 'handleWheel';
2245
-
2246
- const QuickPick = 'QuickPick';
2247
- const QuickPickItems = 'QuickPickItems';
2248
- const QuickPickItemActive = 'QuickPickItemActive';
2249
2017
 
2250
2018
  const Div = 4;
2251
2019
  const Input = 6;
@@ -2282,6 +2050,41 @@ const getQuickPickHeaderVirtualDom = () => {
2282
2050
  }, getQuickPickInputVirtualDom()];
2283
2051
  };
2284
2052
 
2053
+ const emptyHighlightSections = [];
2054
+
2055
+ const getHighlightSections = (highlights, label) => {
2056
+ if (highlights.length === 0) {
2057
+ return emptyHighlightSections;
2058
+ }
2059
+ const sections = [];
2060
+ let position = 0;
2061
+ for (let i = 0; i < highlights.length; i += 2) {
2062
+ const highlightStart = highlights[i];
2063
+ const highlightEnd = highlights[i + 1];
2064
+ if (position < highlightStart) {
2065
+ const beforeText = label.slice(position, highlightStart);
2066
+ sections.push({
2067
+ highlighted: false,
2068
+ text: beforeText
2069
+ });
2070
+ }
2071
+ const highlightText = label.slice(highlightStart, highlightEnd);
2072
+ sections.push({
2073
+ highlighted: true,
2074
+ text: highlightText
2075
+ });
2076
+ position = highlightEnd;
2077
+ }
2078
+ if (position < label.length) {
2079
+ const afterText = label.slice(position);
2080
+ sections.push({
2081
+ highlighted: false,
2082
+ text: afterText
2083
+ });
2084
+ }
2085
+ return sections;
2086
+ };
2087
+
2285
2088
  const mergeClassNames = (...classNames) => {
2286
2089
  return classNames.filter(Boolean).join(' ');
2287
2090
  };
@@ -2299,32 +2102,34 @@ const quickPickHighlight = {
2299
2102
  className: QuickPickHighlight,
2300
2103
  childCount: 1
2301
2104
  };
2302
- const addHighlights = (dom, highlights, label) => {
2105
+ const getHighlights = (highlights, label) => {
2303
2106
  const labelDom = {
2304
2107
  type: Div,
2305
2108
  className: QuickPickItemLabel,
2306
2109
  childCount: 0
2307
2110
  };
2308
- dom.push(labelDom);
2309
- let position = 0;
2310
- for (let i = 0; i < highlights.length; i += 2) {
2311
- const highlightStart = highlights[i];
2312
- const highlightEnd = highlights[i + 1];
2313
- if (position < highlightStart) {
2314
- const beforeText = label.slice(position, highlightStart);
2315
- labelDom.childCount++;
2316
- dom.push(text(beforeText));
2317
- }
2318
- const highlightText = label.slice(highlightStart, highlightEnd);
2319
- labelDom.childCount++;
2320
- dom.push(quickPickHighlight, text(highlightText));
2321
- position = highlightEnd;
2322
- }
2323
- if (position < label.length) {
2324
- const afterText = label.slice(position);
2111
+ const nodes = [labelDom];
2112
+ const sections = getHighlightSections(highlights, label);
2113
+ if (sections.length === 0) {
2325
2114
  labelDom.childCount++;
2326
- dom.push(text(afterText));
2115
+ nodes.push(text(label));
2116
+ } else {
2117
+ for (const section of sections) {
2118
+ if (section.highlighted) {
2119
+ labelDom.childCount++;
2120
+ nodes.push(quickPickHighlight, text(section.text));
2121
+ } else {
2122
+ labelDom.childCount++;
2123
+ nodes.push(text(section.text));
2124
+ }
2125
+ }
2327
2126
  }
2127
+ return nodes;
2128
+ };
2129
+
2130
+ const addHighlights = (dom, highlights, label) => {
2131
+ const domHighlights = getHighlights(highlights, label);
2132
+ dom.push(...domHighlights);
2328
2133
  };
2329
2134
 
2330
2135
  const getFileIconVirtualDom = icon => {
@@ -2332,7 +2137,7 @@ const getFileIconVirtualDom = icon => {
2332
2137
  type: Img,
2333
2138
  className: FileIcon,
2334
2139
  src: icon,
2335
- role: None$1,
2140
+ role: None$2,
2336
2141
  childCount: 0
2337
2142
  };
2338
2143
  };
@@ -2361,7 +2166,7 @@ const getQuickPickItemVirtualDom = visibleItem => {
2361
2166
  const parent = dom[0];
2362
2167
  if (isActive) {
2363
2168
  // @ts-ignore
2364
- parent.id = 'QuickPickItemActive';
2169
+ parent.id = QuickPickItemActive;
2365
2170
  parent.className += ' ' + QuickPickItemActive$1;
2366
2171
  }
2367
2172
  if (fileIcon) {
@@ -2371,7 +2176,7 @@ const getQuickPickItemVirtualDom = visibleItem => {
2371
2176
  parent.childCount++;
2372
2177
  dom.push({
2373
2178
  type: Div,
2374
- className: mergeClassNames(`QuickPickMaskIcon`, 'MaskIcon', `MaskIcon${icon}`),
2179
+ className: mergeClassNames(QuickPickMaskIcon, MaskIcon, `MaskIcon${icon}`),
2375
2180
  childCount: 0
2376
2181
  });
2377
2182
  }
@@ -2475,7 +2280,7 @@ const render2 = (uid, diffResult) => {
2475
2280
  const {
2476
2281
  oldState,
2477
2282
  newState
2478
- } = get(uid);
2283
+ } = get$1(uid);
2479
2284
  if (oldState === newState) {
2480
2285
  return [];
2481
2286
  }
@@ -2513,7 +2318,7 @@ const selectCurrentIndex = state => {
2513
2318
 
2514
2319
  const findLabelIndex = (items, label) => {
2515
2320
  for (let i = 0; i < items.length; i++) {
2516
- if (items[i].pick.label === label) {
2321
+ if (items[i].label === label) {
2517
2322
  return i;
2518
2323
  }
2519
2324
  }
@@ -2533,12 +2338,12 @@ const wrapCommand = fn => {
2533
2338
  const wrapped = async (uid, ...args) => {
2534
2339
  const {
2535
2340
  newState
2536
- } = get(uid);
2341
+ } = get$1(uid);
2537
2342
  const newerState = await fn(newState, ...args);
2538
2343
  if (newState === newerState) {
2539
2344
  return;
2540
2345
  }
2541
- const latest = get(uid);
2346
+ const latest = get$1(uid);
2542
2347
  set(uid, latest.oldState, newerState);
2543
2348
  };
2544
2349
  return wrapped;
@@ -2572,84 +2377,158 @@ const commandMap = {
2572
2377
  'QuickPick.setDeltaY': wrapCommand(setDeltaY),
2573
2378
  'QuickPick.setValue': wrapCommand(setValue),
2574
2379
  // deprecated
2575
- 'QuickPick.loadEntries2': get$1
2380
+ 'QuickPick.loadEntries2': get
2576
2381
  };
2577
2382
 
2578
2383
  const getColorThemeNames = async () => {
2579
2384
  return invoke$1(/* Ajax.getJson */'ColorTheme.getColorThemeNames');
2580
2385
  };
2581
2386
 
2582
- const getPickDescription$c = value => {
2583
- return '';
2387
+ const toProtoVisibleItem$1 = name => {
2388
+ const pick = {
2389
+ label: name,
2390
+ description: '',
2391
+ fileIcon: '',
2392
+ icon: '',
2393
+ matches: [],
2394
+ direntType: 0,
2395
+ uri: ''
2396
+ };
2397
+ return pick;
2398
+ };
2399
+ const getPicks$9 = async searchValue => {
2400
+ const colorThemeNames = await getColorThemeNames();
2401
+ const picks = colorThemeNames.map(toProtoVisibleItem$1);
2402
+ return picks;
2403
+ };
2404
+
2405
+ const emptyMatches = [];
2406
+
2407
+ const getWorkspacePath = async () => {
2408
+ return invoke$1('Workspace.getPath');
2584
2409
  };
2585
- const getPickIcon$d = pick => {
2410
+
2411
+ const RE_PROTOCOL = /^([a-z-]+):\/\//;
2412
+ const getProtocol = uri => {
2413
+ const protocolMatch = uri.match(RE_PROTOCOL);
2414
+ if (protocolMatch) {
2415
+ return protocolMatch[1];
2416
+ }
2586
2417
  return '';
2587
2418
  };
2588
- const getPickLabel$d = pick => {
2589
- return pick;
2419
+
2420
+ const state$9 = Object.create(null);
2421
+ const register = modules => {
2422
+ Object.assign(state$9, modules);
2590
2423
  };
2591
- const getVisibleItems$f = (picks, icons) => {
2592
- const visibleItems = picks.map((item, index) => {
2593
- const pick = item.pick;
2594
- return {
2595
- description: getPickDescription$c(),
2596
- fileIcon: '',
2597
- icon: getPickIcon$d(),
2598
- label: getPickLabel$d(pick),
2599
- matches: []
2600
- };
2601
- });
2602
- return visibleItems;
2424
+ const getModule = protocol => {
2425
+ return state$9[protocol];
2603
2426
  };
2604
2427
 
2605
- const setColorTheme = id => {
2606
- return invoke$1(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
2428
+ const searchFile$5 = async (path, value, prepare, assetDir) => {
2429
+ const protocol = getProtocol(path);
2430
+ // TODO call different providers depending on protocol
2431
+ const fn = getModule(protocol);
2432
+ const result = await fn(path, value, prepare, assetDir);
2433
+ return result;
2607
2434
  };
2608
- const getPlaceholder$7 = () => {
2609
- return selectColorTheme();
2435
+
2436
+ // TODO this should be in FileSystem module
2437
+ const pathBaseName = path => {
2438
+ return path.slice(path.lastIndexOf('/') + 1);
2610
2439
  };
2611
- const getLabel$4 = () => {
2612
- return selectColorTheme();
2440
+
2441
+ // TODO this should be in FileSystem module
2442
+ const pathDirName = path => {
2443
+ const pathSeparator = '/';
2444
+ const index = path.lastIndexOf(pathSeparator);
2445
+ if (index === -1) {
2446
+ return '';
2447
+ }
2448
+ return path.slice(0, index);
2613
2449
  };
2614
- const getPicks$7 = async searchValue => {
2615
- const colorThemeNames = await getColorThemeNames();
2616
- return colorThemeNames;
2450
+
2451
+ const searchFile$4 = async (path, value) => {
2452
+ const prepare = true;
2453
+ const files = await searchFile$5(/* path */path, /* searchTerm */value, prepare, '');
2454
+ return files;
2617
2455
  };
2618
- const getVisibleItems$e = getVisibleItems$f;
2619
- const selectPick$7 = async pick => {
2620
- await setColorTheme(/* colorThemeId */pick);
2456
+ const convertToPick = uri => {
2457
+ const baseName = pathBaseName(uri);
2458
+ const dirName = pathDirName(uri);
2459
+ return {
2460
+ description: dirName,
2461
+ direntType: File$2,
2462
+ fileIcon: '',
2463
+ icon: '',
2464
+ label: baseName,
2465
+ matches: emptyMatches,
2466
+ uri
2467
+ };
2468
+ };
2469
+
2470
+ // TODO handle files differently
2471
+ // e.g. when there are many files, don't need
2472
+ // to compute the fileIcon for all files
2473
+
2474
+ const getPicks$8 = async searchValue => {
2475
+ // TODO cache workspace path
2476
+ const workspace = await getWorkspacePath();
2477
+ if (!workspace) {
2478
+ return [];
2479
+ }
2480
+ const files = await searchFile$4(workspace, searchValue);
2481
+ const picks = files.map(convertToPick);
2482
+ return picks;
2483
+ };
2484
+
2485
+ const setColorTheme = id => {
2486
+ return invoke$1(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
2487
+ };
2488
+
2489
+ const selectPick$9 = async pick => {
2490
+ const id = pick.label;
2491
+ await setColorTheme(/* colorThemeId */id);
2621
2492
  return {
2622
2493
  command: Hide
2623
2494
  };
2624
2495
  };
2496
+
2625
2497
  const focusPick = async pick => {
2626
2498
  await setColorTheme(/* colorThemeId */pick);
2627
2499
  };
2628
- const getFilterValue$7 = value => {
2500
+
2501
+ const getPlaceholder$9 = () => {
2502
+ return selectColorTheme();
2503
+ };
2504
+ const getLabel$5 = () => {
2505
+ return selectColorTheme();
2506
+ };
2507
+ const getFilterValue$9 = value => {
2629
2508
  return value;
2630
2509
  };
2631
- const getNoResults$7 = () => {
2510
+ const getNoResults$9 = () => {
2632
2511
  return {
2633
2512
  label: noMatchingColorThemesFound()
2634
2513
  };
2635
2514
  };
2636
- const getPickFilterValue$7 = pick => {
2515
+ const getPickFilterValue$9 = pick => {
2637
2516
  return pick;
2638
2517
  };
2639
- const getPickLabel$c = pick => {
2518
+ const getPickLabel$8 = pick => {
2640
2519
  return pick;
2641
2520
  };
2642
- const getPickIcon$c = pick => {
2521
+ const getPickIcon$8 = pick => {
2643
2522
  return '';
2644
2523
  };
2645
2524
  const state$8 = {};
2646
- const getPickDescription$b = value => {
2525
+ const getPickDescription$8 = value => {
2647
2526
  return '';
2648
2527
  };
2649
- const isPrepared$7 = () => {
2528
+ const isPrepared$8 = () => {
2650
2529
  return false;
2651
2530
  };
2652
- const name$7 = '';
2531
+ const name$9 = '';
2653
2532
  const getHelpEntries$2 = () => {
2654
2533
  return [];
2655
2534
  };
@@ -2657,21 +2536,19 @@ const getHelpEntries$2 = () => {
2657
2536
  const QuickPickEntriesColorTheme = {
2658
2537
  __proto__: null,
2659
2538
  focusPick,
2660
- getFilterValue: getFilterValue$7,
2539
+ getFilterValue: getFilterValue$9,
2661
2540
  getHelpEntries: getHelpEntries$2,
2662
- getLabel: getLabel$4,
2663
- getNoResults: getNoResults$7,
2664
- getPickDescription: getPickDescription$b,
2665
- getPickFilterValue: getPickFilterValue$7,
2666
- getPickIcon: getPickIcon$c,
2667
- getPickLabel: getPickLabel$c,
2668
- getPicks: getPicks$7,
2669
- getPlaceholder: getPlaceholder$7,
2670
- getVisibleItems: getVisibleItems$e,
2671
- isPrepared: isPrepared$7,
2672
- name: name$7,
2673
- selectPick: selectPick$7,
2674
- setColorTheme,
2541
+ getLabel: getLabel$5,
2542
+ getNoResults: getNoResults$9,
2543
+ getPickDescription: getPickDescription$8,
2544
+ getPickFilterValue: getPickFilterValue$9,
2545
+ getPickIcon: getPickIcon$8,
2546
+ getPickLabel: getPickLabel$8,
2547
+ getPicks: getPicks$9,
2548
+ getPlaceholder: getPlaceholder$9,
2549
+ isPrepared: isPrepared$8,
2550
+ name: name$9,
2551
+ selectPick: selectPick$9,
2675
2552
  state: state$8
2676
2553
  };
2677
2554
 
@@ -2695,46 +2572,6 @@ const warn = (...args) => {
2695
2572
  console.warn(...args);
2696
2573
  };
2697
2574
 
2698
- const getPickIcon$b = () => {
2699
- return '';
2700
- };
2701
- const getPickLabel$b = pick => {
2702
- return pick.label;
2703
- };
2704
- const getVisibleItems$d = (picks, icons) => {
2705
- const visibleItems = picks.map((item, index) => {
2706
- const pick = item;
2707
- return {
2708
- description: pick.description || '',
2709
- fileIcon: '',
2710
- icon: getPickIcon$b(),
2711
- label: getPickLabel$b(pick),
2712
- matches: []
2713
- };
2714
- });
2715
- return visibleItems;
2716
- };
2717
-
2718
- const name$6 = 'command';
2719
- const state$7 = {};
2720
- const isPrepared$6 = () => {
2721
- return false;
2722
- };
2723
- const getPickDescription$a = () => {
2724
- return '';
2725
- };
2726
- const getPlaceholder$6 = () => {
2727
- return typeNameofCommandToRun();
2728
- };
2729
- const getLabel$3 = () => {
2730
- return '';
2731
- };
2732
- const getNoResults$6 = () => {
2733
- return {
2734
- label: noMatchingResults()
2735
- };
2736
- };
2737
-
2738
2575
  // TODO combine Ajax with cache (specify strategy: cacheFirst, networkFirst)
2739
2576
  const getBuiltinPicks = async () => {
2740
2577
  const builtinPicks = getAll();
@@ -2767,16 +2604,27 @@ const getExtensionPicks = async () => {
2767
2604
  return [];
2768
2605
  }
2769
2606
  };
2770
-
2771
- // TODO send strings to renderer process only once for next occurrence send uint16array of ids of strings
2772
-
2773
- const getPicks$6 = async () => {
2607
+ const toProtoVisibleItem = item => {
2608
+ const pick = {
2609
+ // @ts-ignore
2610
+ id: item.id,
2611
+ label: item.label,
2612
+ description: '',
2613
+ fileIcon: '',
2614
+ icon: '',
2615
+ matches: []
2616
+ };
2617
+ return pick;
2618
+ };
2619
+ const getPicks$7 = async () => {
2620
+ // TODO get picks in parallel
2774
2621
  const builtinPicks = await getBuiltinPicks();
2775
2622
  const extensionPicks = await getExtensionPicks();
2776
2623
  const allPicks = [...builtinPicks, ...extensionPicks];
2777
- return allPicks;
2624
+ const converted = allPicks.map(toProtoVisibleItem);
2625
+ return converted;
2778
2626
  };
2779
- const getVisibleItems$c = getVisibleItems$d;
2627
+
2780
2628
  const shouldHide = item => {
2781
2629
  if (item.id === 'Viewlet.openWidget' && item.args[0] === 'QuickPick') {
2782
2630
  return false;
@@ -2808,59 +2656,125 @@ const selectPickExtension = async item => {
2808
2656
  command: Hide
2809
2657
  };
2810
2658
  };
2811
- const selectPick$6 = async item => {
2812
- if (item.id.startsWith('ext.')) {
2659
+ const selectPick$8 = async item => {
2660
+ // @ts-ignore
2661
+ const id = item.id;
2662
+ if (id.startsWith('ext.')) {
2813
2663
  return selectPickExtension(item);
2814
2664
  }
2815
2665
  return selectPickBuiltin(item);
2816
2666
  };
2817
- const getFilterValue$6 = value => {
2667
+
2668
+ const name$8 = 'command';
2669
+ const state$7 = {};
2670
+ const isPrepared$7 = () => {
2671
+ return false;
2672
+ };
2673
+ const getPickDescription$7 = () => {
2674
+ return '';
2675
+ };
2676
+ const getPlaceholder$8 = () => {
2677
+ return typeNameofCommandToRun();
2678
+ };
2679
+ const getLabel$4 = () => {
2680
+ return '';
2681
+ };
2682
+ const getNoResults$8 = () => {
2683
+ return {
2684
+ label: noMatchingResults()
2685
+ };
2686
+ };
2687
+ const getFilterValue$8 = value => {
2818
2688
  return value.trim();
2819
2689
  };
2820
- const getPickFilterValue$6 = pick => {
2690
+ const getPickFilterValue$8 = pick => {
2821
2691
  return pick.label;
2822
2692
  };
2823
- const getPickLabel$a = pick => {
2693
+ const getPickLabel$7 = pick => {
2824
2694
  return pick.label;
2825
2695
  };
2826
- const getPickIcon$a = () => {
2696
+ const getPickIcon$7 = () => {
2827
2697
  return '';
2828
2698
  };
2829
2699
 
2830
2700
  const QuickPickEntriesCommand = {
2831
2701
  __proto__: null,
2832
- getFilterValue: getFilterValue$6,
2833
- getLabel: getLabel$3,
2834
- getNoResults: getNoResults$6,
2835
- getPickDescription: getPickDescription$a,
2836
- getPickFilterValue: getPickFilterValue$6,
2837
- getPickIcon: getPickIcon$a,
2838
- getPickLabel: getPickLabel$a,
2839
- getPicks: getPicks$6,
2840
- getPlaceholder: getPlaceholder$6,
2841
- getVisibleItems: getVisibleItems$c,
2842
- isPrepared: isPrepared$6,
2843
- name: name$6,
2844
- selectPick: selectPick$6,
2702
+ getFilterValue: getFilterValue$8,
2703
+ getLabel: getLabel$4,
2704
+ getNoResults: getNoResults$8,
2705
+ getPickDescription: getPickDescription$7,
2706
+ getPickFilterValue: getPickFilterValue$8,
2707
+ getPickIcon: getPickIcon$7,
2708
+ getPickLabel: getPickLabel$7,
2709
+ getPicks: getPicks$7,
2710
+ getPlaceholder: getPlaceholder$8,
2711
+ isPrepared: isPrepared$7,
2712
+ name: name$8,
2713
+ selectPick: selectPick$8,
2845
2714
  state: state$7
2846
2715
  };
2847
2716
 
2848
2717
  const Tag$1 = 'Tag';
2849
2718
  const Cloud$1 = 'Cloud';
2850
2719
  const SourceControl$1 = 'SourceControl';
2851
- const None = '';
2720
+ const None$1 = '';
2852
2721
 
2853
2722
  const SourceControl = 1;
2854
2723
  const Cloud = 2;
2855
2724
  const Tag = 3;
2856
2725
 
2857
- const getPickDescription$9 = pick => {
2858
- return pick.description || '';
2726
+ const state$6 = {
2727
+ args: []
2728
+ };
2729
+
2730
+ const selectPick$7 = async pick => {
2731
+ const {
2732
+ args
2733
+ } = state$6;
2734
+ const resolve = args[2];
2735
+ resolve(pick);
2736
+ return {
2737
+ command: Hide
2738
+ };
2739
+ };
2740
+
2741
+ const name$7 = 'custom';
2742
+ const setArgs = args => {
2743
+ state$6.args = args;
2744
+ };
2745
+ const getPlaceholder$7 = () => {
2746
+ return '';
2747
+ };
2748
+ const getLabel$3 = () => {
2749
+ return 'Custom';
2750
+ };
2751
+
2752
+ // TODO help entries should not be here
2753
+ const getHelpEntries$1 = () => {
2754
+ return [];
2755
+ };
2756
+ const getNoResults$7 = () => {
2757
+ return {
2758
+ label: noMatchingResults()
2759
+ };
2760
+ };
2761
+ const getPicks$6 = async searchValue => {
2762
+ const items = state$6.args[1] || [];
2763
+ return items;
2764
+ };
2765
+ const getFilterValue$7 = value => {
2766
+ return value;
2859
2767
  };
2860
- const getPickLabel$9 = pick => {
2768
+ const getPickFilterValue$7 = pick => {
2769
+ return pick;
2770
+ };
2771
+ const getPickLabel$6 = pick => {
2861
2772
  return pick.label;
2862
2773
  };
2863
- const convertIcon$1 = icon => {
2774
+ const getPickDescription$6 = pick => {
2775
+ return pick.description || '';
2776
+ };
2777
+ const convertIcon = icon => {
2864
2778
  switch (icon) {
2865
2779
  case SourceControl:
2866
2780
  return SourceControl$1;
@@ -2869,187 +2783,271 @@ const convertIcon$1 = icon => {
2869
2783
  case Tag:
2870
2784
  return Tag$1;
2871
2785
  default:
2872
- return None;
2786
+ return None$1;
2873
2787
  }
2874
2788
  };
2875
- const getPickIcon$9 = pick => {
2876
- return convertIcon$1(pick.icon);
2789
+ const getPickIcon$6 = pick => {
2790
+ return convertIcon(pick.icon);
2877
2791
  };
2878
- const getVisibleItems$b = (picks, icons) => {
2879
- const visibleItems = picks.map((pick, index) => ({
2880
- description: getPickDescription$9(pick),
2881
- fileIcon: '',
2882
- icon: getPickIcon$9(pick),
2883
- label: getPickLabel$9(pick),
2884
- matches: []
2885
- }));
2886
- return visibleItems;
2792
+ const isPrepared$6 = () => {
2793
+ return true;
2887
2794
  };
2888
2795
 
2889
- const name$5 = 'custom';
2890
- const state$6 = {
2891
- args: []
2892
- };
2893
- const setArgs = args => {
2894
- state$6.args = args;
2796
+ const QuickPickEntriesCustom = {
2797
+ __proto__: null,
2798
+ getFilterValue: getFilterValue$7,
2799
+ getHelpEntries: getHelpEntries$1,
2800
+ getLabel: getLabel$3,
2801
+ getNoResults: getNoResults$7,
2802
+ getPickDescription: getPickDescription$6,
2803
+ getPickFilterValue: getPickFilterValue$7,
2804
+ getPickIcon: getPickIcon$6,
2805
+ getPickLabel: getPickLabel$6,
2806
+ getPicks: getPicks$6,
2807
+ getPlaceholder: getPlaceholder$7,
2808
+ isPrepared: isPrepared$6,
2809
+ name: name$7,
2810
+ selectPick: selectPick$7,
2811
+ setArgs,
2812
+ state: state$6
2895
2813
  };
2896
- const getPlaceholder$5 = () => {
2814
+
2815
+ const name$6 = 'noop';
2816
+ const getPlaceholder$6 = () => {
2897
2817
  return '';
2898
2818
  };
2899
- const getLabel$2 = () => {
2900
- return 'Custom';
2819
+ const getNoResults$6 = () => {
2820
+ return noResults();
2901
2821
  };
2902
-
2903
- // TODO help entries should not be here
2904
- const getHelpEntries$1 = () => {
2822
+ const getPicks$5 = async value => {
2905
2823
  return [];
2906
2824
  };
2907
- const getNoResults$5 = () => {
2825
+ const selectPick$6 = async item => {
2908
2826
  return {
2909
- label: noMatchingResults()
2827
+ command: Hide
2910
2828
  };
2911
2829
  };
2912
- const getPicks$5 = async searchValue => {
2913
- const items = state$6.args[1] || [];
2914
- return items;
2830
+ const getFilterValue$6 = value => {
2831
+ return value;
2832
+ };
2833
+ const getPickFilterValue$6 = pick => {
2834
+ return pick;
2835
+ };
2836
+
2837
+ const QuickPickNoop = {
2838
+ __proto__: null,
2839
+ getFilterValue: getFilterValue$6,
2840
+ getNoResults: getNoResults$6,
2841
+ getPickFilterValue: getPickFilterValue$6,
2842
+ getPicks: getPicks$5,
2843
+ getPlaceholder: getPlaceholder$6,
2844
+ name: name$6,
2845
+ selectPick: selectPick$6
2846
+ };
2847
+
2848
+ const state$5 = {
2849
+ provider: QuickPickNoop,
2850
+ prefix: 'string-that-should-never-match-another-string'
2851
+ };
2852
+
2853
+ const Command = '>';
2854
+ const Symbol$1 = '@';
2855
+ const WorkspaceSymbol$1 = '#';
2856
+ const GoToLine$1 = ':';
2857
+ const View$1 = 'view ';
2858
+ const None = '';
2859
+
2860
+ const getQuickPickPrefix = value => {
2861
+ if (value.startsWith(Command)) {
2862
+ return Command;
2863
+ }
2864
+ if (value.startsWith(Symbol$1)) {
2865
+ return Symbol$1;
2866
+ }
2867
+ if (value.startsWith(WorkspaceSymbol$1)) {
2868
+ return WorkspaceSymbol$1;
2869
+ }
2870
+ if (value.startsWith(GoToLine$1)) {
2871
+ return GoToLine$1;
2872
+ }
2873
+ if (value.startsWith(View$1)) {
2874
+ return View$1;
2875
+ }
2876
+ return None;
2877
+ };
2878
+
2879
+ const CommandPalette = 'quickPick://commandPalette';
2880
+ const Commands = 'quickPick://commands';
2881
+ const File$1 = 'quickPick://file';
2882
+ const EveryThing = 'quickPick://everything';
2883
+ const Recent = 'quickPick://recent';
2884
+ const ColorTheme = 'quickPick://color-theme';
2885
+ const Symbol = 'quickPick://symbol';
2886
+ const View = 'quickPick://view';
2887
+ const WorkspaceSymbol = 'quickPick://workspace-symbol';
2888
+ const Custom = 'quickPick://custom';
2889
+ const GoToLine = 'quickPick://go-to-line';
2890
+
2891
+ // TODO use numeric enum for quickpick entry id
2892
+ const getQuickPickProviderId = prefix => {
2893
+ switch (prefix) {
2894
+ case Command:
2895
+ return Commands;
2896
+ case Symbol$1:
2897
+ return Symbol;
2898
+ case WorkspaceSymbol$1:
2899
+ return WorkspaceSymbol;
2900
+ case GoToLine$1:
2901
+ return GoToLine;
2902
+ case View$1:
2903
+ return View;
2904
+ default:
2905
+ return File$1;
2906
+ }
2915
2907
  };
2916
- const selectPick$5 = async pick => {
2908
+
2909
+ const getPicks$4 = async value => {
2910
+ const prefix = getQuickPickPrefix(value);
2911
+ const providerId = getQuickPickProviderId(prefix);
2912
+
2913
+ // TODO race condition
2914
+ if (state$5.prefix !== prefix) {
2915
+ state$5.prefix = prefix;
2916
+ const provider = get(providerId);
2917
+ state$5.provider = provider;
2918
+ }
2919
+ // TODO this line is a bit duplicated with getFilterValue
2920
+ const slicedValue = value.slice(prefix.length).trimStart();
2921
+ const picks = await getPicks$a(providerId, slicedValue);
2922
+ return picks;
2923
+ };
2924
+
2925
+ const selectPick$5 = item => {
2917
2926
  const {
2918
- args
2919
- } = state$6;
2920
- const resolve = args[2];
2921
- resolve(pick);
2922
- return {
2923
- command: Hide
2924
- };
2927
+ provider
2928
+ } = state$5;
2929
+ return provider.selectPick(item);
2930
+ };
2931
+
2932
+ // TODO avoid global variable
2933
+
2934
+ // TODO don't store provider in state, only serialized value like provider-id
2935
+
2936
+ /**
2937
+ * @type {string}
2938
+ */
2939
+ const name$5 = 'everything';
2940
+ const getPlaceholder$5 = () => {
2941
+ // @ts-ignore
2942
+ return state$5.provider.getPlaceholder();
2943
+ };
2944
+ const getLabel$2 = () => {
2945
+ return '';
2946
+ };
2947
+ const getNoResults$5 = () => {
2948
+ // @ts-ignore
2949
+ return state$5.provider.getNoResults();
2950
+ };
2951
+ const openCommandPalette = () => {
2952
+ // show('>')
2953
+ };
2954
+ const openView = () => {
2955
+ // show('view ')
2925
2956
  };
2926
2957
  const getFilterValue$5 = value => {
2927
- return value;
2958
+ return value.slice(state$5.prefix.length).trim();
2928
2959
  };
2929
2960
  const getPickFilterValue$5 = pick => {
2930
- return pick;
2961
+ const {
2962
+ provider
2963
+ } = state$5;
2964
+ // @ts-ignore
2965
+ return provider.getPickFilterValue(pick);
2931
2966
  };
2932
- const getPickLabel$8 = pick => {
2933
- return pick.label;
2967
+ const getPickDescription$5 = pick => {
2968
+ const {
2969
+ provider
2970
+ } = state$5;
2971
+ // @ts-ignore
2972
+ if (provider.getPickDescription) {
2973
+ // @ts-ignore
2974
+ return provider.getPickDescription(pick);
2975
+ }
2976
+ return '';
2934
2977
  };
2935
- const getPickDescription$8 = pick => {
2936
- return pick.description || '';
2978
+ const getPickLabel$5 = pick => {
2979
+ const {
2980
+ provider
2981
+ } = state$5;
2982
+ // @ts-ignore
2983
+ return provider.getPickLabel(pick);
2937
2984
  };
2938
- const convertIcon = icon => {
2939
- switch (icon) {
2940
- case SourceControl:
2941
- return SourceControl$1;
2942
- case Cloud:
2943
- return Cloud$1;
2944
- case Tag:
2945
- return Tag$1;
2946
- default:
2947
- return None;
2948
- }
2985
+ const getPickIcon$5 = pick => {
2986
+ const {
2987
+ provider
2988
+ } = state$5;
2989
+ // @ts-ignore
2990
+ return provider.getPickIcon(pick);
2949
2991
  };
2950
- const getPickIcon$8 = pick => {
2951
- return convertIcon(pick.icon);
2992
+ const getPickFileIcon$2 = pick => {
2993
+ const {
2994
+ provider
2995
+ } = state$5;
2996
+ // @ts-ignore
2997
+ if (provider.getPickFileIcon) {
2998
+ // @ts-ignore
2999
+ return provider.getPickFileIcon(pick);
3000
+ }
3001
+ return undefined;
2952
3002
  };
2953
3003
  const isPrepared$5 = () => {
2954
- return true;
3004
+ const {
3005
+ provider
3006
+ } = state$5;
3007
+ // @ts-ignore
3008
+ if (provider.isPrepared) {
3009
+ // @ts-ignore
3010
+ return provider.isPrepared();
3011
+ }
3012
+ return false;
2955
3013
  };
2956
- const getVisibleItems$a = getVisibleItems$b;
2957
3014
 
2958
- const QuickPickEntriesCustom = {
3015
+ const QuickPickEntriesEverything = {
2959
3016
  __proto__: null,
2960
3017
  getFilterValue: getFilterValue$5,
2961
- getHelpEntries: getHelpEntries$1,
2962
3018
  getLabel: getLabel$2,
2963
3019
  getNoResults: getNoResults$5,
2964
- getPickDescription: getPickDescription$8,
3020
+ getPickDescription: getPickDescription$5,
3021
+ getPickFileIcon: getPickFileIcon$2,
2965
3022
  getPickFilterValue: getPickFilterValue$5,
2966
- getPickIcon: getPickIcon$8,
2967
- getPickLabel: getPickLabel$8,
2968
- getPicks: getPicks$5,
3023
+ getPickIcon: getPickIcon$5,
3024
+ getPickLabel: getPickLabel$5,
3025
+ getPicks: getPicks$4,
2969
3026
  getPlaceholder: getPlaceholder$5,
2970
- getVisibleItems: getVisibleItems$a,
2971
3027
  isPrepared: isPrepared$5,
2972
3028
  name: name$5,
3029
+ openCommandPalette,
3030
+ openView,
2973
3031
  selectPick: selectPick$5,
2974
- setArgs,
2975
- state: state$6
2976
- };
2977
-
2978
- const RE_PROTOCOL = /^([a-z-]+):\/\//;
2979
- const getProtocol = uri => {
2980
- const protocolMatch = uri.match(RE_PROTOCOL);
2981
- if (protocolMatch) {
2982
- return protocolMatch[1];
2983
- }
2984
- return '';
2985
- };
2986
-
2987
- const getVisibleItems$9 = (files, icons) => {
2988
- const visibleItems = files.map((item, i) => {
2989
- const pick = item.pick;
2990
- const label = getPickLabel$7(pick);
2991
- const description = getPickDescription$7(pick);
2992
- const icon = getPickIcon$7();
2993
- const fileIcon = icons[i];
2994
- return {
2995
- label,
2996
- description,
2997
- icon,
2998
- fileIcon,
2999
- matches: item.matches
3000
- };
3001
- });
3002
- return visibleItems;
3003
- };
3004
- const getPickLabel$7 = pick => {
3005
- if (typeof pick === 'object') {
3006
- pick = pick.pick;
3007
- }
3008
- const baseName = pathBaseName(pick);
3009
- return baseName;
3010
- };
3011
- const getPickDescription$7 = pick => {
3012
- if (typeof pick === 'object') {
3013
- pick = pick.pick;
3014
- }
3015
- const dirName = pathDirName(pick);
3016
- return dirName;
3017
- };
3018
- const getPickIcon$7 = () => {
3019
- return '';
3020
- };
3021
-
3022
- const getWorkspacePath = async () => {
3023
- return invoke$1('Workspace.getPath');
3032
+ state: state$5
3024
3033
  };
3025
3034
 
3026
3035
  const openUri = async uri => {
3027
3036
  await invoke$1(/* Main.openUri */'Main.openUri', /* uri */uri);
3028
3037
  };
3029
3038
 
3030
- const state$5 = Object.create(null);
3031
- const register = modules => {
3032
- Object.assign(state$5, modules);
3033
- };
3034
- const getModule = protocol => {
3035
- return state$5[protocol];
3036
- };
3037
-
3038
- const searchFile$5 = async (path, value, prepare, assetDir) => {
3039
- const protocol = getProtocol(path);
3040
- // TODO call different providers depending on protocol
3041
- const fn = getModule(protocol);
3042
- const result = await fn(path, value, prepare, assetDir);
3043
- return result;
3039
+ const selectPick$4 = async pick => {
3040
+ const description = pick.description;
3041
+ const fileName = pick.label;
3042
+ const workspace = await getWorkspacePath();
3043
+ const absolutePath = `${workspace}/${description}/${fileName}`;
3044
+ await openUri(absolutePath);
3045
+ return {
3046
+ command: Hide
3047
+ };
3044
3048
  };
3045
3049
 
3046
3050
  const state$4 = {};
3047
- const searchFile$4 = async (path, value) => {
3048
- const prepare = true;
3049
- // @ts-ignore
3050
- const files = await searchFile$5(/* path */path, /* searchTerm */value, prepare);
3051
- return files;
3052
- };
3053
3051
  const name$4 = 'file';
3054
3052
  const getPlaceholder$4 = () => {
3055
3053
  return '';
@@ -3062,26 +3060,6 @@ const getNoResults$4 = () => {
3062
3060
  label: noMatchingResults()
3063
3061
  };
3064
3062
  };
3065
- const getPicks$4 = async searchValue => {
3066
- // TODO cache workspace path
3067
- const workspace = await getWorkspacePath();
3068
- if (!workspace) {
3069
- return [];
3070
- }
3071
- const files = await searchFile$4(workspace, searchValue);
3072
- return files;
3073
- };
3074
- const selectPick$4 = async pick => {
3075
- if (typeof pick === 'object') {
3076
- pick = pick.pick;
3077
- }
3078
- const workspace = await getWorkspacePath();
3079
- const absolutePath = `${workspace}/${pick}`;
3080
- await openUri(absolutePath);
3081
- return {
3082
- command: Hide
3083
- };
3084
- };
3085
3063
  const getFilterValue$4 = value => {
3086
3064
  return value;
3087
3065
  };
@@ -3091,35 +3069,29 @@ const getPickFilterValue$4 = pick => {
3091
3069
  }
3092
3070
  return pick;
3093
3071
  };
3094
- const getPickLabel$6 = pick => {
3072
+ const getPickLabel$4 = pick => {
3095
3073
  if (typeof pick === 'object') {
3096
3074
  pick = pick.pick;
3097
3075
  }
3098
3076
  const baseName = pathBaseName(pick);
3099
3077
  return baseName;
3100
3078
  };
3101
- const getPickDescription$6 = pick => {
3079
+ const getPickDescription$4 = pick => {
3102
3080
  if (typeof pick === 'object') {
3103
3081
  pick = pick.pick;
3104
3082
  }
3105
3083
  const dirName = pathDirName(pick);
3106
3084
  return dirName;
3107
3085
  };
3108
- const getPickIcon$6 = () => {
3086
+ const getPickIcon$4 = () => {
3109
3087
  return '';
3110
3088
  };
3111
3089
  const getPickFileIcon$1 = pick => {
3112
- if (typeof pick === 'object') {
3113
- pick = pick.pick;
3114
- }
3115
- if (typeof pick === 'object') {
3116
- pick = pick.pick;
3117
- }
3118
- const baseName = pathBaseName(pick);
3090
+ const path = `${pick.description}/${pick.label}`;
3119
3091
  return {
3120
- type: File$1,
3121
- name: baseName,
3122
- path: pick
3092
+ type: File$2,
3093
+ name: pick.label,
3094
+ path
3123
3095
  };
3124
3096
  };
3125
3097
  const isPrepared$4 = () => {
@@ -3128,21 +3100,19 @@ const isPrepared$4 = () => {
3128
3100
  const protocol = getProtocol(workspace);
3129
3101
  return !protocol;
3130
3102
  };
3131
- const getVisibleItems$8 = getVisibleItems$9;
3132
3103
 
3133
3104
  const QuickPickEntriesFile = {
3134
3105
  __proto__: null,
3135
3106
  getFilterValue: getFilterValue$4,
3136
3107
  getLabel: getLabel$1,
3137
3108
  getNoResults: getNoResults$4,
3138
- getPickDescription: getPickDescription$6,
3109
+ getPickDescription: getPickDescription$4,
3139
3110
  getPickFileIcon: getPickFileIcon$1,
3140
3111
  getPickFilterValue: getPickFilterValue$4,
3141
- getPickIcon: getPickIcon$6,
3142
- getPickLabel: getPickLabel$6,
3143
- getPicks: getPicks$4,
3112
+ getPickIcon: getPickIcon$4,
3113
+ getPickLabel: getPickLabel$4,
3114
+ getPicks: getPicks$8,
3144
3115
  getPlaceholder: getPlaceholder$4,
3145
- getVisibleItems: getVisibleItems$8,
3146
3116
  isPrepared: isPrepared$4,
3147
3117
  name: name$4,
3148
3118
  selectPick: selectPick$4,
@@ -3153,34 +3123,19 @@ const getRecentlyOpened = () => {
3153
3123
  return invoke$1(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
3154
3124
  };
3155
3125
 
3156
- const getPickDescription$5 = pick => {
3157
- return pathDirName(pick);
3158
- };
3159
- const getPickIcon$5 = () => {
3160
- return '';
3161
- };
3162
- const getPickLabel$5 = pick => {
3163
- return pathBaseName(pick);
3164
- };
3165
- const getVisibleItems$7 = (picks, icons) => {
3166
- const visibleItems = picks.map((item, index) => {
3167
- const pick = item.pick;
3168
- const fileIcon = icons[index];
3169
- return {
3170
- description: getPickDescription$5(pick),
3171
- fileIcon,
3172
- icon: getPickIcon$5(),
3173
- label: getPickLabel$5(pick),
3174
- matches: pick.matches || []
3175
- };
3176
- });
3177
- return visibleItems;
3178
- };
3179
-
3180
3126
  const openWorkspaceFolder = uri => {
3181
3127
  return invoke$1(/* Workspace.setPath */'Workspace.setPath', /* path */uri);
3182
3128
  };
3183
3129
 
3130
+ // TODO selectPick should be independent of show/hide
3131
+ const selectPick$3 = async pick => {
3132
+ const path = `${pick.description}/${pick.label}`;
3133
+ await openWorkspaceFolder(path);
3134
+ return {
3135
+ command: Hide
3136
+ };
3137
+ };
3138
+
3184
3139
  const getPlaceholder$3 = () => {
3185
3140
  return selectToOpen();
3186
3141
  };
@@ -3202,43 +3157,28 @@ const getPicks$3 = async () => {
3202
3157
  const recentlyOpened = await getRecentlyOpened();
3203
3158
  return recentlyOpened;
3204
3159
  };
3205
- const getVisibleItems$6 = getVisibleItems$7;
3206
-
3207
- // TODO selectPick should be independent of show/hide
3208
- const selectPick$3 = async pick => {
3209
- const path = pick;
3210
- await openWorkspaceFolder(path);
3211
- return {
3212
- command: Hide
3213
- };
3214
- };
3215
3160
  const getFilterValue$3 = value => {
3216
3161
  return pathBaseName(value);
3217
3162
  };
3218
3163
  const getPickFilterValue$3 = pick => {
3219
3164
  return pathBaseName(pick);
3220
3165
  };
3221
- const getPickLabel$4 = pick => {
3166
+ const getPickLabel$3 = pick => {
3222
3167
  return pathBaseName(pick);
3223
3168
  };
3224
- const getPickDescription$4 = pick => {
3169
+ const getPickDescription$3 = pick => {
3225
3170
  return pathDirName(pick);
3226
3171
  };
3227
- const getPickIcon$4 = () => {
3172
+ const getPickIcon$3 = () => {
3228
3173
  return '';
3229
3174
  };
3230
3175
  const getPickFileIcon = pick => {
3231
- if (typeof pick === 'object') {
3232
- pick = pick.pick;
3233
- }
3234
- if (typeof pick === 'object') {
3235
- pick = pick.pick;
3236
- }
3237
- const baseName = pathBaseName(pick);
3176
+ const baseName = pick.label;
3177
+ const path = `${pick.description}/${pick.label}`;
3238
3178
  return {
3239
- type: File$1,
3179
+ type: File$2,
3240
3180
  name: baseName,
3241
- path: pick
3181
+ path
3242
3182
  };
3243
3183
  };
3244
3184
  const state$3 = {};
@@ -3252,22 +3192,23 @@ const QuickPickEntriesOpenRecent = {
3252
3192
  getFilterValue: getFilterValue$3,
3253
3193
  getLabel,
3254
3194
  getNoResults: getNoResults$3,
3255
- getPickDescription: getPickDescription$4,
3195
+ getPickDescription: getPickDescription$3,
3256
3196
  getPickFileIcon,
3257
3197
  getPickFilterValue: getPickFilterValue$3,
3258
- getPickIcon: getPickIcon$4,
3259
- getPickLabel: getPickLabel$4,
3198
+ getPickIcon: getPickIcon$3,
3199
+ getPickLabel: getPickLabel$3,
3260
3200
  getPicks: getPicks$3,
3261
3201
  getPlaceholder: getPlaceholder$3,
3262
- getVisibleItems: getVisibleItems$6,
3263
3202
  isPrepared: isPrepared$3,
3264
3203
  name: name$3,
3265
3204
  selectPick: selectPick$3,
3266
3205
  state: state$3
3267
3206
  };
3268
3207
 
3269
- const getVisibleItems$5 = picks => {
3270
- return [];
3208
+ const selectPick$2 = async item => {
3209
+ return {
3210
+ command: Hide
3211
+ };
3271
3212
  };
3272
3213
 
3273
3214
  const name$2 = 'symbol';
@@ -3283,17 +3224,11 @@ const getPicks$2 = async () => {
3283
3224
  const picks = [];
3284
3225
  return picks;
3285
3226
  };
3286
- const getVisibleItems$4 = getVisibleItems$5;
3287
- const selectPick$2 = async item => {
3288
- return {
3289
- command: Hide
3290
- };
3291
- };
3292
3227
  const getFilterValue$2 = value => {
3293
3228
  return value;
3294
3229
  };
3295
3230
  const state$2 = {};
3296
- const getPickDescription$3 = value => {
3231
+ const getPickDescription$2 = value => {
3297
3232
  return '';
3298
3233
  };
3299
3234
  const isPrepared$2 = () => {
@@ -3302,10 +3237,10 @@ const isPrepared$2 = () => {
3302
3237
  const getPickFilterValue$2 = value => {
3303
3238
  return value;
3304
3239
  };
3305
- const getPickLabel$3 = value => {
3240
+ const getPickLabel$2 = value => {
3306
3241
  return value;
3307
3242
  };
3308
- const getPickIcon$3 = value => {
3243
+ const getPickIcon$2 = value => {
3309
3244
  return '';
3310
3245
  };
3311
3246
 
@@ -3313,37 +3248,23 @@ const QuickPickEntriesSymbol = {
3313
3248
  __proto__: null,
3314
3249
  getFilterValue: getFilterValue$2,
3315
3250
  getNoResults: getNoResults$2,
3316
- getPickDescription: getPickDescription$3,
3251
+ getPickDescription: getPickDescription$2,
3317
3252
  getPickFilterValue: getPickFilterValue$2,
3318
- getPickIcon: getPickIcon$3,
3319
- getPickLabel: getPickLabel$3,
3253
+ getPickIcon: getPickIcon$2,
3254
+ getPickLabel: getPickLabel$2,
3320
3255
  getPicks: getPicks$2,
3321
3256
  getPlaceholder: getPlaceholder$2,
3322
- getVisibleItems: getVisibleItems$4,
3323
3257
  isPrepared: isPrepared$2,
3324
3258
  name: name$2,
3325
3259
  selectPick: selectPick$2,
3326
3260
  state: state$2
3327
3261
  };
3328
3262
 
3329
- const getPickDescription$2 = () => {
3330
- return '';
3331
- };
3332
- const getPickIcon$2 = value => {
3333
- return '';
3334
- };
3335
- const getPickLabel$2 = value => {
3336
- return value;
3337
- };
3338
- const getVisibleItems$3 = picks => {
3339
- const visibleItems = picks.map((pick, index) => ({
3340
- description: getPickDescription$2(),
3341
- fileIcon: '',
3342
- icon: getPickIcon$2(),
3343
- label: getPickLabel$2(pick),
3344
- matches: []
3345
- }));
3346
- return visibleItems;
3263
+ const selectPick$1 = async item => {
3264
+ // Command.execute(/* openView */ 549, /* viewName */ item.label)
3265
+ return {
3266
+ command: Hide
3267
+ };
3347
3268
  };
3348
3269
 
3349
3270
  // TODO probably not needed
@@ -3360,12 +3281,6 @@ const getPicks$1 = async () => {
3360
3281
  // return picks
3361
3282
  return [];
3362
3283
  };
3363
- const selectPick$1 = async item => {
3364
- // Command.execute(/* openView */ 549, /* viewName */ item.label)
3365
- // return {
3366
- // command: QuickPickReturnValue.Hide,
3367
- // }
3368
- };
3369
3284
  const getFilterValue$1 = value => {
3370
3285
  return value;
3371
3286
  };
@@ -3389,7 +3304,6 @@ const isPrepared$1 = () => {
3389
3304
  const getPickDescription$1 = () => {
3390
3305
  return '';
3391
3306
  };
3392
- const getVisibleItems$2 = getVisibleItems$3;
3393
3307
 
3394
3308
  const QuickPickEntriesView = {
3395
3309
  __proto__: null,
@@ -3402,22 +3316,16 @@ const QuickPickEntriesView = {
3402
3316
  getPickLabel: getPickLabel$1,
3403
3317
  getPicks: getPicks$1,
3404
3318
  getPlaceholder: getPlaceholder$1,
3405
- getVisibleItems: getVisibleItems$2,
3406
3319
  isPrepared: isPrepared$1,
3407
3320
  name: name$1,
3408
3321
  selectPick: selectPick$1,
3409
3322
  state: state$1
3410
3323
  };
3411
3324
 
3412
- const getVisibleItems$1 = picks => {
3413
- const visibleItems = picks.map((pick, index) => ({
3414
- description: '',
3415
- fileIcon: '',
3416
- icon: '',
3417
- label: pick.label || '',
3418
- matches: []
3419
- }));
3420
- return visibleItems;
3325
+ const selectPick = async item => {
3326
+ return {
3327
+ command: Hide
3328
+ };
3421
3329
  };
3422
3330
 
3423
3331
  const name = 'workspace-symbol';
@@ -3449,15 +3357,9 @@ const getPicks = async () => {
3449
3357
  const picks = [];
3450
3358
  return picks;
3451
3359
  };
3452
- const selectPick = async item => {
3453
- return {
3454
- command: Hide
3455
- };
3456
- };
3457
3360
  const getFilterValue = value => {
3458
3361
  return value;
3459
3362
  };
3460
- const getVisibleItems = getVisibleItems$1;
3461
3363
 
3462
3364
  const QuickPickEntriesWorkspaceSymbol = {
3463
3365
  __proto__: null,
@@ -3469,7 +3371,6 @@ const QuickPickEntriesWorkspaceSymbol = {
3469
3371
  getPickLabel,
3470
3372
  getPicks,
3471
3373
  getPlaceholder,
3472
- getVisibleItems,
3473
3374
  isPrepared,
3474
3375
  name,
3475
3376
  selectPick,
@@ -3482,7 +3383,7 @@ const quickPickEntriesModules = {
3482
3383
  [Commands]: QuickPickEntriesCommand,
3483
3384
  [Custom]: QuickPickEntriesCustom,
3484
3385
  [EveryThing]: QuickPickEntriesEverything,
3485
- [File$2]: QuickPickEntriesFile,
3386
+ [File$1]: QuickPickEntriesFile,
3486
3387
  [Recent]: QuickPickEntriesOpenRecent,
3487
3388
  [Symbol]: QuickPickEntriesSymbol,
3488
3389
  [View]: QuickPickEntriesView,
@@ -3537,11 +3438,7 @@ const searchFile = async (path, value, prepare) => {
3537
3438
  };
3538
3439
  const stdout = await invoke('SearchFile.searchFile', options);
3539
3440
  const lines = splitLines(stdout);
3540
- if (!prepare) {
3541
- return lines;
3542
- }
3543
- const filtered = filterQuickPickItems(lines, value);
3544
- return filtered;
3441
+ return lines;
3545
3442
  };
3546
3443
 
3547
3444
  const searchModules = {