@lvce-editor/file-search-worker 5.6.0 → 5.8.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,13 +780,13 @@ 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 => {
787
787
  return commands[key];
788
788
  };
789
- const execute = (command, ...args) => {
789
+ const execute$1 = (command, ...args) => {
790
790
  const fn = getCommand(command);
791
791
  if (!fn) {
792
792
  throw new Error(`command not found ${command}`);
@@ -827,7 +827,7 @@ const logError = () => {
827
827
  };
828
828
  const handleMessage = event => {
829
829
  const actualRequiresSocket = event?.target?.requiresSocket || requiresSocket;
830
- const actualExecute = event?.target?.execute || execute;
830
+ const actualExecute = event?.target?.execute || execute$1;
831
831
  return handleJsonRpcMessage(event.target, event.data, actualExecute, resolve, preparePrettyError, logError, actualRequiresSocket);
832
832
  };
833
833
  const handleIpc = ipc => {
@@ -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,55 @@ 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;
1082
-
1083
1117
  const getMissingIconRequests = (dirents, fileIconCache) => {
1084
1118
  const missingRequests = [];
1085
1119
  for (const dirent of dirents) {
1120
+ if (!dirent.path) {
1121
+ continue;
1122
+ }
1086
1123
  if (!(dirent.path in fileIconCache)) {
1087
1124
  missingRequests.push({
1088
- type: File$2,
1125
+ type: dirent.type,
1089
1126
  name: dirent.name,
1090
1127
  path: dirent.path
1091
1128
  });
@@ -1094,17 +1131,22 @@ const getMissingIconRequests = (dirents, fileIconCache) => {
1094
1131
  return missingRequests;
1095
1132
  };
1096
1133
 
1097
- const requestFileIcons = async requests => {
1098
- const promises = requests.map(request => {
1099
- if (!request.name) {
1100
- return '';
1101
- }
1102
- return request.type === File$2 ? invoke$1('IconTheme.getFileIcon', {
1103
- name: request.name
1104
- }) : invoke$1('IconTheme.getFolderIcon', {
1105
- name: request.name
1106
- });
1134
+ const None$2 = 0;
1135
+ const Directory = 3;
1136
+ const File$1 = 7;
1137
+
1138
+ const requestFileIcon = async request => {
1139
+ if (!request.name) {
1140
+ return '';
1141
+ }
1142
+ return request.type === File$1 ? invoke$1('IconTheme.getFileIcon', {
1143
+ name: request.name
1144
+ }) : invoke$1('IconTheme.getFolderIcon', {
1145
+ name: request.name
1107
1146
  });
1147
+ };
1148
+ const requestFileIcons = async requests => {
1149
+ const promises = requests.map(requestFileIcon);
1108
1150
  return Promise.all(promises);
1109
1151
  };
1110
1152
 
@@ -1123,19 +1165,23 @@ const updateIconCache = (iconCache, missingRequests, newIcons) => {
1123
1165
  return newFileIconCache;
1124
1166
  };
1125
1167
 
1126
- const getQuickPickFileIcons = async (provider, items, fileIconCache) => {
1127
- const dirents = items.map(item => {
1128
- const dirent = {
1129
- type: item.direntType,
1130
- name: item.label,
1131
- path: item.uri
1132
- };
1133
- return dirent;
1134
- });
1168
+ const getPath = dirent => {
1169
+ return dirent.path;
1170
+ };
1171
+ const toDirent = pick => {
1172
+ const dirent = {
1173
+ type: pick.direntType,
1174
+ name: pick.label,
1175
+ path: pick.uri
1176
+ };
1177
+ return dirent;
1178
+ };
1179
+ const getQuickPickFileIcons = async (items, fileIconCache) => {
1180
+ const dirents = items.map(toDirent);
1135
1181
  const missingRequests = getMissingIconRequests(dirents, fileIconCache);
1136
1182
  const newIcons = await requestFileIcons(missingRequests);
1137
1183
  const newFileIconCache = updateIconCache(fileIconCache, missingRequests, newIcons);
1138
- const paths = dirents.map(file => file.path);
1184
+ const paths = dirents.map(getPath);
1139
1185
  const icons = getIconsCached(paths, newFileIconCache);
1140
1186
  return {
1141
1187
  icons,
@@ -1143,26 +1189,6 @@ const getQuickPickFileIcons = async (provider, items, fileIconCache) => {
1143
1189
  };
1144
1190
  };
1145
1191
 
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
1192
  const focusIndex = async (state, index) => {
1167
1193
  const {
1168
1194
  uri,
@@ -1172,14 +1198,7 @@ const focusIndex = async (state, index) => {
1172
1198
  maxLineY,
1173
1199
  fileIconCache
1174
1200
  } = 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
- }
1201
+ await focusPick(uri, items[index]);
1183
1202
  if (index < minLineY + 1) {
1184
1203
  const minLineY = index;
1185
1204
  const maxLineY = Math.min(index + maxVisibleItems, items.length - 1);
@@ -1187,7 +1206,7 @@ const focusIndex = async (state, index) => {
1187
1206
  const {
1188
1207
  newFileIconCache,
1189
1208
  icons
1190
- } = await getQuickPickFileIcons(provider, sliced, fileIconCache);
1209
+ } = await getQuickPickFileIcons(sliced, fileIconCache);
1191
1210
 
1192
1211
  // TODO need to scroll up
1193
1212
  return {
@@ -1207,7 +1226,7 @@ const focusIndex = async (state, index) => {
1207
1226
  const {
1208
1227
  newFileIconCache,
1209
1228
  icons
1210
- } = await getQuickPickFileIcons(provider, sliced, fileIconCache);
1229
+ } = await getQuickPickFileIcons(sliced, fileIconCache);
1211
1230
  return {
1212
1231
  ...state,
1213
1232
  minLineY,
@@ -1221,7 +1240,7 @@ const focusIndex = async (state, index) => {
1221
1240
  const {
1222
1241
  newFileIconCache,
1223
1242
  icons
1224
- } = await getQuickPickFileIcons(provider, sliced, fileIconCache);
1243
+ } = await getQuickPickFileIcons(sliced, fileIconCache);
1225
1244
  return {
1226
1245
  ...state,
1227
1246
  focusedIndex: index,
@@ -1642,8 +1661,73 @@ const filterQuickPickItems = (items, value) => {
1642
1661
  return results;
1643
1662
  };
1644
1663
 
1645
- const getPicks$a = (id, searchValue) => {
1646
- const fn = getPicks$b(id);
1664
+ const Command = '>';
1665
+ const Symbol = '@';
1666
+ const WorkspaceSymbol = '#';
1667
+ const GoToLine = ':';
1668
+ const View = 'view ';
1669
+ const None$1 = '';
1670
+
1671
+ const getQuickPickPrefix = value => {
1672
+ if (value.startsWith(Command)) {
1673
+ return Command;
1674
+ }
1675
+ if (value.startsWith(Symbol)) {
1676
+ return Symbol;
1677
+ }
1678
+ if (value.startsWith(WorkspaceSymbol)) {
1679
+ return WorkspaceSymbol;
1680
+ }
1681
+ if (value.startsWith(GoToLine)) {
1682
+ return GoToLine;
1683
+ }
1684
+ if (value.startsWith(View)) {
1685
+ return View;
1686
+ }
1687
+ return None$1;
1688
+ };
1689
+
1690
+ const noop$1 = value => {
1691
+ return value;
1692
+ };
1693
+ const getFilterValueEverything = value => {
1694
+ const prefix = getQuickPickPrefix(value);
1695
+ const prefixLength = prefix.length;
1696
+ return value.slice(prefixLength).trim();
1697
+ };
1698
+ const getFn$1 = id => {
1699
+ switch (id) {
1700
+ case EveryThing:
1701
+ return getFilterValueEverything;
1702
+ default:
1703
+ return noop$1;
1704
+ }
1705
+ };
1706
+ const getFilterValue = (id, value) => {
1707
+ const fn = getFn$1(id);
1708
+ const filterValue = fn(value);
1709
+ return filterValue;
1710
+ };
1711
+
1712
+ const select = Object.create(null);
1713
+ const getPick$1 = Object.create(null);
1714
+ const registerSelect = modules => {
1715
+ Object.assign(select, modules);
1716
+ };
1717
+ const registerGetPick = modules => {
1718
+ Object.assign(getPick$1, modules);
1719
+ };
1720
+ const getPicks$c = id => {
1721
+ const fn = getPick$1[id];
1722
+ return fn;
1723
+ };
1724
+ const getSelect = id => {
1725
+ const fn = select[id];
1726
+ return fn;
1727
+ };
1728
+
1729
+ const getPicks$b = (id, searchValue) => {
1730
+ const fn = getPicks$c(id);
1647
1731
  return fn(searchValue);
1648
1732
  };
1649
1733
 
@@ -1659,17 +1743,15 @@ const setValue = async (state, newValue) => {
1659
1743
  if (value === newValue) {
1660
1744
  return state;
1661
1745
  }
1662
- const provider = get(uri);
1663
- const newPicks = await getPicks$a(uri, newValue);
1664
- // @ts-ignore
1665
- const filterValue = provider.getFilterValue(newValue);
1746
+ const newPicks = await getPicks$b(uri, newValue);
1747
+ const filterValue = getFilterValue(uri, newValue);
1666
1748
  const items = filterQuickPickItems(newPicks, filterValue);
1667
1749
  const focusedIndex = items.length === 0 ? -1 : 0;
1668
- const sliced = newPicks.slice(minLineY, maxLineY);
1750
+ const sliced = items.slice(minLineY, maxLineY);
1669
1751
  const {
1670
1752
  newFileIconCache,
1671
1753
  icons
1672
- } = await getQuickPickFileIcons(provider, sliced, fileIconCache);
1754
+ } = await getQuickPickFileIcons(sliced, fileIconCache);
1673
1755
  return {
1674
1756
  ...state,
1675
1757
  picks: newPicks,
@@ -1738,14 +1820,13 @@ const selectIndex = async (state, index, button = /* left */0) => {
1738
1820
  uri,
1739
1821
  items
1740
1822
  } = state;
1741
- const provider = get(uri);
1742
1823
  const actualIndex = index + minLineY;
1743
1824
  const pick = getPick(items, actualIndex);
1744
1825
  if (!pick) {
1745
1826
  return state;
1746
1827
  }
1747
- // @ts-ignore
1748
- const selectPickResult = await provider.selectPick(pick, actualIndex, button);
1828
+ const fn = getSelect(uri);
1829
+ const selectPickResult = await fn(pick);
1749
1830
  object(selectPickResult);
1750
1831
  string(selectPickResult.command);
1751
1832
  const {
@@ -1801,6 +1882,27 @@ const getDefaultValue = uri => {
1801
1882
  }
1802
1883
  };
1803
1884
 
1885
+ const state$3 = {
1886
+ args: []
1887
+ };
1888
+
1889
+ const noop = args => {};
1890
+ const setArgsCustom = args => {
1891
+ state$3.args = args;
1892
+ };
1893
+ const getFn = id => {
1894
+ switch (id) {
1895
+ case Custom:
1896
+ return setArgsCustom;
1897
+ default:
1898
+ return noop;
1899
+ }
1900
+ };
1901
+ const setArgs = (id, args) => {
1902
+ const fn = getFn(id);
1903
+ return fn(args);
1904
+ };
1905
+
1804
1906
  const loadContent = async state => {
1805
1907
  const {
1806
1908
  uri,
@@ -1808,16 +1910,10 @@ const loadContent = async state => {
1808
1910
  fileIconCache
1809
1911
  } = state;
1810
1912
  const value = getDefaultValue(uri);
1811
- const provider = get(uri);
1812
- // @ts-ignore
1813
- if (provider.setArgs) {
1814
- // @ts-ignore
1815
- provider.setArgs(args);
1816
- }
1817
- const newPicks = await getPicks$a(uri, value);
1913
+ setArgs(uri, args);
1914
+ const newPicks = await getPicks$b(uri, value);
1818
1915
  array(newPicks);
1819
- // @ts-ignore
1820
- const filterValue = provider.getFilterValue(value);
1916
+ const filterValue = getFilterValue(uri, value);
1821
1917
  const items = filterQuickPickItems(newPicks, filterValue);
1822
1918
  const minLineY = 0;
1823
1919
  const maxLineY = Math.min(minLineY + state.maxVisibleItems, newPicks.length);
@@ -1825,7 +1921,7 @@ const loadContent = async state => {
1825
1921
  const {
1826
1922
  newFileIconCache,
1827
1923
  icons
1828
- } = await getQuickPickFileIcons(provider, sliced, fileIconCache);
1924
+ } = await getQuickPickFileIcons(sliced, fileIconCache);
1829
1925
  return {
1830
1926
  ...state,
1831
1927
  picks: newPicks,
@@ -1843,14 +1939,14 @@ const loadContent = async state => {
1843
1939
  };
1844
1940
  };
1845
1941
 
1846
- const state$a = {
1942
+ const state$2 = {
1847
1943
  menuEntries: []
1848
1944
  };
1849
1945
  const getAll = () => {
1850
- return state$a.menuEntries;
1946
+ return state$2.menuEntries;
1851
1947
  };
1852
1948
  const add = menuEntries => {
1853
- state$a.menuEntries = [...state$a.menuEntries, ...menuEntries];
1949
+ state$2.menuEntries = [...state$2.menuEntries, ...menuEntries];
1854
1950
  };
1855
1951
 
1856
1952
  const getVisible$1 = (items, minLineY, maxLineY, icons) => {
@@ -1924,7 +2020,7 @@ const renderHeight = newState => {
1924
2020
 
1925
2021
  const ComboBox = 'combobox';
1926
2022
  const ListBox = 'listbox';
1927
- const None$2 = 'none';
2023
+ const None = 'none';
1928
2024
  const Option = 'option';
1929
2025
 
1930
2026
  const FileIcon = 'FileIcon';
@@ -1965,52 +2061,16 @@ const i18nString = (key, placeholders = emptyObject) => {
1965
2061
  return key.replaceAll(RE_PLACEHOLDER, replacer);
1966
2062
  };
1967
2063
 
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
2064
  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
2065
  const TypeNameOfCommandToRun = 'Type the name of a command to run.';
1979
2066
  const QuickOpen = 'Quick open';
1980
2067
 
1981
- const noMatchingColorThemesFound = () => {
1982
- return i18nString(NoMatchingColorThemesFound);
1983
- };
1984
- const selectColorTheme = () => {
1985
- return i18nString(SelectColorTheme);
1986
- };
1987
2068
  const typeNameofCommandToRun = () => {
1988
2069
  return i18nString(TypeNameOfCommandToRun);
1989
2070
  };
1990
- const noMatchingResults = () => {
1991
- return i18nString(NoMatchingResults);
1992
- };
1993
- const files = () => {
1994
- return i18nString(Files);
1995
- };
1996
2071
  const noResults = () => {
1997
2072
  return i18nString(NoResults);
1998
2073
  };
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
2074
  const quickOpen = () => {
2015
2075
  return i18nString(QuickOpen);
2016
2076
  };
@@ -2137,7 +2197,7 @@ const getFileIconVirtualDom = icon => {
2137
2197
  type: Img,
2138
2198
  className: FileIcon,
2139
2199
  src: icon,
2140
- role: None$2,
2200
+ role: None,
2141
2201
  childCount: 0
2142
2202
  };
2143
2203
  };
@@ -2280,7 +2340,7 @@ const render2 = (uid, diffResult) => {
2280
2340
  const {
2281
2341
  oldState,
2282
2342
  newState
2283
- } = get$1(uid);
2343
+ } = get(uid);
2284
2344
  if (oldState === newState) {
2285
2345
  return [];
2286
2346
  }
@@ -2338,12 +2398,12 @@ const wrapCommand = fn => {
2338
2398
  const wrapped = async (uid, ...args) => {
2339
2399
  const {
2340
2400
  newState
2341
- } = get$1(uid);
2401
+ } = get(uid);
2342
2402
  const newerState = await fn(newState, ...args);
2343
2403
  if (newState === newerState) {
2344
2404
  return;
2345
2405
  }
2346
- const latest = get$1(uid);
2406
+ const latest = get(uid);
2347
2407
  set(uid, latest.oldState, newerState);
2348
2408
  };
2349
2409
  return wrapped;
@@ -2375,16 +2435,14 @@ const commandMap = {
2375
2435
  'QuickPick.selectIndex': wrapCommand(selectIndex),
2376
2436
  'QuickPick.selectItem': wrapCommand(selectItem),
2377
2437
  'QuickPick.setDeltaY': wrapCommand(setDeltaY),
2378
- 'QuickPick.setValue': wrapCommand(setValue),
2379
- // deprecated
2380
- 'QuickPick.loadEntries2': get
2438
+ 'QuickPick.setValue': wrapCommand(setValue)
2381
2439
  };
2382
2440
 
2383
2441
  const getColorThemeNames = async () => {
2384
2442
  return invoke$1(/* Ajax.getJson */'ColorTheme.getColorThemeNames');
2385
2443
  };
2386
2444
 
2387
- const toProtoVisibleItem$1 = name => {
2445
+ const toProtoVisibleItem$2 = name => {
2388
2446
  const pick = {
2389
2447
  label: name,
2390
2448
  description: '',
@@ -2396,9 +2454,127 @@ const toProtoVisibleItem$1 = name => {
2396
2454
  };
2397
2455
  return pick;
2398
2456
  };
2399
- const getPicks$9 = async searchValue => {
2457
+ const getPicks$a = async searchValue => {
2400
2458
  const colorThemeNames = await getColorThemeNames();
2401
- const picks = colorThemeNames.map(toProtoVisibleItem$1);
2459
+ const picks = colorThemeNames.map(toProtoVisibleItem$2);
2460
+ return picks;
2461
+ };
2462
+
2463
+ const handleError = async (error, notify = true, prefix = '') => {
2464
+ console.error(error);
2465
+ };
2466
+ const showErrorDialog = async error => {
2467
+ const code = error.code;
2468
+ const message = error.message;
2469
+ const stack = error.stack;
2470
+ const name = error.name;
2471
+ const errorInfo = {
2472
+ code,
2473
+ message,
2474
+ stack,
2475
+ name
2476
+ };
2477
+ await invoke$1('ErrorHandling.showErrorDialog', errorInfo);
2478
+ };
2479
+ const warn = (...args) => {
2480
+ console.warn(...args);
2481
+ };
2482
+
2483
+ // TODO combine Ajax with cache (specify strategy: cacheFirst, networkFirst)
2484
+ const getBuiltinPicks = async () => {
2485
+ const builtinPicks = getAll();
2486
+ return builtinPicks;
2487
+ };
2488
+ const prefixIdWithExt = item => {
2489
+ if (!item.label) {
2490
+ warn('[QuickPick] item has missing label', item);
2491
+ }
2492
+ if (!item.id) {
2493
+ warn('[QuickPick] item has missing id', item);
2494
+ }
2495
+ return {
2496
+ ...item,
2497
+ id: `ext.${item.id}`,
2498
+ label: item.label || item.id
2499
+ };
2500
+ };
2501
+ const getExtensionPicks = async () => {
2502
+ try {
2503
+ // TODO don't call this every time
2504
+ const extensionPicks = await invoke$1('ExtensionHost.getCommands');
2505
+ if (!extensionPicks) {
2506
+ return [];
2507
+ }
2508
+ const mappedPicks = extensionPicks.map(prefixIdWithExt);
2509
+ return mappedPicks;
2510
+ } catch (error) {
2511
+ console.error(`Failed to get extension picks: ${error}`);
2512
+ return [];
2513
+ }
2514
+ };
2515
+ const toProtoVisibleItem$1 = item => {
2516
+ const pick = {
2517
+ label: item.label,
2518
+ description: '',
2519
+ fileIcon: '',
2520
+ icon: '',
2521
+ matches: [],
2522
+ direntType: 0,
2523
+ uri: ''
2524
+ };
2525
+ // @ts-ignore
2526
+ pick.id = item.id;
2527
+ return pick;
2528
+ };
2529
+ const getPicks$9 = async () => {
2530
+ // TODO get picks in parallel
2531
+ const builtinPicks = await getBuiltinPicks();
2532
+ const extensionPicks = await getExtensionPicks();
2533
+ const allPicks = [...builtinPicks, ...extensionPicks];
2534
+ const converted = allPicks.map(toProtoVisibleItem$1);
2535
+ return converted;
2536
+ };
2537
+
2538
+ const getPicks$8 = async searchValue => {
2539
+ const items = state$3.args[1] || [];
2540
+ return items;
2541
+ };
2542
+
2543
+ // TODO use numeric enum for quickpick entry id
2544
+ const getQuickPickProviderId = prefix => {
2545
+ switch (prefix) {
2546
+ case Command:
2547
+ return Commands;
2548
+ case Symbol:
2549
+ return Symbol$1;
2550
+ case WorkspaceSymbol:
2551
+ return WorkspaceSymbol$1;
2552
+ case GoToLine:
2553
+ return GoToLine$1;
2554
+ case View:
2555
+ return View$1;
2556
+ default:
2557
+ return File$2;
2558
+ }
2559
+ };
2560
+
2561
+ const state$1 = {
2562
+ provider: Noop,
2563
+ prefix: 'string-that-should-never-match-another-string'
2564
+ };
2565
+
2566
+ const getPicks$7 = async value => {
2567
+ const prefix = getQuickPickPrefix(value);
2568
+ const providerId = getQuickPickProviderId(prefix);
2569
+
2570
+ // TODO race condition
2571
+ if (state$1.prefix !== prefix) {
2572
+ state$1.prefix = prefix;
2573
+ state$1.provider = providerId;
2574
+ }
2575
+ // TODO this line is a bit duplicated with getFilterValue
2576
+ const slicedValue = value.slice(prefix.length).trimStart();
2577
+ const picks = await getPicks$b(providerId, slicedValue);
2402
2578
  return picks;
2403
2579
  };
2404
2580
 
@@ -2417,12 +2593,12 @@ const getProtocol = uri => {
2417
2593
  return '';
2418
2594
  };
2419
2595
 
2420
- const state$9 = Object.create(null);
2596
+ const state = Object.create(null);
2421
2597
  const register = modules => {
2422
- Object.assign(state$9, modules);
2598
+ Object.assign(state, modules);
2423
2599
  };
2424
2600
  const getModule = protocol => {
2425
- return state$9[protocol];
2601
+ return state[protocol];
2426
2602
  };
2427
2603
 
2428
2604
  const searchFile$5 = async (path, value, prepare, assetDir) => {
@@ -2458,7 +2634,7 @@ const convertToPick = uri => {
2458
2634
  const dirName = pathDirName(uri);
2459
2635
  return {
2460
2636
  description: dirName,
2461
- direntType: File$2,
2637
+ direntType: File$1,
2462
2638
  fileIcon: '',
2463
2639
  icon: '',
2464
2640
  label: baseName,
@@ -2471,7 +2647,7 @@ const convertToPick = uri => {
2471
2647
  // e.g. when there are many files, don't need
2472
2648
  // to compute the fileIcon for all files
2473
2649
 
2474
- const getPicks$8 = async searchValue => {
2650
+ const getPicks$6 = async searchValue => {
2475
2651
  // TODO cache workspace path
2476
2652
  const workspace = await getWorkspacePath();
2477
2653
  if (!workspace) {
@@ -2482,147 +2658,103 @@ const getPicks$8 = async searchValue => {
2482
2658
  return picks;
2483
2659
  };
2484
2660
 
2485
- const setColorTheme = id => {
2486
- return invoke$1(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
2661
+ const getPicks$5 = async () => {
2662
+ const picks = [{
2663
+ label: '1',
2664
+ description: '',
2665
+ icon: '',
2666
+ fileIcon: '',
2667
+ matches: [],
2668
+ direntType: None$2,
2669
+ uri: ''
2670
+ }, {
2671
+ label: '2',
2672
+ description: '',
2673
+ icon: '',
2674
+ fileIcon: '',
2675
+ matches: [],
2676
+ direntType: None$2,
2677
+ uri: ''
2678
+ }, {
2679
+ label: '3',
2680
+ description: '',
2681
+ icon: '',
2682
+ fileIcon: '',
2683
+ matches: [],
2684
+ direntType: None$2,
2685
+ uri: ''
2686
+ }, {
2687
+ label: '4',
2688
+ description: '',
2689
+ icon: '',
2690
+ fileIcon: '',
2691
+ matches: [],
2692
+ direntType: None$2,
2693
+ uri: ''
2694
+ }, {
2695
+ label: '5',
2696
+ description: '',
2697
+ icon: '',
2698
+ fileIcon: '',
2699
+ matches: [],
2700
+ direntType: None$2,
2701
+ uri: ''
2702
+ }, {
2703
+ label: '6',
2704
+ description: '',
2705
+ icon: '',
2706
+ fileIcon: '',
2707
+ matches: [],
2708
+ direntType: None$2,
2709
+ uri: ''
2710
+ }];
2711
+ return picks;
2487
2712
  };
2488
2713
 
2489
- const selectPick$9 = async pick => {
2490
- const id = pick.label;
2491
- await setColorTheme(/* colorThemeId */id);
2714
+ const getRecentlyOpened = () => {
2715
+ return invoke$1(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
2716
+ };
2717
+
2718
+ const toProtoVisibleItem = uri => {
2492
2719
  return {
2493
- command: Hide
2720
+ label: uri,
2721
+ description: '',
2722
+ fileIcon: '',
2723
+ icon: '',
2724
+ matches: [],
2725
+ direntType: Directory,
2726
+ uri: uri
2494
2727
  };
2495
2728
  };
2496
-
2497
- const focusPick = async pick => {
2498
- await setColorTheme(/* colorThemeId */pick);
2729
+ const getPicks$4 = async () => {
2730
+ const recentlyOpened = await getRecentlyOpened();
2731
+ const picks = recentlyOpened.map(toProtoVisibleItem);
2732
+ return picks;
2499
2733
  };
2500
2734
 
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;
2530
- };
2531
- const name$9 = '';
2532
- const getHelpEntries$2 = () => {
2533
- return [];
2735
+ const getPicks$3 = async () => {
2736
+ const picks = [];
2737
+ return picks;
2534
2738
  };
2535
2739
 
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
2740
+ const getPicks$2 = async () => {
2741
+ // const views = ViewService.getViews()
2742
+ // const picks = views.map(toPick)
2743
+ // return picks
2744
+ return [];
2553
2745
  };
2554
2746
 
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
2568
- };
2569
- await invoke$1('ErrorHandling.showErrorDialog', errorInfo);
2570
- };
2571
- const warn = (...args) => {
2572
- console.warn(...args);
2747
+ const getPicks$1 = async () => {
2748
+ const picks = [];
2749
+ return picks;
2573
2750
  };
2574
2751
 
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
- }
2752
+ const selectPick$9 = async pick => {
2753
+ const id = pick.label;
2754
+ await setColorTheme(/* colorThemeId */id);
2587
2755
  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: []
2756
+ command: Hide
2616
2757
  };
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
2758
  };
2627
2759
 
2628
2760
  const shouldHide = item => {
@@ -2665,72 +2797,10 @@ const selectPick$8 = async item => {
2665
2797
  return selectPickBuiltin(item);
2666
2798
  };
2667
2799
 
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
2800
  const selectPick$7 = async pick => {
2731
2801
  const {
2732
2802
  args
2733
- } = state$6;
2803
+ } = state$3;
2734
2804
  const resolve = args[2];
2735
2805
  resolve(pick);
2736
2806
  return {
@@ -2738,305 +2808,19 @@ const selectPick$7 = async pick => {
2738
2808
  };
2739
2809
  };
2740
2810
 
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 => {
2811
+ const selectPick$6 = item => {
2926
2812
  const {
2927
2813
  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 => {
2986
- const {
2987
- 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
2814
+ } = state$1;
2815
+ const fn = getSelect(provider);
2816
+ return fn(item);
3033
2817
  };
3034
2818
 
3035
2819
  const openUri = async uri => {
3036
2820
  await invoke$1(/* Main.openUri */'Main.openUri', /* uri */uri);
3037
2821
  };
3038
2822
 
3039
- const selectPick$4 = async pick => {
2823
+ const selectPick$5 = async pick => {
3040
2824
  const description = pick.description;
3041
2825
  const fileName = pick.label;
3042
2826
  const workspace = await getWorkspacePath();
@@ -3047,81 +2831,22 @@ const selectPick$4 = async pick => {
3047
2831
  };
3048
2832
  };
3049
2833
 
3050
- const state$4 = {};
3051
- const name$4 = 'file';
3052
- const getPlaceholder$4 = () => {
3053
- return '';
2834
+ const execute = async (method, ...params) => {
2835
+ // TODO
3054
2836
  };
3055
- const getLabel$1 = () => {
3056
- return files();
3057
- };
3058
- const getNoResults$4 = () => {
3059
- return {
3060
- label: noMatchingResults()
2837
+
2838
+ const selectPick$4 = async item => {
2839
+ const rowIndex = Number.parseInt(item.label);
2840
+ const position = {
2841
+ rowIndex,
2842
+ columnIndex: 5
3061
2843
  };
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}`;
2844
+ await execute(/* EditorSetCursor.editorSetCursor */'TODO', /* position */position);
2845
+ // TODO put cursor onto that line
3091
2846
  return {
3092
- type: File$2,
3093
- name: pick.label,
3094
- path
2847
+ command: Hide
3095
2848
  };
3096
2849
  };
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
2850
 
3126
2851
  const openWorkspaceFolder = uri => {
3127
2852
  return invoke$1(/* Workspace.setPath */'Workspace.setPath', /* path */uri);
@@ -3136,130 +2861,12 @@ const selectPick$3 = async pick => {
3136
2861
  };
3137
2862
  };
3138
2863
 
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
2864
  const selectPick$2 = async item => {
3209
2865
  return {
3210
2866
  command: Hide
3211
2867
  };
3212
2868
  };
3213
2869
 
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
2870
  const selectPick$1 = async item => {
3264
2871
  // Command.execute(/* openView */ 549, /* viewName */ item.label)
3265
2872
  return {
@@ -3267,127 +2874,37 @@ const selectPick$1 = async item => {
3267
2874
  };
3268
2875
  };
3269
2876
 
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
2877
  const selectPick = async item => {
3326
2878
  return {
3327
2879
  command: Hide
3328
2880
  };
3329
2881
  };
3330
2882
 
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 '';
3350
- };
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
2883
+ const selectPicks = {
2884
+ [ColorTheme]: selectPick$9,
2885
+ [CommandPalette]: selectPick$6,
2886
+ [Commands]: selectPick$8,
2887
+ [Custom]: selectPick$7,
2888
+ [EveryThing]: selectPick$6,
2889
+ [File$2]: selectPick$5,
2890
+ [GoToLine$1]: selectPick$4,
2891
+ [Recent]: selectPick$3,
2892
+ [Symbol$1]: selectPick$2,
2893
+ [View$1]: selectPick$1,
2894
+ [WorkspaceSymbol$1]: selectPick
2895
+ };
2896
+ const getPicks = {
2897
+ [ColorTheme]: getPicks$a,
2898
+ [CommandPalette]: getPicks$7,
2899
+ [Commands]: getPicks$9,
2900
+ [Custom]: getPicks$8,
2901
+ [EveryThing]: getPicks$7,
2902
+ [GoToLine$1]: getPicks$5,
2903
+ [File$2]: getPicks$6,
2904
+ [Recent]: getPicks$4,
2905
+ [Symbol$1]: getPicks$3,
2906
+ [View$1]: getPicks$2,
2907
+ [WorkspaceSymbol$1]: getPicks$1
3391
2908
  };
3392
2909
 
3393
2910
  const Memfs = 'memfs';
@@ -3451,7 +2968,8 @@ const searchModules = {
3451
2968
 
3452
2969
  const listen = async () => {
3453
2970
  register(searchModules);
3454
- register$1(quickPickEntriesModules);
2971
+ registerSelect(selectPicks);
2972
+ registerGetPick(getPicks);
3455
2973
  const rpc = await WebWorkerRpcClient.create({
3456
2974
  commandMap: commandMap
3457
2975
  });