@lvce-editor/source-control-worker 1.23.0 → 2.1.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 +41 -10
- package/package.json +1 -1
|
@@ -1196,6 +1196,11 @@ const sendMessagePortToMarkdownWorker = async (port, rpcId) => {
|
|
|
1196
1196
|
// @ts-ignore
|
|
1197
1197
|
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToMarkdownWorker', port, command, rpcId);
|
|
1198
1198
|
};
|
|
1199
|
+
const sendMessagePortToIconThemeWorker = async (port, rpcId) => {
|
|
1200
|
+
const command = 'IconTheme.handleMessagePort';
|
|
1201
|
+
// @ts-ignore
|
|
1202
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToIconThemeWorker', port, command, rpcId);
|
|
1203
|
+
};
|
|
1199
1204
|
const sendMessagePortToFileSystemWorker = async (port, rpcId) => {
|
|
1200
1205
|
const command = 'FileSystem.handleMessagePort';
|
|
1201
1206
|
// @ts-ignore
|
|
@@ -1462,6 +1467,7 @@ const RendererWorker = {
|
|
|
1462
1467
|
sendMessagePortToErrorWorker,
|
|
1463
1468
|
sendMessagePortToExtensionHostWorker: sendMessagePortToExtensionHostWorker$1,
|
|
1464
1469
|
sendMessagePortToFileSystemWorker,
|
|
1470
|
+
sendMessagePortToIconThemeWorker,
|
|
1465
1471
|
sendMessagePortToMarkdownWorker,
|
|
1466
1472
|
sendMessagePortToRendererProcess,
|
|
1467
1473
|
sendMessagePortToSearchProcess,
|
|
@@ -1622,7 +1628,8 @@ const create2 = (id, uri, x, y, width, height, workspacePath) => {
|
|
|
1622
1628
|
inputLineHeight: 20,
|
|
1623
1629
|
inputBoxMaxHeight: 214,
|
|
1624
1630
|
history: [],
|
|
1625
|
-
viewMode: 1
|
|
1631
|
+
viewMode: 1,
|
|
1632
|
+
iconDefinitions: []
|
|
1626
1633
|
};
|
|
1627
1634
|
set$1(id, state, state);
|
|
1628
1635
|
};
|
|
@@ -1720,7 +1727,7 @@ const pathBaseName = path => {
|
|
|
1720
1727
|
return path.slice(path.lastIndexOf('/') + 1);
|
|
1721
1728
|
};
|
|
1722
1729
|
|
|
1723
|
-
const getDisplayItemsGroup = (group, expandedGroups) => {
|
|
1730
|
+
const getDisplayItemsGroup = (group, expandedGroups, iconDefinitions) => {
|
|
1724
1731
|
const displayItems = [];
|
|
1725
1732
|
const {
|
|
1726
1733
|
id,
|
|
@@ -1761,6 +1768,10 @@ const getDisplayItemsGroup = (group, expandedGroups) => {
|
|
|
1761
1768
|
} = item;
|
|
1762
1769
|
const baseName = pathBaseName(file);
|
|
1763
1770
|
const folderName = file.slice(0, -baseName.length - 1);
|
|
1771
|
+
let actualDecorationIcon = icon;
|
|
1772
|
+
if (typeof icon === 'number') {
|
|
1773
|
+
actualDecorationIcon = iconDefinitions[icon];
|
|
1774
|
+
}
|
|
1764
1775
|
displayItems.push({
|
|
1765
1776
|
file,
|
|
1766
1777
|
label: baseName,
|
|
@@ -1770,7 +1781,7 @@ const getDisplayItemsGroup = (group, expandedGroups) => {
|
|
|
1770
1781
|
icon: getFileIcon({
|
|
1771
1782
|
name: file
|
|
1772
1783
|
}),
|
|
1773
|
-
decorationIcon:
|
|
1784
|
+
decorationIcon: actualDecorationIcon,
|
|
1774
1785
|
decorationIconTitle: iconTitle,
|
|
1775
1786
|
decorationStrikeThrough: strikeThrough,
|
|
1776
1787
|
type: File,
|
|
@@ -1782,10 +1793,10 @@ const getDisplayItemsGroup = (group, expandedGroups) => {
|
|
|
1782
1793
|
return displayItems;
|
|
1783
1794
|
};
|
|
1784
1795
|
|
|
1785
|
-
const getDisplayItems = (allGroups, expandedGroups) => {
|
|
1796
|
+
const getDisplayItems = (allGroups, expandedGroups, iconDefinitions) => {
|
|
1786
1797
|
const displayItems = [];
|
|
1787
1798
|
for (const group of allGroups) {
|
|
1788
|
-
const groupDisplayItems = getDisplayItemsGroup(group, expandedGroups);
|
|
1799
|
+
const groupDisplayItems = getDisplayItemsGroup(group, expandedGroups, iconDefinitions);
|
|
1789
1800
|
displayItems.push(...groupDisplayItems);
|
|
1790
1801
|
}
|
|
1791
1802
|
return displayItems;
|
|
@@ -1873,6 +1884,11 @@ const getEnabledProviderIds$1 = (scheme, root) => {
|
|
|
1873
1884
|
// noProviderFoundMessage: 'No source control provider found',
|
|
1874
1885
|
});
|
|
1875
1886
|
};
|
|
1887
|
+
const getIconDefinitions$1 = async providerId => {
|
|
1888
|
+
// @ts-ignore
|
|
1889
|
+
const result = await invoke$1('ExtensionHostSourceControl.getIconDefinitions', providerId);
|
|
1890
|
+
return result;
|
|
1891
|
+
};
|
|
1876
1892
|
|
|
1877
1893
|
const getFileBefore = (providerId, file) => {
|
|
1878
1894
|
return getFileBefore$1(providerId, file);
|
|
@@ -1885,6 +1901,16 @@ const getEnabledProviderIds = (scheme, root) => {
|
|
|
1885
1901
|
const getGroups$1 = (providerId, root) => {
|
|
1886
1902
|
return getGroups$2(providerId, root);
|
|
1887
1903
|
};
|
|
1904
|
+
const getIconDefinitions = async providerIds => {
|
|
1905
|
+
try {
|
|
1906
|
+
if (providerIds.length === 0) {
|
|
1907
|
+
return [];
|
|
1908
|
+
}
|
|
1909
|
+
return await getIconDefinitions$1(providerIds[0]);
|
|
1910
|
+
} catch {
|
|
1911
|
+
return [];
|
|
1912
|
+
}
|
|
1913
|
+
};
|
|
1888
1914
|
|
|
1889
1915
|
const getGroups = async enabledProviderIds => {
|
|
1890
1916
|
const allGroups = [];
|
|
@@ -2071,13 +2097,16 @@ const loadContent = async (state, savedState) => {
|
|
|
2071
2097
|
inputValue
|
|
2072
2098
|
} = restoreState(savedState);
|
|
2073
2099
|
const enabledProviderIds = await getEnabledProviderIds(scheme, root);
|
|
2100
|
+
const iconDefinitions = await getIconDefinitions(enabledProviderIds);
|
|
2074
2101
|
const {
|
|
2075
2102
|
allGroups,
|
|
2076
2103
|
gitRoot
|
|
2077
2104
|
} = await getGroups(enabledProviderIds);
|
|
2078
2105
|
const expandedGroups = restoreExpandedGroups(allGroups);
|
|
2079
|
-
const displayItems = getDisplayItems(allGroups, expandedGroups);
|
|
2106
|
+
const displayItems = getDisplayItems(allGroups, expandedGroups, iconDefinitions);
|
|
2080
2107
|
const actionsCache = await requestSourceActions();
|
|
2108
|
+
|
|
2109
|
+
// TODO make preferences async and more functional
|
|
2081
2110
|
const splitButtonEnabled = get();
|
|
2082
2111
|
const total = displayItems.length;
|
|
2083
2112
|
const contentHeight = total * itemHeight;
|
|
@@ -2149,14 +2178,15 @@ const refresh = async state => {
|
|
|
2149
2178
|
fileIconCache,
|
|
2150
2179
|
enabledProviderIds,
|
|
2151
2180
|
splitButtonEnabled,
|
|
2152
|
-
actionsCache
|
|
2181
|
+
actionsCache,
|
|
2182
|
+
iconDefinitions
|
|
2153
2183
|
} = state;
|
|
2154
2184
|
const {
|
|
2155
2185
|
allGroups,
|
|
2156
2186
|
gitRoot
|
|
2157
2187
|
} = await getGroups(enabledProviderIds);
|
|
2158
2188
|
const expandedGroups = restoreExpandedGroups(allGroups);
|
|
2159
|
-
const displayItems = getDisplayItems(allGroups, expandedGroups);
|
|
2189
|
+
const displayItems = getDisplayItems(allGroups, expandedGroups, iconDefinitions);
|
|
2160
2190
|
const total = displayItems.length;
|
|
2161
2191
|
const contentHeight = total * itemHeight;
|
|
2162
2192
|
const listHeight = getListHeight(total, itemHeight, height);
|
|
@@ -2209,9 +2239,10 @@ const updateVisibleItems = async (state, expandedGroups) => {
|
|
|
2209
2239
|
height,
|
|
2210
2240
|
actionsCache,
|
|
2211
2241
|
fileIconCache,
|
|
2212
|
-
allGroups
|
|
2242
|
+
allGroups,
|
|
2243
|
+
iconDefinitions
|
|
2213
2244
|
} = state;
|
|
2214
|
-
const displayItems = getDisplayItems(allGroups, expandedGroups);
|
|
2245
|
+
const displayItems = getDisplayItems(allGroups, expandedGroups, iconDefinitions);
|
|
2215
2246
|
const total = displayItems.length;
|
|
2216
2247
|
const listHeight = getListHeight(total, itemHeight, height);
|
|
2217
2248
|
const numberOfVisible = getNumberOfVisibleItems(listHeight, itemHeight);
|