@lvce-editor/file-search-worker 5.7.0 → 5.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fileSearchWorkerMain.js +371 -190
- package/package.json +1 -1
|
@@ -786,7 +786,7 @@ const register$1 = commandMap => {
|
|
|
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 => {
|
|
@@ -1083,23 +1083,22 @@ const focusPick$1 = async pick => {
|
|
|
1083
1083
|
await setColorTheme(/* colorThemeId */label);
|
|
1084
1084
|
};
|
|
1085
1085
|
|
|
1086
|
-
const
|
|
1087
|
-
const Commands =
|
|
1088
|
-
const
|
|
1089
|
-
const EveryThing =
|
|
1090
|
-
const
|
|
1091
|
-
const
|
|
1092
|
-
const
|
|
1093
|
-
const
|
|
1094
|
-
const
|
|
1095
|
-
const
|
|
1096
|
-
const
|
|
1097
|
-
const Noop = 'quickPick://noop';
|
|
1086
|
+
const ColorTheme$1 = 0;
|
|
1087
|
+
const Commands$1 = 2;
|
|
1088
|
+
const Custom = 3;
|
|
1089
|
+
const EveryThing$1 = 4;
|
|
1090
|
+
const File$2 = 5;
|
|
1091
|
+
const GoToLine$2 = 6;
|
|
1092
|
+
const Help$2 = 7;
|
|
1093
|
+
const Recent$1 = 8;
|
|
1094
|
+
const Symbol$2 = 9;
|
|
1095
|
+
const View$3 = 10;
|
|
1096
|
+
const WorkspaceSymbol$2 = 11;
|
|
1098
1097
|
|
|
1099
1098
|
const noop$2 = async () => {};
|
|
1100
1099
|
const getFn$2 = id => {
|
|
1101
1100
|
switch (id) {
|
|
1102
|
-
case ColorTheme:
|
|
1101
|
+
case ColorTheme$1:
|
|
1103
1102
|
return focusPick$1;
|
|
1104
1103
|
default:
|
|
1105
1104
|
return noop$2;
|
|
@@ -1114,9 +1113,6 @@ const getIconsCached = (paths, fileIconCache) => {
|
|
|
1114
1113
|
return paths.map(path => fileIconCache[path]);
|
|
1115
1114
|
};
|
|
1116
1115
|
|
|
1117
|
-
const Directory = 3;
|
|
1118
|
-
const File$1 = 7;
|
|
1119
|
-
|
|
1120
1116
|
const getMissingIconRequests = (dirents, fileIconCache) => {
|
|
1121
1117
|
const missingRequests = [];
|
|
1122
1118
|
for (const dirent of dirents) {
|
|
@@ -1125,7 +1121,7 @@ const getMissingIconRequests = (dirents, fileIconCache) => {
|
|
|
1125
1121
|
}
|
|
1126
1122
|
if (!(dirent.path in fileIconCache)) {
|
|
1127
1123
|
missingRequests.push({
|
|
1128
|
-
type:
|
|
1124
|
+
type: dirent.type,
|
|
1129
1125
|
name: dirent.name,
|
|
1130
1126
|
path: dirent.path
|
|
1131
1127
|
});
|
|
@@ -1134,17 +1130,22 @@ const getMissingIconRequests = (dirents, fileIconCache) => {
|
|
|
1134
1130
|
return missingRequests;
|
|
1135
1131
|
};
|
|
1136
1132
|
|
|
1137
|
-
const
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1133
|
+
const None$2 = 0;
|
|
1134
|
+
const Directory = 3;
|
|
1135
|
+
const File$1 = 7;
|
|
1136
|
+
|
|
1137
|
+
const requestFileIcon = async request => {
|
|
1138
|
+
if (!request.name) {
|
|
1139
|
+
return '';
|
|
1140
|
+
}
|
|
1141
|
+
return request.type === File$1 ? invoke$1('IconTheme.getFileIcon', {
|
|
1142
|
+
name: request.name
|
|
1143
|
+
}) : invoke$1('IconTheme.getFolderIcon', {
|
|
1144
|
+
name: request.name
|
|
1147
1145
|
});
|
|
1146
|
+
};
|
|
1147
|
+
const requestFileIcons = async requests => {
|
|
1148
|
+
const promises = requests.map(requestFileIcon);
|
|
1148
1149
|
return Promise.all(promises);
|
|
1149
1150
|
};
|
|
1150
1151
|
|
|
@@ -1163,19 +1164,23 @@ const updateIconCache = (iconCache, missingRequests, newIcons) => {
|
|
|
1163
1164
|
return newFileIconCache;
|
|
1164
1165
|
};
|
|
1165
1166
|
|
|
1167
|
+
const getPath = dirent => {
|
|
1168
|
+
return dirent.path;
|
|
1169
|
+
};
|
|
1170
|
+
const toDirent = pick => {
|
|
1171
|
+
const dirent = {
|
|
1172
|
+
type: pick.direntType,
|
|
1173
|
+
name: pick.label,
|
|
1174
|
+
path: pick.uri
|
|
1175
|
+
};
|
|
1176
|
+
return dirent;
|
|
1177
|
+
};
|
|
1166
1178
|
const getQuickPickFileIcons = async (items, fileIconCache) => {
|
|
1167
|
-
const dirents = items.map(
|
|
1168
|
-
const dirent = {
|
|
1169
|
-
type: item.direntType,
|
|
1170
|
-
name: item.label,
|
|
1171
|
-
path: item.uri
|
|
1172
|
-
};
|
|
1173
|
-
return dirent;
|
|
1174
|
-
});
|
|
1179
|
+
const dirents = items.map(toDirent);
|
|
1175
1180
|
const missingRequests = getMissingIconRequests(dirents, fileIconCache);
|
|
1176
1181
|
const newIcons = await requestFileIcons(missingRequests);
|
|
1177
1182
|
const newFileIconCache = updateIconCache(fileIconCache, missingRequests, newIcons);
|
|
1178
|
-
const paths = dirents.map(
|
|
1183
|
+
const paths = dirents.map(getPath);
|
|
1179
1184
|
const icons = getIconsCached(paths, newFileIconCache);
|
|
1180
1185
|
return {
|
|
1181
1186
|
icons,
|
|
@@ -1185,14 +1190,14 @@ const getQuickPickFileIcons = async (items, fileIconCache) => {
|
|
|
1185
1190
|
|
|
1186
1191
|
const focusIndex = async (state, index) => {
|
|
1187
1192
|
const {
|
|
1188
|
-
|
|
1193
|
+
providerId,
|
|
1189
1194
|
maxVisibleItems,
|
|
1190
1195
|
items,
|
|
1191
1196
|
minLineY,
|
|
1192
1197
|
maxLineY,
|
|
1193
1198
|
fileIconCache
|
|
1194
1199
|
} = state;
|
|
1195
|
-
await focusPick(
|
|
1200
|
+
await focusPick(providerId, items[index]);
|
|
1196
1201
|
if (index < minLineY + 1) {
|
|
1197
1202
|
const minLineY = index;
|
|
1198
1203
|
const maxLineY = Math.min(index + maxVisibleItems, items.length - 1);
|
|
@@ -1656,27 +1661,28 @@ const filterQuickPickItems = (items, value) => {
|
|
|
1656
1661
|
};
|
|
1657
1662
|
|
|
1658
1663
|
const Command = '>';
|
|
1659
|
-
const Symbol = '@';
|
|
1660
|
-
const WorkspaceSymbol = '#';
|
|
1661
|
-
const GoToLine = ':';
|
|
1662
|
-
const View = 'view ';
|
|
1664
|
+
const Symbol$1 = '@';
|
|
1665
|
+
const WorkspaceSymbol$1 = '#';
|
|
1666
|
+
const GoToLine$1 = ':';
|
|
1667
|
+
const View$2 = 'view ';
|
|
1663
1668
|
const None$1 = '';
|
|
1669
|
+
const Help$1 = '?';
|
|
1664
1670
|
|
|
1665
1671
|
const getQuickPickPrefix = value => {
|
|
1666
1672
|
if (value.startsWith(Command)) {
|
|
1667
1673
|
return Command;
|
|
1668
1674
|
}
|
|
1669
|
-
if (value.startsWith(Symbol)) {
|
|
1670
|
-
return Symbol;
|
|
1675
|
+
if (value.startsWith(Symbol$1)) {
|
|
1676
|
+
return Symbol$1;
|
|
1671
1677
|
}
|
|
1672
|
-
if (value.startsWith(WorkspaceSymbol)) {
|
|
1673
|
-
return WorkspaceSymbol;
|
|
1678
|
+
if (value.startsWith(WorkspaceSymbol$1)) {
|
|
1679
|
+
return WorkspaceSymbol$1;
|
|
1674
1680
|
}
|
|
1675
|
-
if (value.startsWith(GoToLine)) {
|
|
1676
|
-
return GoToLine;
|
|
1681
|
+
if (value.startsWith(GoToLine$1)) {
|
|
1682
|
+
return GoToLine$1;
|
|
1677
1683
|
}
|
|
1678
|
-
if (value.startsWith(View)) {
|
|
1679
|
-
return View;
|
|
1684
|
+
if (value.startsWith(View$2)) {
|
|
1685
|
+
return View$2;
|
|
1680
1686
|
}
|
|
1681
1687
|
return None$1;
|
|
1682
1688
|
};
|
|
@@ -1691,7 +1697,7 @@ const getFilterValueEverything = value => {
|
|
|
1691
1697
|
};
|
|
1692
1698
|
const getFn$1 = id => {
|
|
1693
1699
|
switch (id) {
|
|
1694
|
-
case EveryThing:
|
|
1700
|
+
case EveryThing$1:
|
|
1695
1701
|
return getFilterValueEverything;
|
|
1696
1702
|
default:
|
|
1697
1703
|
return noop$1;
|
|
@@ -1703,9 +1709,6 @@ const getFilterValue = (id, value) => {
|
|
|
1703
1709
|
return filterValue;
|
|
1704
1710
|
};
|
|
1705
1711
|
|
|
1706
|
-
/**
|
|
1707
|
-
* @deprecated
|
|
1708
|
-
*/
|
|
1709
1712
|
const select = Object.create(null);
|
|
1710
1713
|
const getPick$1 = Object.create(null);
|
|
1711
1714
|
const registerSelect = modules => {
|
|
@@ -1714,7 +1717,7 @@ const registerSelect = modules => {
|
|
|
1714
1717
|
const registerGetPick = modules => {
|
|
1715
1718
|
Object.assign(getPick$1, modules);
|
|
1716
1719
|
};
|
|
1717
|
-
const getPicks$
|
|
1720
|
+
const getPicks$d = id => {
|
|
1718
1721
|
const fn = getPick$1[id];
|
|
1719
1722
|
return fn;
|
|
1720
1723
|
};
|
|
@@ -1723,16 +1726,35 @@ const getSelect = id => {
|
|
|
1723
1726
|
return fn;
|
|
1724
1727
|
};
|
|
1725
1728
|
|
|
1726
|
-
const getPicks$
|
|
1727
|
-
const fn = getPicks$
|
|
1729
|
+
const getPicks$c = (id, searchValue) => {
|
|
1730
|
+
const fn = getPicks$d(id);
|
|
1728
1731
|
return fn(searchValue);
|
|
1729
1732
|
};
|
|
1730
1733
|
|
|
1734
|
+
const getQuickPickSubProviderId = prefix => {
|
|
1735
|
+
switch (prefix) {
|
|
1736
|
+
case Command:
|
|
1737
|
+
return Commands$1;
|
|
1738
|
+
case Symbol$1:
|
|
1739
|
+
return Symbol$2;
|
|
1740
|
+
case WorkspaceSymbol$1:
|
|
1741
|
+
return WorkspaceSymbol$2;
|
|
1742
|
+
case GoToLine$1:
|
|
1743
|
+
return GoToLine$2;
|
|
1744
|
+
case View$2:
|
|
1745
|
+
return View$3;
|
|
1746
|
+
case Help$1:
|
|
1747
|
+
return Help$2;
|
|
1748
|
+
default:
|
|
1749
|
+
return File$2;
|
|
1750
|
+
}
|
|
1751
|
+
};
|
|
1752
|
+
|
|
1731
1753
|
// TODO when user types letters -> no need to query provider again -> just filter existing results
|
|
1732
1754
|
const setValue = async (state, newValue) => {
|
|
1733
1755
|
const {
|
|
1756
|
+
providerId,
|
|
1734
1757
|
value,
|
|
1735
|
-
uri,
|
|
1736
1758
|
minLineY,
|
|
1737
1759
|
maxLineY,
|
|
1738
1760
|
fileIconCache
|
|
@@ -1740,11 +1762,13 @@ const setValue = async (state, newValue) => {
|
|
|
1740
1762
|
if (value === newValue) {
|
|
1741
1763
|
return state;
|
|
1742
1764
|
}
|
|
1743
|
-
const
|
|
1744
|
-
const
|
|
1765
|
+
const prefix = getQuickPickPrefix(newValue);
|
|
1766
|
+
const subId = getQuickPickSubProviderId(prefix);
|
|
1767
|
+
const newPicks = await getPicks$c(subId, newValue);
|
|
1768
|
+
const filterValue = getFilterValue(providerId, newValue);
|
|
1745
1769
|
const items = filterQuickPickItems(newPicks, filterValue);
|
|
1746
1770
|
const focusedIndex = items.length === 0 ? -1 : 0;
|
|
1747
|
-
const sliced =
|
|
1771
|
+
const sliced = items.slice(minLineY, maxLineY);
|
|
1748
1772
|
const {
|
|
1749
1773
|
newFileIconCache,
|
|
1750
1774
|
icons
|
|
@@ -1814,15 +1838,17 @@ const KeepOpen = '';
|
|
|
1814
1838
|
const selectIndex = async (state, index, button = /* left */0) => {
|
|
1815
1839
|
const {
|
|
1816
1840
|
minLineY,
|
|
1817
|
-
|
|
1818
|
-
|
|
1841
|
+
items,
|
|
1842
|
+
value
|
|
1819
1843
|
} = state;
|
|
1820
1844
|
const actualIndex = index + minLineY;
|
|
1821
1845
|
const pick = getPick(items, actualIndex);
|
|
1822
1846
|
if (!pick) {
|
|
1823
1847
|
return state;
|
|
1824
1848
|
}
|
|
1825
|
-
const
|
|
1849
|
+
const prefix = getQuickPickPrefix(value);
|
|
1850
|
+
const subId = getQuickPickSubProviderId(prefix);
|
|
1851
|
+
const fn = getSelect(subId);
|
|
1826
1852
|
const selectPickResult = await fn(pick);
|
|
1827
1853
|
object(selectPickResult);
|
|
1828
1854
|
string(selectPickResult.command);
|
|
@@ -1870,15 +1896,44 @@ const handleFocus = async state => {
|
|
|
1870
1896
|
return state;
|
|
1871
1897
|
};
|
|
1872
1898
|
|
|
1873
|
-
const getDefaultValue =
|
|
1874
|
-
switch (
|
|
1875
|
-
case
|
|
1876
|
-
return
|
|
1899
|
+
const getDefaultValue = id => {
|
|
1900
|
+
switch (id) {
|
|
1901
|
+
case EveryThing$1:
|
|
1902
|
+
return Command;
|
|
1877
1903
|
default:
|
|
1878
1904
|
return '';
|
|
1879
1905
|
}
|
|
1880
1906
|
};
|
|
1881
1907
|
|
|
1908
|
+
const Commands = 'quickPick://commands';
|
|
1909
|
+
const EveryThing = 'quickPick://everything';
|
|
1910
|
+
const Recent = 'quickPick://recent';
|
|
1911
|
+
const ColorTheme = 'quickPick://color-theme';
|
|
1912
|
+
const Symbol = 'quickPick://symbol';
|
|
1913
|
+
const View$1 = 'quickPick://view';
|
|
1914
|
+
const Help = 'quickPick://help';
|
|
1915
|
+
const WorkspaceSymbol = 'quickPick://workspace-symbol';
|
|
1916
|
+
const GoToLine = 'quickPick://go-to-line';
|
|
1917
|
+
|
|
1918
|
+
const getQuickPickProviderId = prefix => {
|
|
1919
|
+
switch (prefix) {
|
|
1920
|
+
case Commands:
|
|
1921
|
+
case Symbol:
|
|
1922
|
+
case WorkspaceSymbol:
|
|
1923
|
+
case EveryThing:
|
|
1924
|
+
case GoToLine:
|
|
1925
|
+
case View$1:
|
|
1926
|
+
case Help:
|
|
1927
|
+
return EveryThing$1;
|
|
1928
|
+
case ColorTheme:
|
|
1929
|
+
return ColorTheme$1;
|
|
1930
|
+
case Recent:
|
|
1931
|
+
return Recent$1;
|
|
1932
|
+
default:
|
|
1933
|
+
return File$2;
|
|
1934
|
+
}
|
|
1935
|
+
};
|
|
1936
|
+
|
|
1882
1937
|
const state$3 = {
|
|
1883
1938
|
args: []
|
|
1884
1939
|
};
|
|
@@ -1906,11 +1961,14 @@ const loadContent = async state => {
|
|
|
1906
1961
|
args,
|
|
1907
1962
|
fileIconCache
|
|
1908
1963
|
} = state;
|
|
1909
|
-
const
|
|
1910
|
-
|
|
1911
|
-
const
|
|
1964
|
+
const id = getQuickPickProviderId(uri);
|
|
1965
|
+
const value = getDefaultValue(id);
|
|
1966
|
+
const prefix = getQuickPickPrefix(value);
|
|
1967
|
+
const subId = getQuickPickSubProviderId(prefix);
|
|
1968
|
+
setArgs(subId, args);
|
|
1969
|
+
const newPicks = await getPicks$c(subId, value);
|
|
1912
1970
|
array(newPicks);
|
|
1913
|
-
const filterValue = getFilterValue(
|
|
1971
|
+
const filterValue = getFilterValue(id, value);
|
|
1914
1972
|
const items = filterQuickPickItems(newPicks, filterValue);
|
|
1915
1973
|
const minLineY = 0;
|
|
1916
1974
|
const maxLineY = Math.min(minLineY + state.maxVisibleItems, newPicks.length);
|
|
@@ -1932,7 +1990,8 @@ const loadContent = async state => {
|
|
|
1932
1990
|
inputSource: Script,
|
|
1933
1991
|
focused: true,
|
|
1934
1992
|
fileIconCache: newFileIconCache,
|
|
1935
|
-
icons
|
|
1993
|
+
icons,
|
|
1994
|
+
providerId: id
|
|
1936
1995
|
};
|
|
1937
1996
|
};
|
|
1938
1997
|
|
|
@@ -1957,13 +2016,51 @@ const getVisible$1 = (items, minLineY, maxLineY, icons) => {
|
|
|
1957
2016
|
return protoVisibleItems;
|
|
1958
2017
|
};
|
|
1959
2018
|
|
|
2019
|
+
const emptyHighlightSections = [];
|
|
2020
|
+
|
|
2021
|
+
const getHighlightSections = (highlights, label) => {
|
|
2022
|
+
if (highlights.length === 0) {
|
|
2023
|
+
return emptyHighlightSections;
|
|
2024
|
+
}
|
|
2025
|
+
const sections = [];
|
|
2026
|
+
let position = 0;
|
|
2027
|
+
for (let i = 0; i < highlights.length; i += 2) {
|
|
2028
|
+
const highlightStart = highlights[i];
|
|
2029
|
+
const highlightEnd = highlights[i + 1];
|
|
2030
|
+
if (position < highlightStart) {
|
|
2031
|
+
const beforeText = label.slice(position, highlightStart);
|
|
2032
|
+
sections.push({
|
|
2033
|
+
highlighted: false,
|
|
2034
|
+
text: beforeText
|
|
2035
|
+
});
|
|
2036
|
+
}
|
|
2037
|
+
const highlightText = label.slice(highlightStart, highlightEnd);
|
|
2038
|
+
sections.push({
|
|
2039
|
+
highlighted: true,
|
|
2040
|
+
text: highlightText
|
|
2041
|
+
});
|
|
2042
|
+
position = highlightEnd;
|
|
2043
|
+
}
|
|
2044
|
+
if (position < label.length) {
|
|
2045
|
+
const afterText = label.slice(position);
|
|
2046
|
+
sections.push({
|
|
2047
|
+
highlighted: false,
|
|
2048
|
+
text: afterText
|
|
2049
|
+
});
|
|
2050
|
+
}
|
|
2051
|
+
return sections;
|
|
2052
|
+
};
|
|
2053
|
+
|
|
1960
2054
|
const getVisible = (setSize, protoVisibleItems, minLineY, focusedIndex) => {
|
|
1961
2055
|
const visibleItems = protoVisibleItems.map((visibleItem, i) => {
|
|
2056
|
+
const highlights = visibleItem.matches.slice(1);
|
|
2057
|
+
const sections = getHighlightSections(highlights, visibleItem.label);
|
|
1962
2058
|
return {
|
|
1963
2059
|
...visibleItem,
|
|
1964
2060
|
posInSet: minLineY + i + 1,
|
|
1965
2061
|
setSize,
|
|
1966
|
-
isActive: i === focusedIndex
|
|
2062
|
+
isActive: i === focusedIndex,
|
|
2063
|
+
highlights: sections
|
|
1967
2064
|
};
|
|
1968
2065
|
});
|
|
1969
2066
|
return visibleItems;
|
|
@@ -2023,6 +2120,7 @@ const Option = 'option';
|
|
|
2023
2120
|
const FileIcon = 'FileIcon';
|
|
2024
2121
|
const InputBox = 'InputBox';
|
|
2025
2122
|
const Label = 'Label';
|
|
2123
|
+
const MaskIcon = 'MaskIcon';
|
|
2026
2124
|
const QuickPick$1 = 'QuickPick';
|
|
2027
2125
|
const QuickPickHeader = 'QuickPickHeader';
|
|
2028
2126
|
const QuickPickHighlight = 'QuickPickHighlight';
|
|
@@ -2030,9 +2128,9 @@ const QuickPickItem = 'QuickPickItem';
|
|
|
2030
2128
|
const QuickPickItemActive$1 = 'QuickPickItemActive';
|
|
2031
2129
|
const QuickPickItemDescription = 'QuickPickItemDescription';
|
|
2032
2130
|
const QuickPickItemLabel = 'QuickPickItemLabel';
|
|
2033
|
-
const QuickPickMaskIcon = 'QuickPickMaskIcon';
|
|
2034
2131
|
const QuickPickItems$1 = 'QuickPickItems';
|
|
2035
|
-
const
|
|
2132
|
+
const QuickPickMaskIcon = 'QuickPickMaskIcon';
|
|
2133
|
+
const QuickPickStatus = 'QuickPickStatus';
|
|
2036
2134
|
const Viewlet = 'Viewlet';
|
|
2037
2135
|
|
|
2038
2136
|
const HandleBeforeInput = 'handleBeforeInput';
|
|
@@ -2058,19 +2156,43 @@ const i18nString = (key, placeholders = emptyObject) => {
|
|
|
2058
2156
|
return key.replaceAll(RE_PLACEHOLDER, replacer);
|
|
2059
2157
|
};
|
|
2060
2158
|
|
|
2159
|
+
const GoToFile = 'Go to file';
|
|
2160
|
+
const GoToLineColumn = 'Go to Line / Column';
|
|
2161
|
+
const GoToSymbolInEditor = 'Go to Symbol in Editor';
|
|
2061
2162
|
const NoResults = 'No Results';
|
|
2062
|
-
const
|
|
2163
|
+
const OpenView = 'Open View';
|
|
2063
2164
|
const QuickOpen = 'Quick open';
|
|
2165
|
+
const SearchForText = 'Search for text';
|
|
2166
|
+
const ShowAndRunCommands = 'Show And Run Commands';
|
|
2167
|
+
const TypeNameOfCommandToRun = 'Type the name of a command to run.';
|
|
2064
2168
|
|
|
2065
2169
|
const typeNameofCommandToRun = () => {
|
|
2066
2170
|
return i18nString(TypeNameOfCommandToRun);
|
|
2067
2171
|
};
|
|
2172
|
+
const showAndRunCommands = () => {
|
|
2173
|
+
return i18nString(ShowAndRunCommands);
|
|
2174
|
+
};
|
|
2175
|
+
const goToFile = () => {
|
|
2176
|
+
return i18nString(GoToFile);
|
|
2177
|
+
};
|
|
2068
2178
|
const noResults = () => {
|
|
2069
2179
|
return i18nString(NoResults);
|
|
2070
2180
|
};
|
|
2071
2181
|
const quickOpen = () => {
|
|
2072
2182
|
return i18nString(QuickOpen);
|
|
2073
2183
|
};
|
|
2184
|
+
const goToLineColumn = () => {
|
|
2185
|
+
return i18nString(GoToLineColumn);
|
|
2186
|
+
};
|
|
2187
|
+
const goToSymbolInEditor = () => {
|
|
2188
|
+
return i18nString(GoToSymbolInEditor);
|
|
2189
|
+
};
|
|
2190
|
+
const searchForText = () => {
|
|
2191
|
+
return i18nString(SearchForText);
|
|
2192
|
+
};
|
|
2193
|
+
const openView = () => {
|
|
2194
|
+
return i18nString(OpenView);
|
|
2195
|
+
};
|
|
2074
2196
|
|
|
2075
2197
|
const Div = 4;
|
|
2076
2198
|
const Input = 6;
|
|
@@ -2107,39 +2229,14 @@ const getQuickPickHeaderVirtualDom = () => {
|
|
|
2107
2229
|
}, getQuickPickInputVirtualDom()];
|
|
2108
2230
|
};
|
|
2109
2231
|
|
|
2110
|
-
const
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
for (let i = 0; i < highlights.length; i += 2) {
|
|
2119
|
-
const highlightStart = highlights[i];
|
|
2120
|
-
const highlightEnd = highlights[i + 1];
|
|
2121
|
-
if (position < highlightStart) {
|
|
2122
|
-
const beforeText = label.slice(position, highlightStart);
|
|
2123
|
-
sections.push({
|
|
2124
|
-
highlighted: false,
|
|
2125
|
-
text: beforeText
|
|
2126
|
-
});
|
|
2127
|
-
}
|
|
2128
|
-
const highlightText = label.slice(highlightStart, highlightEnd);
|
|
2129
|
-
sections.push({
|
|
2130
|
-
highlighted: true,
|
|
2131
|
-
text: highlightText
|
|
2132
|
-
});
|
|
2133
|
-
position = highlightEnd;
|
|
2134
|
-
}
|
|
2135
|
-
if (position < label.length) {
|
|
2136
|
-
const afterText = label.slice(position);
|
|
2137
|
-
sections.push({
|
|
2138
|
-
highlighted: false,
|
|
2139
|
-
text: afterText
|
|
2140
|
-
});
|
|
2141
|
-
}
|
|
2142
|
-
return sections;
|
|
2232
|
+
const getFileIconVirtualDom = icon => {
|
|
2233
|
+
return {
|
|
2234
|
+
type: Img,
|
|
2235
|
+
className: FileIcon,
|
|
2236
|
+
src: icon,
|
|
2237
|
+
role: None,
|
|
2238
|
+
childCount: 0
|
|
2239
|
+
};
|
|
2143
2240
|
};
|
|
2144
2241
|
|
|
2145
2242
|
const mergeClassNames = (...classNames) => {
|
|
@@ -2159,14 +2256,13 @@ const quickPickHighlight = {
|
|
|
2159
2256
|
className: QuickPickHighlight,
|
|
2160
2257
|
childCount: 1
|
|
2161
2258
|
};
|
|
2162
|
-
const getHighlights = (
|
|
2259
|
+
const getHighlights = (sections, label) => {
|
|
2163
2260
|
const labelDom = {
|
|
2164
2261
|
type: Div,
|
|
2165
2262
|
className: QuickPickItemLabel,
|
|
2166
2263
|
childCount: 0
|
|
2167
2264
|
};
|
|
2168
2265
|
const nodes = [labelDom];
|
|
2169
|
-
const sections = getHighlightSections(highlights, label);
|
|
2170
2266
|
if (sections.length === 0) {
|
|
2171
2267
|
labelDom.childCount++;
|
|
2172
2268
|
nodes.push(text(label));
|
|
@@ -2184,21 +2280,6 @@ const getHighlights = (highlights, label) => {
|
|
|
2184
2280
|
return nodes;
|
|
2185
2281
|
};
|
|
2186
2282
|
|
|
2187
|
-
const addHighlights = (dom, highlights, label) => {
|
|
2188
|
-
const domHighlights = getHighlights(highlights, label);
|
|
2189
|
-
dom.push(...domHighlights);
|
|
2190
|
-
};
|
|
2191
|
-
|
|
2192
|
-
const getFileIconVirtualDom = icon => {
|
|
2193
|
-
return {
|
|
2194
|
-
type: Img,
|
|
2195
|
-
className: FileIcon,
|
|
2196
|
-
src: icon,
|
|
2197
|
-
role: None,
|
|
2198
|
-
childCount: 0
|
|
2199
|
-
};
|
|
2200
|
-
};
|
|
2201
|
-
|
|
2202
2283
|
const getQuickPickItemVirtualDom = visibleItem => {
|
|
2203
2284
|
const {
|
|
2204
2285
|
posInSet,
|
|
@@ -2207,10 +2288,9 @@ const getQuickPickItemVirtualDom = visibleItem => {
|
|
|
2207
2288
|
isActive,
|
|
2208
2289
|
description,
|
|
2209
2290
|
icon,
|
|
2210
|
-
|
|
2291
|
+
highlights,
|
|
2211
2292
|
fileIcon
|
|
2212
2293
|
} = visibleItem;
|
|
2213
|
-
const highlights = matches.slice(1);
|
|
2214
2294
|
const dom = [];
|
|
2215
2295
|
dom.push({
|
|
2216
2296
|
type: Div,
|
|
@@ -2237,7 +2317,8 @@ const getQuickPickItemVirtualDom = visibleItem => {
|
|
|
2237
2317
|
childCount: 0
|
|
2238
2318
|
});
|
|
2239
2319
|
}
|
|
2240
|
-
|
|
2320
|
+
const highlightDom = getHighlights(highlights, label);
|
|
2321
|
+
dom.push(...highlightDom);
|
|
2241
2322
|
if (description) {
|
|
2242
2323
|
parent.childCount++;
|
|
2243
2324
|
dom.push({
|
|
@@ -2253,7 +2334,7 @@ const getQuickPickNoResultsVirtualDom = () => {
|
|
|
2253
2334
|
const noResults$1 = noResults();
|
|
2254
2335
|
return [{
|
|
2255
2336
|
type: Div,
|
|
2256
|
-
className:
|
|
2337
|
+
className: mergeClassNames(QuickPickItem, QuickPickItemActive$1, QuickPickStatus),
|
|
2257
2338
|
childCount: 1
|
|
2258
2339
|
}, {
|
|
2259
2340
|
type: Div,
|
|
@@ -2451,7 +2532,7 @@ const toProtoVisibleItem$2 = name => {
|
|
|
2451
2532
|
};
|
|
2452
2533
|
return pick;
|
|
2453
2534
|
};
|
|
2454
|
-
const getPicks$
|
|
2535
|
+
const getPicks$b = async searchValue => {
|
|
2455
2536
|
const colorThemeNames = await getColorThemeNames();
|
|
2456
2537
|
const picks = colorThemeNames.map(toProtoVisibleItem$2);
|
|
2457
2538
|
return picks;
|
|
@@ -2523,7 +2604,7 @@ const toProtoVisibleItem$1 = item => {
|
|
|
2523
2604
|
pick.id = item.id;
|
|
2524
2605
|
return pick;
|
|
2525
2606
|
};
|
|
2526
|
-
const getPicks$
|
|
2607
|
+
const getPicks$a = async () => {
|
|
2527
2608
|
// TODO get picks in parallel
|
|
2528
2609
|
const builtinPicks = await getBuiltinPicks();
|
|
2529
2610
|
const extensionPicks = await getExtensionPicks();
|
|
@@ -2532,35 +2613,17 @@ const getPicks$8 = async () => {
|
|
|
2532
2613
|
return converted;
|
|
2533
2614
|
};
|
|
2534
2615
|
|
|
2535
|
-
const getPicks$
|
|
2616
|
+
const getPicks$9 = async searchValue => {
|
|
2536
2617
|
const items = state$3.args[1] || [];
|
|
2537
2618
|
return items;
|
|
2538
2619
|
};
|
|
2539
2620
|
|
|
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
2621
|
const state$1 = {
|
|
2559
|
-
provider:
|
|
2622
|
+
provider: File$2,
|
|
2560
2623
|
prefix: 'string-that-should-never-match-another-string'
|
|
2561
2624
|
};
|
|
2562
2625
|
|
|
2563
|
-
const getPicks$
|
|
2626
|
+
const getPicks$8 = async value => {
|
|
2564
2627
|
const prefix = getQuickPickPrefix(value);
|
|
2565
2628
|
const providerId = getQuickPickProviderId(prefix);
|
|
2566
2629
|
|
|
@@ -2571,7 +2634,7 @@ const getPicks$6 = async value => {
|
|
|
2571
2634
|
}
|
|
2572
2635
|
// TODO this line is a bit duplicated with getFilterValue
|
|
2573
2636
|
const slicedValue = value.slice(prefix.length).trimStart();
|
|
2574
|
-
const picks = await getPicks$
|
|
2637
|
+
const picks = await getPicks$c(providerId, slicedValue);
|
|
2575
2638
|
return picks;
|
|
2576
2639
|
};
|
|
2577
2640
|
|
|
@@ -2644,7 +2707,7 @@ const convertToPick = uri => {
|
|
|
2644
2707
|
// e.g. when there are many files, don't need
|
|
2645
2708
|
// to compute the fileIcon for all files
|
|
2646
2709
|
|
|
2647
|
-
const getPicks$
|
|
2710
|
+
const getPicks$7 = async searchValue => {
|
|
2648
2711
|
// TODO cache workspace path
|
|
2649
2712
|
const workspace = await getWorkspacePath();
|
|
2650
2713
|
if (!workspace) {
|
|
@@ -2655,6 +2718,117 @@ const getPicks$5 = async searchValue => {
|
|
|
2655
2718
|
return picks;
|
|
2656
2719
|
};
|
|
2657
2720
|
|
|
2721
|
+
const getPicks$6 = async () => {
|
|
2722
|
+
const picks = [{
|
|
2723
|
+
label: '1',
|
|
2724
|
+
description: '',
|
|
2725
|
+
icon: '',
|
|
2726
|
+
fileIcon: '',
|
|
2727
|
+
matches: [],
|
|
2728
|
+
direntType: None$2,
|
|
2729
|
+
uri: ''
|
|
2730
|
+
}, {
|
|
2731
|
+
label: '2',
|
|
2732
|
+
description: '',
|
|
2733
|
+
icon: '',
|
|
2734
|
+
fileIcon: '',
|
|
2735
|
+
matches: [],
|
|
2736
|
+
direntType: None$2,
|
|
2737
|
+
uri: ''
|
|
2738
|
+
}, {
|
|
2739
|
+
label: '3',
|
|
2740
|
+
description: '',
|
|
2741
|
+
icon: '',
|
|
2742
|
+
fileIcon: '',
|
|
2743
|
+
matches: [],
|
|
2744
|
+
direntType: None$2,
|
|
2745
|
+
uri: ''
|
|
2746
|
+
}, {
|
|
2747
|
+
label: '4',
|
|
2748
|
+
description: '',
|
|
2749
|
+
icon: '',
|
|
2750
|
+
fileIcon: '',
|
|
2751
|
+
matches: [],
|
|
2752
|
+
direntType: None$2,
|
|
2753
|
+
uri: ''
|
|
2754
|
+
}, {
|
|
2755
|
+
label: '5',
|
|
2756
|
+
description: '',
|
|
2757
|
+
icon: '',
|
|
2758
|
+
fileIcon: '',
|
|
2759
|
+
matches: [],
|
|
2760
|
+
direntType: None$2,
|
|
2761
|
+
uri: ''
|
|
2762
|
+
}, {
|
|
2763
|
+
label: '6',
|
|
2764
|
+
description: '',
|
|
2765
|
+
icon: '',
|
|
2766
|
+
fileIcon: '',
|
|
2767
|
+
matches: [],
|
|
2768
|
+
direntType: None$2,
|
|
2769
|
+
uri: ''
|
|
2770
|
+
}];
|
|
2771
|
+
return picks;
|
|
2772
|
+
};
|
|
2773
|
+
|
|
2774
|
+
const DotDotDot = '...';
|
|
2775
|
+
const Colon = ':';
|
|
2776
|
+
const Percent = '%';
|
|
2777
|
+
const AngleBracket = '>';
|
|
2778
|
+
const View = 'view';
|
|
2779
|
+
|
|
2780
|
+
const getPicks$5 = async () => {
|
|
2781
|
+
return [{
|
|
2782
|
+
description: goToFile(),
|
|
2783
|
+
direntType: None$2,
|
|
2784
|
+
fileIcon: '',
|
|
2785
|
+
icon: '',
|
|
2786
|
+
label: DotDotDot,
|
|
2787
|
+
matches: [],
|
|
2788
|
+
uri: ''
|
|
2789
|
+
}, {
|
|
2790
|
+
description: goToLineColumn(),
|
|
2791
|
+
direntType: None$2,
|
|
2792
|
+
fileIcon: '',
|
|
2793
|
+
icon: '',
|
|
2794
|
+
label: ':',
|
|
2795
|
+
matches: [],
|
|
2796
|
+
uri: ''
|
|
2797
|
+
}, {
|
|
2798
|
+
description: goToSymbolInEditor(),
|
|
2799
|
+
direntType: None$2,
|
|
2800
|
+
fileIcon: '',
|
|
2801
|
+
icon: '',
|
|
2802
|
+
label: Colon,
|
|
2803
|
+
matches: [],
|
|
2804
|
+
uri: ''
|
|
2805
|
+
}, {
|
|
2806
|
+
description: searchForText(),
|
|
2807
|
+
direntType: None$2,
|
|
2808
|
+
fileIcon: '',
|
|
2809
|
+
icon: '',
|
|
2810
|
+
label: Percent,
|
|
2811
|
+
matches: [],
|
|
2812
|
+
uri: ''
|
|
2813
|
+
}, {
|
|
2814
|
+
description: showAndRunCommands(),
|
|
2815
|
+
direntType: None$2,
|
|
2816
|
+
fileIcon: '',
|
|
2817
|
+
icon: '',
|
|
2818
|
+
label: AngleBracket,
|
|
2819
|
+
matches: [],
|
|
2820
|
+
uri: ''
|
|
2821
|
+
}, {
|
|
2822
|
+
description: openView(),
|
|
2823
|
+
direntType: None$2,
|
|
2824
|
+
fileIcon: '',
|
|
2825
|
+
icon: '',
|
|
2826
|
+
label: View,
|
|
2827
|
+
matches: [],
|
|
2828
|
+
uri: ''
|
|
2829
|
+
}];
|
|
2830
|
+
};
|
|
2831
|
+
|
|
2658
2832
|
const getRecentlyOpened = () => {
|
|
2659
2833
|
return invoke$1(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
|
|
2660
2834
|
};
|
|
@@ -2682,9 +2856,6 @@ const getPicks$3 = async () => {
|
|
|
2682
2856
|
};
|
|
2683
2857
|
|
|
2684
2858
|
const getPicks$2 = async () => {
|
|
2685
|
-
// const views = ViewService.getViews()
|
|
2686
|
-
// const picks = views.map(toPick)
|
|
2687
|
-
// return picks
|
|
2688
2859
|
return [];
|
|
2689
2860
|
};
|
|
2690
2861
|
|
|
@@ -2693,7 +2864,7 @@ const getPicks$1 = async () => {
|
|
|
2693
2864
|
return picks;
|
|
2694
2865
|
};
|
|
2695
2866
|
|
|
2696
|
-
const selectPick$
|
|
2867
|
+
const selectPick$a = async pick => {
|
|
2697
2868
|
const id = pick.label;
|
|
2698
2869
|
await setColorTheme(/* colorThemeId */id);
|
|
2699
2870
|
return {
|
|
@@ -2732,7 +2903,7 @@ const selectPickExtension = async item => {
|
|
|
2732
2903
|
command: Hide
|
|
2733
2904
|
};
|
|
2734
2905
|
};
|
|
2735
|
-
const selectPick$
|
|
2906
|
+
const selectPick$9 = async item => {
|
|
2736
2907
|
// @ts-ignore
|
|
2737
2908
|
const id = item.id;
|
|
2738
2909
|
if (id.startsWith('ext.')) {
|
|
@@ -2741,7 +2912,7 @@ const selectPick$6 = async item => {
|
|
|
2741
2912
|
return selectPickBuiltin(item);
|
|
2742
2913
|
};
|
|
2743
2914
|
|
|
2744
|
-
const selectPick$
|
|
2915
|
+
const selectPick$8 = async pick => {
|
|
2745
2916
|
const {
|
|
2746
2917
|
args
|
|
2747
2918
|
} = state$3;
|
|
@@ -2752,7 +2923,7 @@ const selectPick$5 = async pick => {
|
|
|
2752
2923
|
};
|
|
2753
2924
|
};
|
|
2754
2925
|
|
|
2755
|
-
const selectPick$
|
|
2926
|
+
const selectPick$7 = item => {
|
|
2756
2927
|
const {
|
|
2757
2928
|
provider
|
|
2758
2929
|
} = state$1;
|
|
@@ -2764,7 +2935,7 @@ const openUri = async uri => {
|
|
|
2764
2935
|
await invoke$1(/* Main.openUri */'Main.openUri', /* uri */uri);
|
|
2765
2936
|
};
|
|
2766
2937
|
|
|
2767
|
-
const selectPick$
|
|
2938
|
+
const selectPick$6 = async pick => {
|
|
2768
2939
|
const description = pick.description;
|
|
2769
2940
|
const fileName = pick.label;
|
|
2770
2941
|
const workspace = await getWorkspacePath();
|
|
@@ -2775,12 +2946,36 @@ const selectPick$3 = async pick => {
|
|
|
2775
2946
|
};
|
|
2776
2947
|
};
|
|
2777
2948
|
|
|
2949
|
+
const execute = async (method, ...params) => {
|
|
2950
|
+
// TODO
|
|
2951
|
+
};
|
|
2952
|
+
|
|
2953
|
+
const selectPick$5 = async item => {
|
|
2954
|
+
const rowIndex = Number.parseInt(item.label);
|
|
2955
|
+
const position = {
|
|
2956
|
+
rowIndex,
|
|
2957
|
+
columnIndex: 5
|
|
2958
|
+
};
|
|
2959
|
+
await execute(/* EditorSetCursor.editorSetCursor */'TODO', /* position */position);
|
|
2960
|
+
// TODO put cursor onto that line
|
|
2961
|
+
return {
|
|
2962
|
+
command: Hide
|
|
2963
|
+
};
|
|
2964
|
+
};
|
|
2965
|
+
|
|
2966
|
+
const selectPick$4 = async item => {
|
|
2967
|
+
// Command.execute(/* openView */ 549, /* viewName */ item.label)
|
|
2968
|
+
return {
|
|
2969
|
+
command: Hide
|
|
2970
|
+
};
|
|
2971
|
+
};
|
|
2972
|
+
|
|
2778
2973
|
const openWorkspaceFolder = uri => {
|
|
2779
2974
|
return invoke$1(/* Workspace.setPath */'Workspace.setPath', /* path */uri);
|
|
2780
2975
|
};
|
|
2781
2976
|
|
|
2782
2977
|
// TODO selectPick should be independent of show/hide
|
|
2783
|
-
const selectPick$
|
|
2978
|
+
const selectPick$3 = async pick => {
|
|
2784
2979
|
const path = `${pick.description}/${pick.label}`;
|
|
2785
2980
|
await openWorkspaceFolder(path);
|
|
2786
2981
|
return {
|
|
@@ -2788,7 +2983,14 @@ const selectPick$2 = async pick => {
|
|
|
2788
2983
|
};
|
|
2789
2984
|
};
|
|
2790
2985
|
|
|
2986
|
+
const selectPick$2 = async item => {
|
|
2987
|
+
return {
|
|
2988
|
+
command: Hide
|
|
2989
|
+
};
|
|
2990
|
+
};
|
|
2991
|
+
|
|
2791
2992
|
const selectPick$1 = async item => {
|
|
2993
|
+
// Command.execute(/* openView */ 549, /* viewName */ item.label)
|
|
2792
2994
|
return {
|
|
2793
2995
|
command: Hide
|
|
2794
2996
|
};
|
|
@@ -2800,29 +3002,8 @@ const selectPick = async item => {
|
|
|
2800
3002
|
};
|
|
2801
3003
|
};
|
|
2802
3004
|
|
|
2803
|
-
const selectPicks =
|
|
2804
|
-
|
|
2805
|
-
[CommandPalette]: selectPick$4,
|
|
2806
|
-
[Commands]: selectPick$6,
|
|
2807
|
-
[Custom]: selectPick$5,
|
|
2808
|
-
[EveryThing]: selectPick$4,
|
|
2809
|
-
[File$2]: selectPick$3,
|
|
2810
|
-
[Recent]: selectPick$2,
|
|
2811
|
-
[Symbol$1]: selectPick$1,
|
|
2812
|
-
[WorkspaceSymbol$1]: selectPick
|
|
2813
|
-
};
|
|
2814
|
-
const getPicks = {
|
|
2815
|
-
[ColorTheme]: getPicks$9,
|
|
2816
|
-
[CommandPalette]: getPicks$6,
|
|
2817
|
-
[Commands]: getPicks$8,
|
|
2818
|
-
[Custom]: getPicks$7,
|
|
2819
|
-
[EveryThing]: getPicks$6,
|
|
2820
|
-
[File$2]: getPicks$5,
|
|
2821
|
-
[Recent]: getPicks$4,
|
|
2822
|
-
[Symbol$1]: getPicks$3,
|
|
2823
|
-
[View$1]: getPicks$2,
|
|
2824
|
-
[WorkspaceSymbol$1]: getPicks$1
|
|
2825
|
-
};
|
|
3005
|
+
const selectPicks = [selectPick$a, selectPick$7, selectPick$9, selectPick$8, selectPick$7, selectPick$6, selectPick$5, selectPick$4, selectPick$3, selectPick$2, selectPick$1, selectPick];
|
|
3006
|
+
const getPicks = [getPicks$b, getPicks$8, getPicks$a, getPicks$9, getPicks$8, getPicks$7, getPicks$6, getPicks$5, getPicks$4, getPicks$3, getPicks$2, getPicks$1];
|
|
2826
3007
|
|
|
2827
3008
|
const Memfs = 'memfs';
|
|
2828
3009
|
const Html = 'html';
|