@lvce-editor/source-control-worker 1.23.0 → 2.0.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/sourceControlWorkerMain.js +35 -10
- package/package.json +1 -1
|
@@ -1622,7 +1622,8 @@ const create2 = (id, uri, x, y, width, height, workspacePath) => {
|
|
|
1622
1622
|
inputLineHeight: 20,
|
|
1623
1623
|
inputBoxMaxHeight: 214,
|
|
1624
1624
|
history: [],
|
|
1625
|
-
viewMode: 1
|
|
1625
|
+
viewMode: 1,
|
|
1626
|
+
iconDefinitions: []
|
|
1626
1627
|
};
|
|
1627
1628
|
set$1(id, state, state);
|
|
1628
1629
|
};
|
|
@@ -1720,7 +1721,7 @@ const pathBaseName = path => {
|
|
|
1720
1721
|
return path.slice(path.lastIndexOf('/') + 1);
|
|
1721
1722
|
};
|
|
1722
1723
|
|
|
1723
|
-
const getDisplayItemsGroup = (group, expandedGroups) => {
|
|
1724
|
+
const getDisplayItemsGroup = (group, expandedGroups, iconDefinitions) => {
|
|
1724
1725
|
const displayItems = [];
|
|
1725
1726
|
const {
|
|
1726
1727
|
id,
|
|
@@ -1761,6 +1762,10 @@ const getDisplayItemsGroup = (group, expandedGroups) => {
|
|
|
1761
1762
|
} = item;
|
|
1762
1763
|
const baseName = pathBaseName(file);
|
|
1763
1764
|
const folderName = file.slice(0, -baseName.length - 1);
|
|
1765
|
+
let actualDecorationIcon = icon;
|
|
1766
|
+
if (typeof icon === 'number') {
|
|
1767
|
+
actualDecorationIcon = iconDefinitions[icon];
|
|
1768
|
+
}
|
|
1764
1769
|
displayItems.push({
|
|
1765
1770
|
file,
|
|
1766
1771
|
label: baseName,
|
|
@@ -1770,7 +1775,7 @@ const getDisplayItemsGroup = (group, expandedGroups) => {
|
|
|
1770
1775
|
icon: getFileIcon({
|
|
1771
1776
|
name: file
|
|
1772
1777
|
}),
|
|
1773
|
-
decorationIcon:
|
|
1778
|
+
decorationIcon: actualDecorationIcon,
|
|
1774
1779
|
decorationIconTitle: iconTitle,
|
|
1775
1780
|
decorationStrikeThrough: strikeThrough,
|
|
1776
1781
|
type: File,
|
|
@@ -1782,10 +1787,10 @@ const getDisplayItemsGroup = (group, expandedGroups) => {
|
|
|
1782
1787
|
return displayItems;
|
|
1783
1788
|
};
|
|
1784
1789
|
|
|
1785
|
-
const getDisplayItems = (allGroups, expandedGroups) => {
|
|
1790
|
+
const getDisplayItems = (allGroups, expandedGroups, iconDefinitions) => {
|
|
1786
1791
|
const displayItems = [];
|
|
1787
1792
|
for (const group of allGroups) {
|
|
1788
|
-
const groupDisplayItems = getDisplayItemsGroup(group, expandedGroups);
|
|
1793
|
+
const groupDisplayItems = getDisplayItemsGroup(group, expandedGroups, iconDefinitions);
|
|
1789
1794
|
displayItems.push(...groupDisplayItems);
|
|
1790
1795
|
}
|
|
1791
1796
|
return displayItems;
|
|
@@ -1873,6 +1878,11 @@ const getEnabledProviderIds$1 = (scheme, root) => {
|
|
|
1873
1878
|
// noProviderFoundMessage: 'No source control provider found',
|
|
1874
1879
|
});
|
|
1875
1880
|
};
|
|
1881
|
+
const getIconDefinitions$1 = async providerId => {
|
|
1882
|
+
// @ts-ignore
|
|
1883
|
+
const result = await invoke$1('ExtensionHostSourceControl.getIconDefinitions', providerId);
|
|
1884
|
+
return result;
|
|
1885
|
+
};
|
|
1876
1886
|
|
|
1877
1887
|
const getFileBefore = (providerId, file) => {
|
|
1878
1888
|
return getFileBefore$1(providerId, file);
|
|
@@ -1885,6 +1895,16 @@ const getEnabledProviderIds = (scheme, root) => {
|
|
|
1885
1895
|
const getGroups$1 = (providerId, root) => {
|
|
1886
1896
|
return getGroups$2(providerId, root);
|
|
1887
1897
|
};
|
|
1898
|
+
const getIconDefinitions = async providerIds => {
|
|
1899
|
+
try {
|
|
1900
|
+
if (providerIds.length === 0) {
|
|
1901
|
+
return [];
|
|
1902
|
+
}
|
|
1903
|
+
return await getIconDefinitions$1(providerIds[0]);
|
|
1904
|
+
} catch {
|
|
1905
|
+
return [];
|
|
1906
|
+
}
|
|
1907
|
+
};
|
|
1888
1908
|
|
|
1889
1909
|
const getGroups = async enabledProviderIds => {
|
|
1890
1910
|
const allGroups = [];
|
|
@@ -2071,13 +2091,16 @@ const loadContent = async (state, savedState) => {
|
|
|
2071
2091
|
inputValue
|
|
2072
2092
|
} = restoreState(savedState);
|
|
2073
2093
|
const enabledProviderIds = await getEnabledProviderIds(scheme, root);
|
|
2094
|
+
const iconDefinitions = await getIconDefinitions(enabledProviderIds);
|
|
2074
2095
|
const {
|
|
2075
2096
|
allGroups,
|
|
2076
2097
|
gitRoot
|
|
2077
2098
|
} = await getGroups(enabledProviderIds);
|
|
2078
2099
|
const expandedGroups = restoreExpandedGroups(allGroups);
|
|
2079
|
-
const displayItems = getDisplayItems(allGroups, expandedGroups);
|
|
2100
|
+
const displayItems = getDisplayItems(allGroups, expandedGroups, iconDefinitions);
|
|
2080
2101
|
const actionsCache = await requestSourceActions();
|
|
2102
|
+
|
|
2103
|
+
// TODO make preferences async and more functional
|
|
2081
2104
|
const splitButtonEnabled = get();
|
|
2082
2105
|
const total = displayItems.length;
|
|
2083
2106
|
const contentHeight = total * itemHeight;
|
|
@@ -2149,14 +2172,15 @@ const refresh = async state => {
|
|
|
2149
2172
|
fileIconCache,
|
|
2150
2173
|
enabledProviderIds,
|
|
2151
2174
|
splitButtonEnabled,
|
|
2152
|
-
actionsCache
|
|
2175
|
+
actionsCache,
|
|
2176
|
+
iconDefinitions
|
|
2153
2177
|
} = state;
|
|
2154
2178
|
const {
|
|
2155
2179
|
allGroups,
|
|
2156
2180
|
gitRoot
|
|
2157
2181
|
} = await getGroups(enabledProviderIds);
|
|
2158
2182
|
const expandedGroups = restoreExpandedGroups(allGroups);
|
|
2159
|
-
const displayItems = getDisplayItems(allGroups, expandedGroups);
|
|
2183
|
+
const displayItems = getDisplayItems(allGroups, expandedGroups, iconDefinitions);
|
|
2160
2184
|
const total = displayItems.length;
|
|
2161
2185
|
const contentHeight = total * itemHeight;
|
|
2162
2186
|
const listHeight = getListHeight(total, itemHeight, height);
|
|
@@ -2209,9 +2233,10 @@ const updateVisibleItems = async (state, expandedGroups) => {
|
|
|
2209
2233
|
height,
|
|
2210
2234
|
actionsCache,
|
|
2211
2235
|
fileIconCache,
|
|
2212
|
-
allGroups
|
|
2236
|
+
allGroups,
|
|
2237
|
+
iconDefinitions
|
|
2213
2238
|
} = state;
|
|
2214
|
-
const displayItems = getDisplayItems(allGroups, expandedGroups);
|
|
2239
|
+
const displayItems = getDisplayItems(allGroups, expandedGroups, iconDefinitions);
|
|
2215
2240
|
const total = displayItems.length;
|
|
2216
2241
|
const listHeight = getListHeight(total, itemHeight, height);
|
|
2217
2242
|
const numberOfVisible = getNumberOfVisibleItems(listHeight, itemHeight);
|