@lvce-editor/file-search-worker 5.6.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
  };
@@ -913,7 +913,7 @@ const create$2 = () => {
913
913
  };
914
914
 
915
915
  const {
916
- get: get$1,
916
+ get,
917
917
  set,
918
918
  remove
919
919
  } = create$2();
@@ -1066,7 +1066,7 @@ const diff2 = uid => {
1066
1066
  const {
1067
1067
  oldState,
1068
1068
  newState
1069
- } = get$1(uid);
1069
+ } = get(uid);
1070
1070
  return diff(oldState, newState);
1071
1071
  };
1072
1072
 
@@ -1074,18 +1074,58 @@ const dispose = uid => {
1074
1074
  remove(uid);
1075
1075
  };
1076
1076
 
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);
1111
+ };
1112
+
1077
1113
  const getIconsCached = (paths, fileIconCache) => {
1078
1114
  return paths.map(path => fileIconCache[path]);
1079
1115
  };
1080
1116
 
1081
- const File$2 = 7;
1117
+ const Directory = 3;
1118
+ const File$1 = 7;
1082
1119
 
1083
1120
  const getMissingIconRequests = (dirents, fileIconCache) => {
1084
1121
  const missingRequests = [];
1085
1122
  for (const dirent of dirents) {
1123
+ if (!dirent.path) {
1124
+ continue;
1125
+ }
1086
1126
  if (!(dirent.path in fileIconCache)) {
1087
1127
  missingRequests.push({
1088
- type: File$2,
1128
+ type: File$1,
1089
1129
  name: dirent.name,
1090
1130
  path: dirent.path
1091
1131
  });
@@ -1099,7 +1139,7 @@ const requestFileIcons = async requests => {
1099
1139
  if (!request.name) {
1100
1140
  return '';
1101
1141
  }
1102
- return request.type === File$2 ? invoke$1('IconTheme.getFileIcon', {
1142
+ return request.type === File$1 ? invoke$1('IconTheme.getFileIcon', {
1103
1143
  name: request.name
1104
1144
  }) : invoke$1('IconTheme.getFolderIcon', {
1105
1145
  name: request.name
@@ -1123,7 +1163,7 @@ const updateIconCache = (iconCache, missingRequests, newIcons) => {
1123
1163
  return newFileIconCache;
1124
1164
  };
1125
1165
 
1126
- const getQuickPickFileIcons = async (provider, items, fileIconCache) => {
1166
+ const getQuickPickFileIcons = async (items, fileIconCache) => {
1127
1167
  const dirents = items.map(item => {
1128
1168
  const dirent = {
1129
1169
  type: item.direntType,
@@ -1143,26 +1183,6 @@ const getQuickPickFileIcons = async (provider, items, fileIconCache) => {
1143
1183
  };
1144
1184
  };
1145
1185
 
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
-
1166
1186
  const focusIndex = async (state, index) => {
1167
1187
  const {
1168
1188
  uri,
@@ -1172,14 +1192,7 @@ const focusIndex = async (state, index) => {
1172
1192
  maxLineY,
1173
1193
  fileIconCache
1174
1194
  } = state;
1175
- const provider = get(uri);
1176
-
1177
- // TODO get types working
1178
- // @ts-ignore
1179
- if (provider.focusPick) {
1180
- // @ts-ignore
1181
- await provider.focusPick(items[index]);
1182
- }
1195
+ await focusPick(uri, items[index]);
1183
1196
  if (index < minLineY + 1) {
1184
1197
  const minLineY = index;
1185
1198
  const maxLineY = Math.min(index + maxVisibleItems, items.length - 1);
@@ -1187,7 +1200,7 @@ const focusIndex = async (state, index) => {
1187
1200
  const {
1188
1201
  newFileIconCache,
1189
1202
  icons
1190
- } = await getQuickPickFileIcons(provider, sliced, fileIconCache);
1203
+ } = await getQuickPickFileIcons(sliced, fileIconCache);
1191
1204
 
1192
1205
  // TODO need to scroll up
1193
1206
  return {
@@ -1207,7 +1220,7 @@ const focusIndex = async (state, index) => {
1207
1220
  const {
1208
1221
  newFileIconCache,
1209
1222
  icons
1210
- } = await getQuickPickFileIcons(provider, sliced, fileIconCache);
1223
+ } = await getQuickPickFileIcons(sliced, fileIconCache);
1211
1224
  return {
1212
1225
  ...state,
1213
1226
  minLineY,
@@ -1221,7 +1234,7 @@ const focusIndex = async (state, index) => {
1221
1234
  const {
1222
1235
  newFileIconCache,
1223
1236
  icons
1224
- } = await getQuickPickFileIcons(provider, sliced, fileIconCache);
1237
+ } = await getQuickPickFileIcons(sliced, fileIconCache);
1225
1238
  return {
1226
1239
  ...state,
1227
1240
  focusedIndex: index,
@@ -1642,6 +1655,74 @@ const filterQuickPickItems = (items, value) => {
1642
1655
  return results;
1643
1656
  };
1644
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
+
1645
1726
  const getPicks$a = (id, searchValue) => {
1646
1727
  const fn = getPicks$b(id);
1647
1728
  return fn(searchValue);
@@ -1659,17 +1740,15 @@ const setValue = async (state, newValue) => {
1659
1740
  if (value === newValue) {
1660
1741
  return state;
1661
1742
  }
1662
- const provider = get(uri);
1663
1743
  const newPicks = await getPicks$a(uri, newValue);
1664
- // @ts-ignore
1665
- const filterValue = provider.getFilterValue(newValue);
1744
+ const filterValue = getFilterValue(uri, newValue);
1666
1745
  const items = filterQuickPickItems(newPicks, filterValue);
1667
1746
  const focusedIndex = items.length === 0 ? -1 : 0;
1668
1747
  const sliced = newPicks.slice(minLineY, maxLineY);
1669
1748
  const {
1670
1749
  newFileIconCache,
1671
1750
  icons
1672
- } = await getQuickPickFileIcons(provider, sliced, fileIconCache);
1751
+ } = await getQuickPickFileIcons(sliced, fileIconCache);
1673
1752
  return {
1674
1753
  ...state,
1675
1754
  picks: newPicks,
@@ -1738,14 +1817,13 @@ const selectIndex = async (state, index, button = /* left */0) => {
1738
1817
  uri,
1739
1818
  items
1740
1819
  } = state;
1741
- const provider = get(uri);
1742
1820
  const actualIndex = index + minLineY;
1743
1821
  const pick = getPick(items, actualIndex);
1744
1822
  if (!pick) {
1745
1823
  return state;
1746
1824
  }
1747
- // @ts-ignore
1748
- const selectPickResult = await provider.selectPick(pick, actualIndex, button);
1825
+ const fn = getSelect(uri);
1826
+ const selectPickResult = await fn(pick);
1749
1827
  object(selectPickResult);
1750
1828
  string(selectPickResult.command);
1751
1829
  const {
@@ -1801,6 +1879,27 @@ const getDefaultValue = uri => {
1801
1879
  }
1802
1880
  };
1803
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
+
1804
1903
  const loadContent = async state => {
1805
1904
  const {
1806
1905
  uri,
@@ -1808,16 +1907,10 @@ const loadContent = async state => {
1808
1907
  fileIconCache
1809
1908
  } = state;
1810
1909
  const value = getDefaultValue(uri);
1811
- const provider = get(uri);
1812
- // @ts-ignore
1813
- if (provider.setArgs) {
1814
- // @ts-ignore
1815
- provider.setArgs(args);
1816
- }
1910
+ setArgs(uri, args);
1817
1911
  const newPicks = await getPicks$a(uri, value);
1818
1912
  array(newPicks);
1819
- // @ts-ignore
1820
- const filterValue = provider.getFilterValue(value);
1913
+ const filterValue = getFilterValue(uri, value);
1821
1914
  const items = filterQuickPickItems(newPicks, filterValue);
1822
1915
  const minLineY = 0;
1823
1916
  const maxLineY = Math.min(minLineY + state.maxVisibleItems, newPicks.length);
@@ -1825,7 +1918,7 @@ const loadContent = async state => {
1825
1918
  const {
1826
1919
  newFileIconCache,
1827
1920
  icons
1828
- } = await getQuickPickFileIcons(provider, sliced, fileIconCache);
1921
+ } = await getQuickPickFileIcons(sliced, fileIconCache);
1829
1922
  return {
1830
1923
  ...state,
1831
1924
  picks: newPicks,
@@ -1843,14 +1936,14 @@ const loadContent = async state => {
1843
1936
  };
1844
1937
  };
1845
1938
 
1846
- const state$a = {
1939
+ const state$2 = {
1847
1940
  menuEntries: []
1848
1941
  };
1849
1942
  const getAll = () => {
1850
- return state$a.menuEntries;
1943
+ return state$2.menuEntries;
1851
1944
  };
1852
1945
  const add = menuEntries => {
1853
- state$a.menuEntries = [...state$a.menuEntries, ...menuEntries];
1946
+ state$2.menuEntries = [...state$2.menuEntries, ...menuEntries];
1854
1947
  };
1855
1948
 
1856
1949
  const getVisible$1 = (items, minLineY, maxLineY, icons) => {
@@ -1924,7 +2017,7 @@ const renderHeight = newState => {
1924
2017
 
1925
2018
  const ComboBox = 'combobox';
1926
2019
  const ListBox = 'listbox';
1927
- const None$2 = 'none';
2020
+ const None = 'none';
1928
2021
  const Option = 'option';
1929
2022
 
1930
2023
  const FileIcon = 'FileIcon';
@@ -1965,52 +2058,16 @@ const i18nString = (key, placeholders = emptyObject) => {
1965
2058
  return key.replaceAll(RE_PLACEHOLDER, replacer);
1966
2059
  };
1967
2060
 
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
2061
  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
2062
  const TypeNameOfCommandToRun = 'Type the name of a command to run.';
1979
2063
  const QuickOpen = 'Quick open';
1980
2064
 
1981
- const noMatchingColorThemesFound = () => {
1982
- return i18nString(NoMatchingColorThemesFound);
1983
- };
1984
- const selectColorTheme = () => {
1985
- return i18nString(SelectColorTheme);
1986
- };
1987
2065
  const typeNameofCommandToRun = () => {
1988
2066
  return i18nString(TypeNameOfCommandToRun);
1989
2067
  };
1990
- const noMatchingResults = () => {
1991
- return i18nString(NoMatchingResults);
1992
- };
1993
- const files = () => {
1994
- return i18nString(Files);
1995
- };
1996
2068
  const noResults = () => {
1997
2069
  return i18nString(NoResults);
1998
2070
  };
1999
- const selectToOpen = () => {
2000
- return i18nString(SelectToOpen);
2001
- };
2002
- const openRecent = () => {
2003
- return i18nString(OpenRecent);
2004
- };
2005
- const noRecentlyOpenedFoldersFound = () => {
2006
- return i18nString(NoRecentlyOpenedFoldersFound);
2007
- };
2008
- const noSymbolFound = () => {
2009
- return i18nString(NoSymbolFound);
2010
- };
2011
- const noWorkspaceSymbolsFound = () => {
2012
- return i18nString(NoWorkspaceSymbolsFound);
2013
- };
2014
2071
  const quickOpen = () => {
2015
2072
  return i18nString(QuickOpen);
2016
2073
  };
@@ -2137,7 +2194,7 @@ const getFileIconVirtualDom = icon => {
2137
2194
  type: Img,
2138
2195
  className: FileIcon,
2139
2196
  src: icon,
2140
- role: None$2,
2197
+ role: None,
2141
2198
  childCount: 0
2142
2199
  };
2143
2200
  };
@@ -2280,7 +2337,7 @@ const render2 = (uid, diffResult) => {
2280
2337
  const {
2281
2338
  oldState,
2282
2339
  newState
2283
- } = get$1(uid);
2340
+ } = get(uid);
2284
2341
  if (oldState === newState) {
2285
2342
  return [];
2286
2343
  }
@@ -2338,12 +2395,12 @@ const wrapCommand = fn => {
2338
2395
  const wrapped = async (uid, ...args) => {
2339
2396
  const {
2340
2397
  newState
2341
- } = get$1(uid);
2398
+ } = get(uid);
2342
2399
  const newerState = await fn(newState, ...args);
2343
2400
  if (newState === newerState) {
2344
2401
  return;
2345
2402
  }
2346
- const latest = get$1(uid);
2403
+ const latest = get(uid);
2347
2404
  set(uid, latest.oldState, newerState);
2348
2405
  };
2349
2406
  return wrapped;
@@ -2375,16 +2432,14 @@ const commandMap = {
2375
2432
  'QuickPick.selectIndex': wrapCommand(selectIndex),
2376
2433
  'QuickPick.selectItem': wrapCommand(selectItem),
2377
2434
  'QuickPick.setDeltaY': wrapCommand(setDeltaY),
2378
- 'QuickPick.setValue': wrapCommand(setValue),
2379
- // deprecated
2380
- 'QuickPick.loadEntries2': get
2435
+ 'QuickPick.setValue': wrapCommand(setValue)
2381
2436
  };
2382
2437
 
2383
2438
  const getColorThemeNames = async () => {
2384
2439
  return invoke$1(/* Ajax.getJson */'ColorTheme.getColorThemeNames');
2385
2440
  };
2386
2441
 
2387
- const toProtoVisibleItem$1 = name => {
2442
+ const toProtoVisibleItem$2 = name => {
2388
2443
  const pick = {
2389
2444
  label: name,
2390
2445
  description: '',
@@ -2398,7 +2453,125 @@ const toProtoVisibleItem$1 = name => {
2398
2453
  };
2399
2454
  const getPicks$9 = async searchValue => {
2400
2455
  const colorThemeNames = await getColorThemeNames();
2401
- const picks = colorThemeNames.map(toProtoVisibleItem$1);
2456
+ const picks = colorThemeNames.map(toProtoVisibleItem$2);
2457
+ return picks;
2458
+ };
2459
+
2460
+ const handleError = async (error, notify = true, prefix = '') => {
2461
+ console.error(error);
2462
+ };
2463
+ const showErrorDialog = async error => {
2464
+ const code = error.code;
2465
+ const message = error.message;
2466
+ const stack = error.stack;
2467
+ const name = error.name;
2468
+ const errorInfo = {
2469
+ code,
2470
+ message,
2471
+ stack,
2472
+ name
2473
+ };
2474
+ await invoke$1('ErrorHandling.showErrorDialog', errorInfo);
2475
+ };
2476
+ const warn = (...args) => {
2477
+ console.warn(...args);
2478
+ };
2479
+
2480
+ // TODO combine Ajax with cache (specify strategy: cacheFirst, networkFirst)
2481
+ const getBuiltinPicks = async () => {
2482
+ const builtinPicks = getAll();
2483
+ return builtinPicks;
2484
+ };
2485
+ const prefixIdWithExt = item => {
2486
+ if (!item.label) {
2487
+ warn('[QuickPick] item has missing label', item);
2488
+ }
2489
+ if (!item.id) {
2490
+ warn('[QuickPick] item has missing id', item);
2491
+ }
2492
+ return {
2493
+ ...item,
2494
+ id: `ext.${item.id}`,
2495
+ label: item.label || item.id
2496
+ };
2497
+ };
2498
+ const getExtensionPicks = async () => {
2499
+ try {
2500
+ // TODO don't call this every time
2501
+ const extensionPicks = await invoke$1('ExtensionHost.getCommands');
2502
+ if (!extensionPicks) {
2503
+ return [];
2504
+ }
2505
+ const mappedPicks = extensionPicks.map(prefixIdWithExt);
2506
+ return mappedPicks;
2507
+ } catch (error) {
2508
+ console.error(`Failed to get extension picks: ${error}`);
2509
+ return [];
2510
+ }
2511
+ };
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
2528
+ const builtinPicks = await getBuiltinPicks();
2529
+ const extensionPicks = await getExtensionPicks();
2530
+ const allPicks = [...builtinPicks, ...extensionPicks];
2531
+ const converted = allPicks.map(toProtoVisibleItem$1);
2532
+ return converted;
2533
+ };
2534
+
2535
+ const getPicks$7 = async searchValue => {
2536
+ const items = state$3.args[1] || [];
2537
+ return items;
2538
+ };
2539
+
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;
2553
+ default:
2554
+ return File$2;
2555
+ }
2556
+ };
2557
+
2558
+ const state$1 = {
2559
+ provider: Noop,
2560
+ prefix: 'string-that-should-never-match-another-string'
2561
+ };
2562
+
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;
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);
2402
2575
  return picks;
2403
2576
  };
2404
2577
 
@@ -2417,12 +2590,12 @@ const getProtocol = uri => {
2417
2590
  return '';
2418
2591
  };
2419
2592
 
2420
- const state$9 = Object.create(null);
2593
+ const state = Object.create(null);
2421
2594
  const register = modules => {
2422
- Object.assign(state$9, modules);
2595
+ Object.assign(state, modules);
2423
2596
  };
2424
2597
  const getModule = protocol => {
2425
- return state$9[protocol];
2598
+ return state[protocol];
2426
2599
  };
2427
2600
 
2428
2601
  const searchFile$5 = async (path, value, prepare, assetDir) => {
@@ -2458,7 +2631,7 @@ const convertToPick = uri => {
2458
2631
  const dirName = pathDirName(uri);
2459
2632
  return {
2460
2633
  description: dirName,
2461
- direntType: File$2,
2634
+ direntType: File$1,
2462
2635
  fileIcon: '',
2463
2636
  icon: '',
2464
2637
  label: baseName,
@@ -2471,7 +2644,7 @@ const convertToPick = uri => {
2471
2644
  // e.g. when there are many files, don't need
2472
2645
  // to compute the fileIcon for all files
2473
2646
 
2474
- const getPicks$8 = async searchValue => {
2647
+ const getPicks$5 = async searchValue => {
2475
2648
  // TODO cache workspace path
2476
2649
  const workspace = await getWorkspacePath();
2477
2650
  if (!workspace) {
@@ -2482,147 +2655,50 @@ const getPicks$8 = async searchValue => {
2482
2655
  return picks;
2483
2656
  };
2484
2657
 
2485
- const setColorTheme = id => {
2486
- return invoke$1(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
2658
+ const getRecentlyOpened = () => {
2659
+ return invoke$1(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
2487
2660
  };
2488
2661
 
2489
- const selectPick$9 = async pick => {
2490
- const id = pick.label;
2491
- await setColorTheme(/* colorThemeId */id);
2662
+ const toProtoVisibleItem = uri => {
2492
2663
  return {
2493
- command: Hide
2664
+ label: uri,
2665
+ description: '',
2666
+ fileIcon: '',
2667
+ icon: '',
2668
+ matches: [],
2669
+ direntType: Directory,
2670
+ uri: uri
2494
2671
  };
2495
2672
  };
2496
-
2497
- const focusPick = async pick => {
2498
- await setColorTheme(/* colorThemeId */pick);
2673
+ const getPicks$4 = async () => {
2674
+ const recentlyOpened = await getRecentlyOpened();
2675
+ const picks = recentlyOpened.map(toProtoVisibleItem);
2676
+ return picks;
2499
2677
  };
2500
2678
 
2501
- const getPlaceholder$9 = () => {
2502
- return selectColorTheme();
2503
- };
2504
- const getLabel$5 = () => {
2505
- return selectColorTheme();
2506
- };
2507
- const getFilterValue$9 = value => {
2508
- return value;
2509
- };
2510
- const getNoResults$9 = () => {
2511
- return {
2512
- label: noMatchingColorThemesFound()
2513
- };
2514
- };
2515
- const getPickFilterValue$9 = pick => {
2516
- return pick;
2517
- };
2518
- const getPickLabel$8 = pick => {
2519
- return pick;
2520
- };
2521
- const getPickIcon$8 = pick => {
2522
- return '';
2523
- };
2524
- const state$8 = {};
2525
- const getPickDescription$8 = value => {
2526
- return '';
2527
- };
2528
- const isPrepared$8 = () => {
2529
- return false;
2679
+ const getPicks$3 = async () => {
2680
+ const picks = [];
2681
+ return picks;
2530
2682
  };
2531
- const name$9 = '';
2532
- const getHelpEntries$2 = () => {
2683
+
2684
+ const getPicks$2 = async () => {
2685
+ // const views = ViewService.getViews()
2686
+ // const picks = views.map(toPick)
2687
+ // return picks
2533
2688
  return [];
2534
2689
  };
2535
2690
 
2536
- const QuickPickEntriesColorTheme = {
2537
- __proto__: null,
2538
- focusPick,
2539
- getFilterValue: getFilterValue$9,
2540
- getHelpEntries: getHelpEntries$2,
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,
2552
- state: state$8
2691
+ const getPicks$1 = async () => {
2692
+ const picks = [];
2693
+ return picks;
2553
2694
  };
2554
2695
 
2555
- const handleError = async (error, notify = true, prefix = '') => {
2556
- console.error(error);
2557
- };
2558
- const showErrorDialog = async error => {
2559
- const code = error.code;
2560
- const message = error.message;
2561
- const stack = error.stack;
2562
- const name = error.name;
2563
- const errorInfo = {
2564
- code,
2565
- message,
2566
- stack,
2567
- name
2696
+ const selectPick$7 = async pick => {
2697
+ const id = pick.label;
2698
+ await setColorTheme(/* colorThemeId */id);
2699
+ return {
2700
+ command: Hide
2568
2701
  };
2569
- await invoke$1('ErrorHandling.showErrorDialog', errorInfo);
2570
- };
2571
- const warn = (...args) => {
2572
- console.warn(...args);
2573
- };
2574
-
2575
- // TODO combine Ajax with cache (specify strategy: cacheFirst, networkFirst)
2576
- const getBuiltinPicks = async () => {
2577
- const builtinPicks = getAll();
2578
- return builtinPicks;
2579
- };
2580
- const prefixIdWithExt = item => {
2581
- if (!item.label) {
2582
- warn('[QuickPick] item has missing label', item);
2583
- }
2584
- if (!item.id) {
2585
- warn('[QuickPick] item has missing id', item);
2586
- }
2587
- return {
2588
- ...item,
2589
- id: `ext.${item.id}`,
2590
- label: item.label || item.id
2591
- };
2592
- };
2593
- const getExtensionPicks = async () => {
2594
- try {
2595
- // TODO don't call this every time
2596
- const extensionPicks = await invoke$1('ExtensionHost.getCommands');
2597
- if (!extensionPicks) {
2598
- return [];
2599
- }
2600
- const mappedPicks = extensionPicks.map(prefixIdWithExt);
2601
- return mappedPicks;
2602
- } catch (error) {
2603
- console.error(`Failed to get extension picks: ${error}`);
2604
- return [];
2605
- }
2606
- };
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
2621
- const builtinPicks = await getBuiltinPicks();
2622
- const extensionPicks = await getExtensionPicks();
2623
- const allPicks = [...builtinPicks, ...extensionPicks];
2624
- const converted = allPicks.map(toProtoVisibleItem);
2625
- return converted;
2626
2702
  };
2627
2703
 
2628
2704
  const shouldHide = item => {
@@ -2656,7 +2732,7 @@ const selectPickExtension = async item => {
2656
2732
  command: Hide
2657
2733
  };
2658
2734
  };
2659
- const selectPick$8 = async item => {
2735
+ const selectPick$6 = async item => {
2660
2736
  // @ts-ignore
2661
2737
  const id = item.id;
2662
2738
  if (id.startsWith('ext.')) {
@@ -2665,72 +2741,10 @@ const selectPick$8 = async item => {
2665
2741
  return selectPickBuiltin(item);
2666
2742
  };
2667
2743
 
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 => {
2688
- return value.trim();
2689
- };
2690
- const getPickFilterValue$8 = pick => {
2691
- return pick.label;
2692
- };
2693
- const getPickLabel$7 = pick => {
2694
- return pick.label;
2695
- };
2696
- const getPickIcon$7 = () => {
2697
- return '';
2698
- };
2699
-
2700
- const QuickPickEntriesCommand = {
2701
- __proto__: null,
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,
2714
- state: state$7
2715
- };
2716
-
2717
- const Tag$1 = 'Tag';
2718
- const Cloud$1 = 'Cloud';
2719
- const SourceControl$1 = 'SourceControl';
2720
- const None$1 = '';
2721
-
2722
- const SourceControl = 1;
2723
- const Cloud = 2;
2724
- const Tag = 3;
2725
-
2726
- const state$6 = {
2727
- args: []
2728
- };
2729
-
2730
- const selectPick$7 = async pick => {
2744
+ const selectPick$5 = async pick => {
2731
2745
  const {
2732
2746
  args
2733
- } = state$6;
2747
+ } = state$3;
2734
2748
  const resolve = args[2];
2735
2749
  resolve(pick);
2736
2750
  return {
@@ -2738,305 +2752,19 @@ const selectPick$7 = async pick => {
2738
2752
  };
2739
2753
  };
2740
2754
 
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;
2767
- };
2768
- const getPickFilterValue$7 = pick => {
2769
- return pick;
2770
- };
2771
- const getPickLabel$6 = pick => {
2772
- return pick.label;
2773
- };
2774
- const getPickDescription$6 = pick => {
2775
- return pick.description || '';
2776
- };
2777
- const convertIcon = icon => {
2778
- switch (icon) {
2779
- case SourceControl:
2780
- return SourceControl$1;
2781
- case Cloud:
2782
- return Cloud$1;
2783
- case Tag:
2784
- return Tag$1;
2785
- default:
2786
- return None$1;
2787
- }
2788
- };
2789
- const getPickIcon$6 = pick => {
2790
- return convertIcon(pick.icon);
2791
- };
2792
- const isPrepared$6 = () => {
2793
- return true;
2794
- };
2795
-
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
2813
- };
2814
-
2815
- const name$6 = 'noop';
2816
- const getPlaceholder$6 = () => {
2817
- return '';
2818
- };
2819
- const getNoResults$6 = () => {
2820
- return noResults();
2821
- };
2822
- const getPicks$5 = async value => {
2823
- return [];
2824
- };
2825
- const selectPick$6 = async item => {
2826
- return {
2827
- command: Hide
2828
- };
2829
- };
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
- }
2907
- };
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 => {
2926
- const {
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 ')
2956
- };
2957
- const getFilterValue$5 = value => {
2958
- return value.slice(state$5.prefix.length).trim();
2959
- };
2960
- const getPickFilterValue$5 = pick => {
2961
- const {
2962
- provider
2963
- } = state$5;
2964
- // @ts-ignore
2965
- return provider.getPickFilterValue(pick);
2966
- };
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 '';
2977
- };
2978
- const getPickLabel$5 = pick => {
2979
- const {
2980
- provider
2981
- } = state$5;
2982
- // @ts-ignore
2983
- return provider.getPickLabel(pick);
2984
- };
2985
- const getPickIcon$5 = pick => {
2755
+ const selectPick$4 = item => {
2986
2756
  const {
2987
2757
  provider
2988
- } = state$5;
2989
- // @ts-ignore
2990
- return provider.getPickIcon(pick);
2991
- };
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;
3002
- };
3003
- const isPrepared$5 = () => {
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;
3013
- };
3014
-
3015
- const QuickPickEntriesEverything = {
3016
- __proto__: null,
3017
- getFilterValue: getFilterValue$5,
3018
- getLabel: getLabel$2,
3019
- getNoResults: getNoResults$5,
3020
- getPickDescription: getPickDescription$5,
3021
- getPickFileIcon: getPickFileIcon$2,
3022
- getPickFilterValue: getPickFilterValue$5,
3023
- getPickIcon: getPickIcon$5,
3024
- getPickLabel: getPickLabel$5,
3025
- getPicks: getPicks$4,
3026
- getPlaceholder: getPlaceholder$5,
3027
- isPrepared: isPrepared$5,
3028
- name: name$5,
3029
- openCommandPalette,
3030
- openView,
3031
- selectPick: selectPick$5,
3032
- state: state$5
2758
+ } = state$1;
2759
+ const fn = getSelect(provider);
2760
+ return fn(item);
3033
2761
  };
3034
2762
 
3035
2763
  const openUri = async uri => {
3036
2764
  await invoke$1(/* Main.openUri */'Main.openUri', /* uri */uri);
3037
2765
  };
3038
2766
 
3039
- const selectPick$4 = async pick => {
2767
+ const selectPick$3 = async pick => {
3040
2768
  const description = pick.description;
3041
2769
  const fileName = pick.label;
3042
2770
  const workspace = await getWorkspacePath();
@@ -3047,88 +2775,12 @@ const selectPick$4 = async pick => {
3047
2775
  };
3048
2776
  };
3049
2777
 
3050
- const state$4 = {};
3051
- const name$4 = 'file';
3052
- const getPlaceholder$4 = () => {
3053
- return '';
3054
- };
3055
- const getLabel$1 = () => {
3056
- return files();
3057
- };
3058
- const getNoResults$4 = () => {
3059
- return {
3060
- label: noMatchingResults()
3061
- };
3062
- };
3063
- const getFilterValue$4 = value => {
3064
- return value;
3065
- };
3066
- const getPickFilterValue$4 = pick => {
3067
- if (typeof pick === 'object') {
3068
- pick = pick.pick;
3069
- }
3070
- return pick;
3071
- };
3072
- const getPickLabel$4 = pick => {
3073
- if (typeof pick === 'object') {
3074
- pick = pick.pick;
3075
- }
3076
- const baseName = pathBaseName(pick);
3077
- return baseName;
3078
- };
3079
- const getPickDescription$4 = pick => {
3080
- if (typeof pick === 'object') {
3081
- pick = pick.pick;
3082
- }
3083
- const dirName = pathDirName(pick);
3084
- return dirName;
3085
- };
3086
- const getPickIcon$4 = () => {
3087
- return '';
3088
- };
3089
- const getPickFileIcon$1 = pick => {
3090
- const path = `${pick.description}/${pick.label}`;
3091
- return {
3092
- type: File$2,
3093
- name: pick.label,
3094
- path
3095
- };
3096
- };
3097
- const isPrepared$4 = () => {
3098
- const workspace = '';
3099
- // TODO protocol should always be defined. For files it should use file protocol
3100
- const protocol = getProtocol(workspace);
3101
- return !protocol;
3102
- };
3103
-
3104
- const QuickPickEntriesFile = {
3105
- __proto__: null,
3106
- getFilterValue: getFilterValue$4,
3107
- getLabel: getLabel$1,
3108
- getNoResults: getNoResults$4,
3109
- getPickDescription: getPickDescription$4,
3110
- getPickFileIcon: getPickFileIcon$1,
3111
- getPickFilterValue: getPickFilterValue$4,
3112
- getPickIcon: getPickIcon$4,
3113
- getPickLabel: getPickLabel$4,
3114
- getPicks: getPicks$8,
3115
- getPlaceholder: getPlaceholder$4,
3116
- isPrepared: isPrepared$4,
3117
- name: name$4,
3118
- selectPick: selectPick$4,
3119
- state: state$4
3120
- };
3121
-
3122
- const getRecentlyOpened = () => {
3123
- return invoke$1(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
3124
- };
3125
-
3126
2778
  const openWorkspaceFolder = uri => {
3127
2779
  return invoke$1(/* Workspace.setPath */'Workspace.setPath', /* path */uri);
3128
2780
  };
3129
2781
 
3130
2782
  // TODO selectPick should be independent of show/hide
3131
- const selectPick$3 = async pick => {
2783
+ const selectPick$2 = async pick => {
3132
2784
  const path = `${pick.description}/${pick.label}`;
3133
2785
  await openWorkspaceFolder(path);
3134
2786
  return {
@@ -3136,258 +2788,40 @@ const selectPick$3 = async pick => {
3136
2788
  };
3137
2789
  };
3138
2790
 
3139
- const getPlaceholder$3 = () => {
3140
- return selectToOpen();
3141
- };
3142
- const getLabel = () => {
3143
- return openRecent();
3144
- };
3145
- const getNoResults$3 = () => {
3146
- return {
3147
- label: noRecentlyOpenedFoldersFound()
3148
- };
3149
- };
3150
-
3151
- // TODO could also change api so that getPicks returns an array of anything
3152
- // and the transformPick gets the label for each pick
3153
- // This would make the code more module since the code for getting the picks
3154
- // would be more independent of the specific data format of the quickpick provider
3155
-
3156
- const getPicks$3 = async () => {
3157
- const recentlyOpened = await getRecentlyOpened();
3158
- return recentlyOpened;
3159
- };
3160
- const getFilterValue$3 = value => {
3161
- return pathBaseName(value);
3162
- };
3163
- const getPickFilterValue$3 = pick => {
3164
- return pathBaseName(pick);
3165
- };
3166
- const getPickLabel$3 = pick => {
3167
- return pathBaseName(pick);
3168
- };
3169
- const getPickDescription$3 = pick => {
3170
- return pathDirName(pick);
3171
- };
3172
- const getPickIcon$3 = () => {
3173
- return '';
3174
- };
3175
- const getPickFileIcon = pick => {
3176
- const baseName = pick.label;
3177
- const path = `${pick.description}/${pick.label}`;
3178
- return {
3179
- type: File$2,
3180
- name: baseName,
3181
- path
3182
- };
3183
- };
3184
- const state$3 = {};
3185
- const isPrepared$3 = () => {
3186
- return false;
3187
- };
3188
- const name$3 = '';
3189
-
3190
- const QuickPickEntriesOpenRecent = {
3191
- __proto__: null,
3192
- getFilterValue: getFilterValue$3,
3193
- getLabel,
3194
- getNoResults: getNoResults$3,
3195
- getPickDescription: getPickDescription$3,
3196
- getPickFileIcon,
3197
- getPickFilterValue: getPickFilterValue$3,
3198
- getPickIcon: getPickIcon$3,
3199
- getPickLabel: getPickLabel$3,
3200
- getPicks: getPicks$3,
3201
- getPlaceholder: getPlaceholder$3,
3202
- isPrepared: isPrepared$3,
3203
- name: name$3,
3204
- selectPick: selectPick$3,
3205
- state: state$3
3206
- };
3207
-
3208
- const selectPick$2 = async item => {
3209
- return {
3210
- command: Hide
3211
- };
3212
- };
3213
-
3214
- const name$2 = 'symbol';
3215
- const getPlaceholder$2 = () => {
3216
- return '';
3217
- };
3218
- const getNoResults$2 = () => {
3219
- return {
3220
- label: noSymbolFound()
3221
- };
3222
- };
3223
- const getPicks$2 = async () => {
3224
- const picks = [];
3225
- return picks;
3226
- };
3227
- const getFilterValue$2 = value => {
3228
- return value;
3229
- };
3230
- const state$2 = {};
3231
- const getPickDescription$2 = value => {
3232
- return '';
3233
- };
3234
- const isPrepared$2 = () => {
3235
- return false;
3236
- };
3237
- const getPickFilterValue$2 = value => {
3238
- return value;
3239
- };
3240
- const getPickLabel$2 = value => {
3241
- return value;
3242
- };
3243
- const getPickIcon$2 = value => {
3244
- return '';
3245
- };
3246
-
3247
- const QuickPickEntriesSymbol = {
3248
- __proto__: null,
3249
- getFilterValue: getFilterValue$2,
3250
- getNoResults: getNoResults$2,
3251
- getPickDescription: getPickDescription$2,
3252
- getPickFilterValue: getPickFilterValue$2,
3253
- getPickIcon: getPickIcon$2,
3254
- getPickLabel: getPickLabel$2,
3255
- getPicks: getPicks$2,
3256
- getPlaceholder: getPlaceholder$2,
3257
- isPrepared: isPrepared$2,
3258
- name: name$2,
3259
- selectPick: selectPick$2,
3260
- state: state$2
3261
- };
3262
-
3263
2791
  const selectPick$1 = async item => {
3264
- // Command.execute(/* openView */ 549, /* viewName */ item.label)
3265
2792
  return {
3266
2793
  command: Hide
3267
2794
  };
3268
2795
  };
3269
2796
 
3270
- // TODO probably not needed
3271
-
3272
- const getPlaceholder$1 = () => {
3273
- return typeNameofCommandToRun();
3274
- };
3275
- const getHelpEntries = () => {
3276
- return undefined;
3277
- };
3278
- const getPicks$1 = async () => {
3279
- // const views = ViewService.getViews()
3280
- // const picks = views.map(toPick)
3281
- // return picks
3282
- return [];
3283
- };
3284
- const getFilterValue$1 = value => {
3285
- return value;
3286
- };
3287
- const getPickFilterValue$1 = value => {
3288
- return value;
3289
- };
3290
- const getPickLabel$1 = value => {
3291
- return value;
3292
- };
3293
- const getPickIcon$1 = value => {
3294
- return '';
3295
- };
3296
- const state$1 = {};
3297
- const getNoResults$1 = () => {
3298
- return '';
3299
- };
3300
- const name$1 = '';
3301
- const isPrepared$1 = () => {
3302
- return true;
3303
- };
3304
- const getPickDescription$1 = () => {
3305
- return '';
3306
- };
3307
-
3308
- const QuickPickEntriesView = {
3309
- __proto__: null,
3310
- getFilterValue: getFilterValue$1,
3311
- getHelpEntries,
3312
- getNoResults: getNoResults$1,
3313
- getPickDescription: getPickDescription$1,
3314
- getPickFilterValue: getPickFilterValue$1,
3315
- getPickIcon: getPickIcon$1,
3316
- getPickLabel: getPickLabel$1,
3317
- getPicks: getPicks$1,
3318
- getPlaceholder: getPlaceholder$1,
3319
- isPrepared: isPrepared$1,
3320
- name: name$1,
3321
- selectPick: selectPick$1,
3322
- state: state$1
3323
- };
3324
-
3325
2797
  const selectPick = async item => {
3326
2798
  return {
3327
2799
  command: Hide
3328
2800
  };
3329
2801
  };
3330
2802
 
3331
- const name = 'workspace-symbol';
3332
- const getPlaceholder = () => {
3333
- return '';
3334
- };
3335
- const state = {};
3336
- const getPickIcon = () => {
3337
- return '';
3338
- };
3339
- const isPrepared = () => {
3340
- return false;
3341
- };
3342
- const getPickLabel = () => {
3343
- return '';
3344
- };
3345
- const getPickFilterValue = () => {
3346
- return '';
3347
- };
3348
- const getPickDescription = () => {
3349
- return '';
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
3350
2813
  };
3351
- const getNoResults = () => {
3352
- return {
3353
- label: noWorkspaceSymbolsFound()
3354
- };
3355
- };
3356
- const getPicks = async () => {
3357
- const picks = [];
3358
- return picks;
3359
- };
3360
- const getFilterValue = value => {
3361
- return value;
3362
- };
3363
-
3364
- const QuickPickEntriesWorkspaceSymbol = {
3365
- __proto__: null,
3366
- getFilterValue,
3367
- getNoResults,
3368
- getPickDescription,
3369
- getPickFilterValue,
3370
- getPickIcon,
3371
- getPickLabel,
3372
- getPicks,
3373
- getPlaceholder,
3374
- isPrepared,
3375
- name,
3376
- selectPick,
3377
- state
3378
- };
3379
-
3380
- const quickPickEntriesModules = {
3381
- [ColorTheme]: QuickPickEntriesColorTheme,
3382
- [CommandPalette]: QuickPickEntriesEverything,
3383
- [Commands]: QuickPickEntriesCommand,
3384
- [Custom]: QuickPickEntriesCustom,
3385
- [EveryThing]: QuickPickEntriesEverything,
3386
- [File$1]: QuickPickEntriesFile,
3387
- [Recent]: QuickPickEntriesOpenRecent,
3388
- [Symbol]: QuickPickEntriesSymbol,
3389
- [View]: QuickPickEntriesView,
3390
- [WorkspaceSymbol]: QuickPickEntriesWorkspaceSymbol
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
3391
2825
  };
3392
2826
 
3393
2827
  const Memfs = 'memfs';
@@ -3451,7 +2885,8 @@ const searchModules = {
3451
2885
 
3452
2886
  const listen = async () => {
3453
2887
  register(searchModules);
3454
- register$1(quickPickEntriesModules);
2888
+ registerSelect(selectPicks);
2889
+ registerGetPick(getPicks);
3455
2890
  const rpc = await WebWorkerRpcClient.create({
3456
2891
  commandMap: commandMap
3457
2892
  });