@lvce-editor/status-bar-worker 3.28.0 → 3.29.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/statusBarWorkerMain.js +220 -162
- package/package.json +1 -1
|
@@ -265,11 +265,10 @@ const {
|
|
|
265
265
|
getCommandIds,
|
|
266
266
|
getKeys,
|
|
267
267
|
registerCommands,
|
|
268
|
-
set: set$
|
|
268
|
+
set: set$6,
|
|
269
269
|
wrapCommand,
|
|
270
270
|
wrapGetter,
|
|
271
|
-
|
|
272
|
-
} = create$8();
|
|
271
|
+
wrapSerialAsyncCommand} = create$8();
|
|
273
272
|
|
|
274
273
|
const create$7 = (uid, uri, x, y, width, height, platform, assetDir) => {
|
|
275
274
|
const state = {
|
|
@@ -282,7 +281,7 @@ const create$7 = (uid, uri, x, y, width, height, platform, assetDir) => {
|
|
|
282
281
|
uid,
|
|
283
282
|
warningCount: 0
|
|
284
283
|
};
|
|
285
|
-
set$
|
|
284
|
+
set$6(uid, state, state);
|
|
286
285
|
};
|
|
287
286
|
|
|
288
287
|
const isEqual = (oldState, newState) => {
|
|
@@ -1702,7 +1701,7 @@ const createMockRpc = ({
|
|
|
1702
1701
|
};
|
|
1703
1702
|
|
|
1704
1703
|
const rpcs = Object.create(null);
|
|
1705
|
-
const set$
|
|
1704
|
+
const set$5 = (id, rpc) => {
|
|
1706
1705
|
rpcs[id] = rpc;
|
|
1707
1706
|
};
|
|
1708
1707
|
const get$3 = id => {
|
|
@@ -1735,7 +1734,7 @@ const create = rpcId => {
|
|
|
1735
1734
|
const mockRpc = createMockRpc({
|
|
1736
1735
|
commandMap
|
|
1737
1736
|
});
|
|
1738
|
-
set$
|
|
1737
|
+
set$5(rpcId, mockRpc);
|
|
1739
1738
|
// @ts-ignore
|
|
1740
1739
|
mockRpc[Symbol.dispose] = () => {
|
|
1741
1740
|
remove(rpcId);
|
|
@@ -1744,24 +1743,24 @@ const create = rpcId => {
|
|
|
1744
1743
|
return mockRpc;
|
|
1745
1744
|
},
|
|
1746
1745
|
set(rpc) {
|
|
1747
|
-
set$
|
|
1746
|
+
set$5(rpcId, rpc);
|
|
1748
1747
|
}
|
|
1749
1748
|
};
|
|
1750
1749
|
};
|
|
1751
1750
|
|
|
1752
1751
|
const {
|
|
1753
1752
|
invoke: invoke$3,
|
|
1754
|
-
set: set$
|
|
1753
|
+
set: set$4
|
|
1755
1754
|
} = create(ExtensionManagementWorker);
|
|
1756
1755
|
|
|
1757
1756
|
const {
|
|
1758
1757
|
invoke: invoke$2,
|
|
1759
|
-
set: set$
|
|
1758
|
+
set: set$3
|
|
1760
1759
|
} = create(RendererProcess);
|
|
1761
1760
|
|
|
1762
1761
|
const {
|
|
1763
1762
|
invoke: invoke$1,
|
|
1764
|
-
set: set$
|
|
1763
|
+
set: set$2
|
|
1765
1764
|
} = create(RendererWorker);
|
|
1766
1765
|
const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
1767
1766
|
number(uid);
|
|
@@ -1867,6 +1866,27 @@ const handleContextMenu = async (state, button, x, y) => {
|
|
|
1867
1866
|
return state;
|
|
1868
1867
|
};
|
|
1869
1868
|
|
|
1869
|
+
let editorStatus;
|
|
1870
|
+
const get$2 = () => editorStatus;
|
|
1871
|
+
const applyUpdate = update => {
|
|
1872
|
+
if (update === undefined) {
|
|
1873
|
+
editorStatus = undefined;
|
|
1874
|
+
return editorStatus;
|
|
1875
|
+
}
|
|
1876
|
+
// Older editor workers omit these fields; retain their original display defaults.
|
|
1877
|
+
const next = {
|
|
1878
|
+
endOfLine: 'lf',
|
|
1879
|
+
insertSpaces: true,
|
|
1880
|
+
...editorStatus,
|
|
1881
|
+
...update
|
|
1882
|
+
};
|
|
1883
|
+
if (typeof next.column !== 'number' || typeof next.encoding !== 'string' || typeof next.endOfLine !== 'string' || typeof next.insertSpaces !== 'boolean' || typeof next.languageId !== 'string' || typeof next.line !== 'number' || typeof next.tabSize !== 'number') {
|
|
1884
|
+
throw new TypeError('The first editor status update must contain a complete status');
|
|
1885
|
+
}
|
|
1886
|
+
editorStatus = next;
|
|
1887
|
+
return editorStatus;
|
|
1888
|
+
};
|
|
1889
|
+
|
|
1870
1890
|
const textItem = (name, text, ariaLabel, tooltip) => ({
|
|
1871
1891
|
ariaLabel,
|
|
1872
1892
|
command: '',
|
|
@@ -1896,6 +1916,156 @@ const getEditorStatusBarItems = status => {
|
|
|
1896
1916
|
return [textItem(EditorPosition, `Ln ${line}, Col ${column}`, `Line ${line}, Column ${column}`, 'Go to Line/Column'), textItem(EditorIndentation, indentationLabel, indentationLabel, 'Select Indentation'), textItem(EditorEncoding, encodingLabel, `Encoding: ${encodingLabel}`, 'Select Encoding'), textItem(EditorEndOfLine, endOfLineLabel, `End of Line: ${endOfLineLabel}`, 'Select End of Line Sequence'), textItem(EditorLanguage, languageId, `Language: ${languageId}`, 'Select Language Mode')];
|
|
1897
1917
|
};
|
|
1898
1918
|
|
|
1919
|
+
const dependencies = {
|
|
1920
|
+
[EditorEncoding]: ['encoding'],
|
|
1921
|
+
[EditorEndOfLine]: ['endOfLine'],
|
|
1922
|
+
[EditorIndentation]: ['insertSpaces', 'tabSize'],
|
|
1923
|
+
[EditorLanguage]: ['languageId'],
|
|
1924
|
+
[EditorPosition]: ['line', 'column']
|
|
1925
|
+
};
|
|
1926
|
+
const handleEditorStatusChanged = (state, editorStatus, previous = state) => {
|
|
1927
|
+
const {
|
|
1928
|
+
statusBarItemsRight
|
|
1929
|
+
} = state;
|
|
1930
|
+
const oldStatus = previous.editorStatus;
|
|
1931
|
+
if (!editorStatus) {
|
|
1932
|
+
if (!oldStatus) {
|
|
1933
|
+
return state;
|
|
1934
|
+
}
|
|
1935
|
+
return {
|
|
1936
|
+
...state,
|
|
1937
|
+
editorStatus,
|
|
1938
|
+
statusBarItemsRight: statusBarItemsRight.filter(item => !isEditorStatus(item.name))
|
|
1939
|
+
};
|
|
1940
|
+
}
|
|
1941
|
+
const replacements = new Map();
|
|
1942
|
+
for (const item of getEditorStatusBarItems(editorStatus)) {
|
|
1943
|
+
if (!oldStatus || dependencies[item.name].some(key => oldStatus[key] !== editorStatus[key])) {
|
|
1944
|
+
replacements.set(item.name, item);
|
|
1945
|
+
}
|
|
1946
|
+
}
|
|
1947
|
+
if (replacements.size === 0) {
|
|
1948
|
+
return state;
|
|
1949
|
+
}
|
|
1950
|
+
const updatedItems = statusBarItemsRight.map(item => {
|
|
1951
|
+
const replacement = replacements.get(item.name);
|
|
1952
|
+
replacements.delete(item.name);
|
|
1953
|
+
return replacement || item;
|
|
1954
|
+
});
|
|
1955
|
+
const notificationIndex = updatedItems.findIndex(item => item.name === Notifications);
|
|
1956
|
+
updatedItems.splice(notificationIndex === -1 ? updatedItems.length : notificationIndex, 0, ...replacements.values());
|
|
1957
|
+
return {
|
|
1958
|
+
...state,
|
|
1959
|
+
editorStatus,
|
|
1960
|
+
statusBarItemsRight: updatedItems
|
|
1961
|
+
};
|
|
1962
|
+
};
|
|
1963
|
+
|
|
1964
|
+
const renderIncremental = (oldState, newState) => {
|
|
1965
|
+
return renderItems(oldState, newState);
|
|
1966
|
+
};
|
|
1967
|
+
|
|
1968
|
+
const getRenderer = diffType => {
|
|
1969
|
+
switch (diffType) {
|
|
1970
|
+
case RenderIncremental:
|
|
1971
|
+
return renderIncremental;
|
|
1972
|
+
case RenderItems:
|
|
1973
|
+
return renderItems;
|
|
1974
|
+
default:
|
|
1975
|
+
throw new Error('unknown renderer');
|
|
1976
|
+
}
|
|
1977
|
+
};
|
|
1978
|
+
|
|
1979
|
+
const applyRender = (oldState, newState, diffResult) => {
|
|
1980
|
+
const commands = [];
|
|
1981
|
+
for (const item of diffResult) {
|
|
1982
|
+
const fn = getRenderer(item);
|
|
1983
|
+
const result = fn(oldState, newState);
|
|
1984
|
+
if (result.length > 0) {
|
|
1985
|
+
commands.push(result);
|
|
1986
|
+
}
|
|
1987
|
+
}
|
|
1988
|
+
return commands;
|
|
1989
|
+
};
|
|
1990
|
+
|
|
1991
|
+
const state = {
|
|
1992
|
+
connected: false
|
|
1993
|
+
};
|
|
1994
|
+
const isConnected = () => {
|
|
1995
|
+
const {
|
|
1996
|
+
connected
|
|
1997
|
+
} = state;
|
|
1998
|
+
return connected;
|
|
1999
|
+
};
|
|
2000
|
+
const invoke = (method, ...params) => {
|
|
2001
|
+
return invoke$2(method, ...params);
|
|
2002
|
+
};
|
|
2003
|
+
const set$1 = rpc => {
|
|
2004
|
+
set$3(rpc);
|
|
2005
|
+
state.connected = true;
|
|
2006
|
+
};
|
|
2007
|
+
|
|
2008
|
+
const renderDirect = async (uid, commands) => {
|
|
2009
|
+
const rendererWorkerCommands = commands.filter(command => command[0] === SetFocusContext);
|
|
2010
|
+
const rendererProcessCommands = commands.filter(command => command[0] !== SetFocusContext);
|
|
2011
|
+
const transactionId = await invoke('Viewlet.queueCommands', uid, rendererProcessCommands);
|
|
2012
|
+
return [...rendererWorkerCommands, ['Viewlet.commitPending', uid, transactionId]];
|
|
2013
|
+
};
|
|
2014
|
+
const render2 = (uid, diffResult) => {
|
|
2015
|
+
const {
|
|
2016
|
+
newState,
|
|
2017
|
+
oldState
|
|
2018
|
+
} = get$5(uid);
|
|
2019
|
+
set$6(uid, newState, newState);
|
|
2020
|
+
const commands = applyRender(oldState, newState, diffResult);
|
|
2021
|
+
if (!isConnected()) {
|
|
2022
|
+
return commands;
|
|
2023
|
+
}
|
|
2024
|
+
return renderDirect(uid, commands);
|
|
2025
|
+
};
|
|
2026
|
+
|
|
2027
|
+
const renderOutOfBand = async uid => {
|
|
2028
|
+
if (!isConnected()) {
|
|
2029
|
+
return;
|
|
2030
|
+
}
|
|
2031
|
+
const {
|
|
2032
|
+
newState
|
|
2033
|
+
} = get$5(uid);
|
|
2034
|
+
if (newState.initial) {
|
|
2035
|
+
return;
|
|
2036
|
+
}
|
|
2037
|
+
const diffResult = diff2(uid);
|
|
2038
|
+
if (diffResult.length === 0) {
|
|
2039
|
+
return;
|
|
2040
|
+
}
|
|
2041
|
+
const commands = await render2(uid, diffResult);
|
|
2042
|
+
if (commands.length === 0) {
|
|
2043
|
+
return;
|
|
2044
|
+
}
|
|
2045
|
+
await invoke('Viewlet.sendMultiple', commands);
|
|
2046
|
+
};
|
|
2047
|
+
|
|
2048
|
+
const handleEditorStatusChangedAll = async update => {
|
|
2049
|
+
const previous = {
|
|
2050
|
+
editorStatus: get$2()
|
|
2051
|
+
};
|
|
2052
|
+
const editorStatus = applyUpdate(update);
|
|
2053
|
+
const changedUids = [];
|
|
2054
|
+
for (const uid of getKeys()) {
|
|
2055
|
+
const {
|
|
2056
|
+
newState,
|
|
2057
|
+
oldState
|
|
2058
|
+
} = get$5(uid);
|
|
2059
|
+
const newerState = handleEditorStatusChanged(newState, editorStatus, previous);
|
|
2060
|
+
if (newState === newerState || oldState === newerState) {
|
|
2061
|
+
continue;
|
|
2062
|
+
}
|
|
2063
|
+
set$6(uid, oldState, newerState);
|
|
2064
|
+
changedUids.push(uid);
|
|
2065
|
+
}
|
|
2066
|
+
await Promise.all(changedUids.map(renderOutOfBand));
|
|
2067
|
+
};
|
|
2068
|
+
|
|
1899
2069
|
const getAriaLabel = count => {
|
|
1900
2070
|
if (count === 0) {
|
|
1901
2071
|
return 'No Notifications';
|
|
@@ -2105,90 +2275,6 @@ const handleItemsChanged = async state => {
|
|
|
2105
2275
|
return handleExtensionsChanged(state);
|
|
2106
2276
|
};
|
|
2107
2277
|
|
|
2108
|
-
const renderIncremental = (oldState, newState) => {
|
|
2109
|
-
return renderItems(oldState, newState);
|
|
2110
|
-
};
|
|
2111
|
-
|
|
2112
|
-
const getRenderer = diffType => {
|
|
2113
|
-
switch (diffType) {
|
|
2114
|
-
case RenderIncremental:
|
|
2115
|
-
return renderIncremental;
|
|
2116
|
-
case RenderItems:
|
|
2117
|
-
return renderItems;
|
|
2118
|
-
default:
|
|
2119
|
-
throw new Error('unknown renderer');
|
|
2120
|
-
}
|
|
2121
|
-
};
|
|
2122
|
-
|
|
2123
|
-
const applyRender = (oldState, newState, diffResult) => {
|
|
2124
|
-
const commands = [];
|
|
2125
|
-
for (const item of diffResult) {
|
|
2126
|
-
const fn = getRenderer(item);
|
|
2127
|
-
const result = fn(oldState, newState);
|
|
2128
|
-
if (result.length > 0) {
|
|
2129
|
-
commands.push(result);
|
|
2130
|
-
}
|
|
2131
|
-
}
|
|
2132
|
-
return commands;
|
|
2133
|
-
};
|
|
2134
|
-
|
|
2135
|
-
const state = {
|
|
2136
|
-
connected: false
|
|
2137
|
-
};
|
|
2138
|
-
const isConnected = () => {
|
|
2139
|
-
const {
|
|
2140
|
-
connected
|
|
2141
|
-
} = state;
|
|
2142
|
-
return connected;
|
|
2143
|
-
};
|
|
2144
|
-
const invoke = (method, ...params) => {
|
|
2145
|
-
return invoke$2(method, ...params);
|
|
2146
|
-
};
|
|
2147
|
-
const set$2 = rpc => {
|
|
2148
|
-
set$4(rpc);
|
|
2149
|
-
state.connected = true;
|
|
2150
|
-
};
|
|
2151
|
-
|
|
2152
|
-
const renderDirect = async (uid, commands) => {
|
|
2153
|
-
const rendererWorkerCommands = commands.filter(command => command[0] === SetFocusContext);
|
|
2154
|
-
const rendererProcessCommands = commands.filter(command => command[0] !== SetFocusContext);
|
|
2155
|
-
const transactionId = await invoke('Viewlet.queueCommands', uid, rendererProcessCommands);
|
|
2156
|
-
return [...rendererWorkerCommands, ['Viewlet.commitPending', uid, transactionId]];
|
|
2157
|
-
};
|
|
2158
|
-
const render2 = (uid, diffResult) => {
|
|
2159
|
-
const {
|
|
2160
|
-
newState,
|
|
2161
|
-
oldState
|
|
2162
|
-
} = get$5(uid);
|
|
2163
|
-
set$7(uid, newState, newState);
|
|
2164
|
-
const commands = applyRender(oldState, newState, diffResult);
|
|
2165
|
-
if (!isConnected()) {
|
|
2166
|
-
return commands;
|
|
2167
|
-
}
|
|
2168
|
-
return renderDirect(uid, commands);
|
|
2169
|
-
};
|
|
2170
|
-
|
|
2171
|
-
const renderOutOfBand = async uid => {
|
|
2172
|
-
if (!isConnected()) {
|
|
2173
|
-
return;
|
|
2174
|
-
}
|
|
2175
|
-
const {
|
|
2176
|
-
newState
|
|
2177
|
-
} = get$5(uid);
|
|
2178
|
-
if (newState.initial) {
|
|
2179
|
-
return;
|
|
2180
|
-
}
|
|
2181
|
-
const diffResult = diff2(uid);
|
|
2182
|
-
if (diffResult.length === 0) {
|
|
2183
|
-
return;
|
|
2184
|
-
}
|
|
2185
|
-
const commands = await render2(uid, diffResult);
|
|
2186
|
-
if (commands.length === 0) {
|
|
2187
|
-
return;
|
|
2188
|
-
}
|
|
2189
|
-
await invoke('Viewlet.sendMultiple', commands);
|
|
2190
|
-
};
|
|
2191
|
-
|
|
2192
2278
|
const handleExtensionManagementChange = async () => {
|
|
2193
2279
|
for (const uid of getKeys()) {
|
|
2194
2280
|
const {
|
|
@@ -2199,7 +2285,7 @@ const handleExtensionManagementChange = async () => {
|
|
|
2199
2285
|
if (newState === newerState || oldState === newerState) {
|
|
2200
2286
|
continue;
|
|
2201
2287
|
}
|
|
2202
|
-
set$
|
|
2288
|
+
set$6(uid, oldState, {
|
|
2203
2289
|
...newState,
|
|
2204
2290
|
...newerState
|
|
2205
2291
|
});
|
|
@@ -2226,15 +2312,15 @@ const handleNotificationCountChanged = (state, count) => {
|
|
|
2226
2312
|
};
|
|
2227
2313
|
|
|
2228
2314
|
let latestCount;
|
|
2229
|
-
const get$
|
|
2315
|
+
const get$1 = () => {
|
|
2230
2316
|
return latestCount;
|
|
2231
2317
|
};
|
|
2232
|
-
const set
|
|
2318
|
+
const set = count => {
|
|
2233
2319
|
latestCount = count;
|
|
2234
2320
|
};
|
|
2235
2321
|
|
|
2236
2322
|
const handleNotificationCountChangedAll = async count => {
|
|
2237
|
-
set
|
|
2323
|
+
set(count);
|
|
2238
2324
|
for (const uid of getKeys()) {
|
|
2239
2325
|
const {
|
|
2240
2326
|
newState,
|
|
@@ -2244,7 +2330,7 @@ const handleNotificationCountChangedAll = async count => {
|
|
|
2244
2330
|
if (newState === newerState || oldState === newerState) {
|
|
2245
2331
|
continue;
|
|
2246
2332
|
}
|
|
2247
|
-
set$
|
|
2333
|
+
set$6(uid, oldState, newerState);
|
|
2248
2334
|
await renderOutOfBand(uid);
|
|
2249
2335
|
}
|
|
2250
2336
|
};
|
|
@@ -2259,61 +2345,10 @@ const handleExtensionManagementMessagePort = async port => {
|
|
|
2259
2345
|
commandMap: commandMap$1,
|
|
2260
2346
|
messagePort: port
|
|
2261
2347
|
});
|
|
2262
|
-
set$
|
|
2263
|
-
};
|
|
2264
|
-
|
|
2265
|
-
let editorStatus;
|
|
2266
|
-
const get$1 = () => editorStatus;
|
|
2267
|
-
const set = value => {
|
|
2268
|
-
editorStatus = value;
|
|
2269
|
-
};
|
|
2270
|
-
|
|
2271
|
-
const equals = (oldStatus, newStatus) => {
|
|
2272
|
-
if (!oldStatus || !newStatus) {
|
|
2273
|
-
return oldStatus === newStatus;
|
|
2274
|
-
}
|
|
2275
|
-
return oldStatus.column === newStatus.column && oldStatus.endOfLine === newStatus.endOfLine && oldStatus.encoding === newStatus.encoding && oldStatus.insertSpaces === newStatus.insertSpaces && oldStatus.languageId === newStatus.languageId && oldStatus.line === newStatus.line && oldStatus.tabSize === newStatus.tabSize;
|
|
2276
|
-
};
|
|
2277
|
-
const updateItems = (items, status) => {
|
|
2278
|
-
const remainingItems = items.filter(item => !isEditorStatus(item.name));
|
|
2279
|
-
const editorItems = getEditorStatusBarItems(status);
|
|
2280
|
-
if (editorItems.length === 0) {
|
|
2281
|
-
return remainingItems;
|
|
2282
|
-
}
|
|
2283
|
-
const notificationIndex = remainingItems.findIndex(item => item.name === Notifications);
|
|
2284
|
-
const insertIndex = notificationIndex === -1 ? remainingItems.length : notificationIndex;
|
|
2285
|
-
return [...remainingItems.slice(0, insertIndex), ...editorItems, ...remainingItems.slice(insertIndex)];
|
|
2286
|
-
};
|
|
2287
|
-
const handleEditorStatusChanged = (state, editorStatus) => {
|
|
2288
|
-
const {
|
|
2289
|
-
editorStatus: oldEditorStatus,
|
|
2290
|
-
statusBarItemsRight
|
|
2291
|
-
} = state;
|
|
2292
|
-
if (equals(oldEditorStatus, editorStatus)) {
|
|
2293
|
-
return state;
|
|
2294
|
-
}
|
|
2295
|
-
return {
|
|
2296
|
-
...state,
|
|
2297
|
-
editorStatus,
|
|
2298
|
-
statusBarItemsRight: updateItems(statusBarItemsRight, editorStatus)
|
|
2299
|
-
};
|
|
2348
|
+
set$4(rpc);
|
|
2300
2349
|
};
|
|
2301
2350
|
|
|
2302
|
-
const
|
|
2303
|
-
set(editorStatus);
|
|
2304
|
-
for (const uid of getKeys()) {
|
|
2305
|
-
const {
|
|
2306
|
-
newState,
|
|
2307
|
-
oldState
|
|
2308
|
-
} = get$5(uid);
|
|
2309
|
-
const newerState = handleEditorStatusChanged(newState, editorStatus);
|
|
2310
|
-
if (newState === newerState || oldState === newerState) {
|
|
2311
|
-
continue;
|
|
2312
|
-
}
|
|
2313
|
-
set$7(uid, oldState, newerState);
|
|
2314
|
-
await renderOutOfBand(uid);
|
|
2315
|
-
}
|
|
2316
|
-
};
|
|
2351
|
+
const supportsEditorStatusDeltas = () => true;
|
|
2317
2352
|
|
|
2318
2353
|
const handleMessagePort = async (port, viewletCommandMap, setAsRendererProcess = true) => {
|
|
2319
2354
|
const executeViewletCommand = async (uid, command, ...args) => {
|
|
@@ -2327,12 +2362,13 @@ const handleMessagePort = async (port, viewletCommandMap, setAsRendererProcess =
|
|
|
2327
2362
|
const rpc = await create$2({
|
|
2328
2363
|
commandMap: {
|
|
2329
2364
|
'StatusBar.handleEditorStatusChanged': handleEditorStatusChangedAll,
|
|
2365
|
+
'StatusBar.supportsEditorStatusDeltas': supportsEditorStatusDeltas,
|
|
2330
2366
|
'Viewlet.executeViewletCommand': executeViewletCommand
|
|
2331
2367
|
},
|
|
2332
2368
|
messagePort: port
|
|
2333
2369
|
});
|
|
2334
2370
|
if (setAsRendererProcess) {
|
|
2335
|
-
set$
|
|
2371
|
+
set$1(rpc);
|
|
2336
2372
|
}
|
|
2337
2373
|
};
|
|
2338
2374
|
|
|
@@ -2437,7 +2473,7 @@ const loadContent = async state => {
|
|
|
2437
2473
|
platform,
|
|
2438
2474
|
warningCount
|
|
2439
2475
|
} = state;
|
|
2440
|
-
const editorStatus = get$
|
|
2476
|
+
const editorStatus = get$2();
|
|
2441
2477
|
const {
|
|
2442
2478
|
builtinNotificationsEnabled,
|
|
2443
2479
|
builtinProblemsEnabled,
|
|
@@ -2462,13 +2498,34 @@ const loadContent = async state => {
|
|
|
2462
2498
|
statusBarItemsRight: statusBarItems.filter(item => isRight(item.name)),
|
|
2463
2499
|
warningCount: 0
|
|
2464
2500
|
};
|
|
2465
|
-
const
|
|
2501
|
+
const currentState = itemsVisible ? handleEditorStatusChanged(loadedState, get$2()) : loadedState;
|
|
2502
|
+
const latestNotificationCount = get$1();
|
|
2466
2503
|
if (latestNotificationCount === undefined) {
|
|
2467
|
-
return
|
|
2504
|
+
return currentState;
|
|
2468
2505
|
}
|
|
2469
|
-
return handleNotificationCountChanged(
|
|
2506
|
+
return handleNotificationCountChanged(currentState, latestNotificationCount);
|
|
2470
2507
|
};
|
|
2471
2508
|
|
|
2509
|
+
const refreshExtensionItems = wrapSerialAsyncCommand(async context => {
|
|
2510
|
+
const state = context.getState();
|
|
2511
|
+
const {
|
|
2512
|
+
statusBarItemsLeft
|
|
2513
|
+
} = state;
|
|
2514
|
+
const updated = await handleItemsChanged(state);
|
|
2515
|
+
if (updated === state) {
|
|
2516
|
+
return;
|
|
2517
|
+
}
|
|
2518
|
+
await context.updateState(current => {
|
|
2519
|
+
if (current.statusBarItemsLeft !== statusBarItemsLeft) {
|
|
2520
|
+
return current;
|
|
2521
|
+
}
|
|
2522
|
+
return {
|
|
2523
|
+
...current,
|
|
2524
|
+
statusBarItemsLeft: updated.statusBarItemsLeft
|
|
2525
|
+
};
|
|
2526
|
+
});
|
|
2527
|
+
});
|
|
2528
|
+
|
|
2472
2529
|
const renderEventListeners = () => {
|
|
2473
2530
|
return [{
|
|
2474
2531
|
name: HandleContextMenu,
|
|
@@ -2517,7 +2574,6 @@ const setComponentState = wrapCommand(applyComponentState);
|
|
|
2517
2574
|
|
|
2518
2575
|
const handleDirectMessagePort = (port, setAsRendererProcess = true) => handleMessagePort(port, commandMap, setAsRendererProcess);
|
|
2519
2576
|
const activateOnWorkspaceChange = wrapCommand(handleWorkspaceChange);
|
|
2520
|
-
const refreshExtensionItems = wrapSerialCommand(handleItemsChanged);
|
|
2521
2577
|
const handleWorkspaceChangeAndRefresh = async (uid, workspacePath) => {
|
|
2522
2578
|
await activateOnWorkspaceChange(uid, workspacePath);
|
|
2523
2579
|
await refreshExtensionItems(uid);
|
|
@@ -2528,12 +2584,13 @@ const commandMap = {
|
|
|
2528
2584
|
'StatusBar.getCommandIds': getCommandIds,
|
|
2529
2585
|
'StatusBar.getComponentDom': getComponentDom,
|
|
2530
2586
|
'StatusBar.getComponentState': getComponentState,
|
|
2531
|
-
'StatusBar.handleChange':
|
|
2587
|
+
'StatusBar.handleChange': refreshExtensionItems,
|
|
2532
2588
|
'StatusBar.handleClick': wrapCommand(handleClick),
|
|
2533
2589
|
'StatusBar.handleContextMenu': wrapCommand(handleContextMenu),
|
|
2590
|
+
'StatusBar.handleEditorStatusChanged': handleEditorStatusChangedAll,
|
|
2534
2591
|
'StatusBar.handleExtensionManagementMessagePort': handleExtensionManagementMessagePort,
|
|
2535
|
-
'StatusBar.handleExtensionsChanged':
|
|
2536
|
-
'StatusBar.handleItemsChanged':
|
|
2592
|
+
'StatusBar.handleExtensionsChanged': refreshExtensionItems,
|
|
2593
|
+
'StatusBar.handleItemsChanged': refreshExtensionItems,
|
|
2537
2594
|
'StatusBar.handleMessagePort': handleDirectMessagePort,
|
|
2538
2595
|
'StatusBar.handleNotificationCountChanged': wrapCommand(handleNotificationCountChanged),
|
|
2539
2596
|
'StatusBar.handleProblemsSummaryChange': wrapCommand(handleProblemsSummaryChange),
|
|
@@ -2548,6 +2605,7 @@ const commandMap = {
|
|
|
2548
2605
|
'StatusBar.resize': wrapCommand(resize),
|
|
2549
2606
|
'StatusBar.saveState': wrapGetter(saveState),
|
|
2550
2607
|
'StatusBar.setComponentState': setComponentState,
|
|
2608
|
+
'StatusBar.supportsEditorStatusDeltas': supportsEditorStatusDeltas,
|
|
2551
2609
|
'StatusBar.terminate': terminate
|
|
2552
2610
|
};
|
|
2553
2611
|
|
|
@@ -2555,7 +2613,7 @@ const initializeRenderWorker = async () => {
|
|
|
2555
2613
|
const rpc = await create$1({
|
|
2556
2614
|
commandMap: commandMap
|
|
2557
2615
|
});
|
|
2558
|
-
set$
|
|
2616
|
+
set$2(rpc);
|
|
2559
2617
|
};
|
|
2560
2618
|
|
|
2561
2619
|
const listen = async () => {
|