@lvce-editor/status-bar-worker 3.28.0 → 3.30.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 +243 -166
- 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) => {
|
|
@@ -1289,6 +1288,9 @@ const restoreExistingError = (error, currentStack) => {
|
|
|
1289
1288
|
};
|
|
1290
1289
|
const restoreMethodNotFoundError = (error, currentStack) => {
|
|
1291
1290
|
const restoredError = new JsonRpcError(error.message);
|
|
1291
|
+
Object.assign(restoredError, {
|
|
1292
|
+
code: error.code
|
|
1293
|
+
});
|
|
1292
1294
|
const parentStack = getParentStack(error);
|
|
1293
1295
|
setStack(restoredError, `${parentStack}${NewLine}${currentStack}`);
|
|
1294
1296
|
return restoredError;
|
|
@@ -1308,9 +1310,13 @@ const applyDataProperties = (restoredError, error) => {
|
|
|
1308
1310
|
// @ts-ignore
|
|
1309
1311
|
restoredError.codeFrame = error.data.codeFrame;
|
|
1310
1312
|
}
|
|
1311
|
-
if (error.data.code) {
|
|
1313
|
+
if (typeof error.data.code === 'string' || typeof error.data.code === 'number') {
|
|
1312
1314
|
// @ts-ignore
|
|
1313
|
-
restoredError
|
|
1315
|
+
Object.defineProperty(restoredError, 'code', {
|
|
1316
|
+
configurable: true,
|
|
1317
|
+
value: error.data.code,
|
|
1318
|
+
writable: true
|
|
1319
|
+
});
|
|
1314
1320
|
}
|
|
1315
1321
|
if (error.data.type) {
|
|
1316
1322
|
// @ts-ignore
|
|
@@ -1332,6 +1338,13 @@ const applyDirectProperties = (restoredError, error) => {
|
|
|
1332
1338
|
};
|
|
1333
1339
|
const restoreMessageError = (error, _currentStack) => {
|
|
1334
1340
|
const restoredError = constructError(error.message, error.type, error.name);
|
|
1341
|
+
if (typeof error.code === 'string' || typeof error.code === 'number') {
|
|
1342
|
+
Object.defineProperty(restoredError, 'code', {
|
|
1343
|
+
configurable: true,
|
|
1344
|
+
value: error.code,
|
|
1345
|
+
writable: true
|
|
1346
|
+
});
|
|
1347
|
+
}
|
|
1335
1348
|
if (error.data) {
|
|
1336
1349
|
applyDataProperties(restoredError, error);
|
|
1337
1350
|
} else {
|
|
@@ -1410,7 +1423,7 @@ const getErrorProperty = (error, prettyError) => {
|
|
|
1410
1423
|
return {
|
|
1411
1424
|
code: Custom,
|
|
1412
1425
|
data: {
|
|
1413
|
-
code: prettyError.code,
|
|
1426
|
+
code: prettyError.code ?? error?.code,
|
|
1414
1427
|
codeFrame: prettyError.codeFrame,
|
|
1415
1428
|
name: prettyError.name,
|
|
1416
1429
|
stack: getStack(prettyError),
|
|
@@ -1447,7 +1460,12 @@ const getErrorResponseSimple = (id, error) => {
|
|
|
1447
1460
|
return {
|
|
1448
1461
|
error: {
|
|
1449
1462
|
code: Custom,
|
|
1450
|
-
data: error
|
|
1463
|
+
data: error instanceof Error ? {
|
|
1464
|
+
...error,
|
|
1465
|
+
code: 'code' in error ? error.code : undefined,
|
|
1466
|
+
stack: error.stack,
|
|
1467
|
+
type: error.name
|
|
1468
|
+
} : error,
|
|
1451
1469
|
// @ts-ignore
|
|
1452
1470
|
message: error.message
|
|
1453
1471
|
},
|
|
@@ -1702,7 +1720,7 @@ const createMockRpc = ({
|
|
|
1702
1720
|
};
|
|
1703
1721
|
|
|
1704
1722
|
const rpcs = Object.create(null);
|
|
1705
|
-
const set$
|
|
1723
|
+
const set$5 = (id, rpc) => {
|
|
1706
1724
|
rpcs[id] = rpc;
|
|
1707
1725
|
};
|
|
1708
1726
|
const get$3 = id => {
|
|
@@ -1735,7 +1753,7 @@ const create = rpcId => {
|
|
|
1735
1753
|
const mockRpc = createMockRpc({
|
|
1736
1754
|
commandMap
|
|
1737
1755
|
});
|
|
1738
|
-
set$
|
|
1756
|
+
set$5(rpcId, mockRpc);
|
|
1739
1757
|
// @ts-ignore
|
|
1740
1758
|
mockRpc[Symbol.dispose] = () => {
|
|
1741
1759
|
remove(rpcId);
|
|
@@ -1744,24 +1762,24 @@ const create = rpcId => {
|
|
|
1744
1762
|
return mockRpc;
|
|
1745
1763
|
},
|
|
1746
1764
|
set(rpc) {
|
|
1747
|
-
set$
|
|
1765
|
+
set$5(rpcId, rpc);
|
|
1748
1766
|
}
|
|
1749
1767
|
};
|
|
1750
1768
|
};
|
|
1751
1769
|
|
|
1752
1770
|
const {
|
|
1753
1771
|
invoke: invoke$3,
|
|
1754
|
-
set: set$
|
|
1772
|
+
set: set$4
|
|
1755
1773
|
} = create(ExtensionManagementWorker);
|
|
1756
1774
|
|
|
1757
1775
|
const {
|
|
1758
1776
|
invoke: invoke$2,
|
|
1759
|
-
set: set$
|
|
1777
|
+
set: set$3
|
|
1760
1778
|
} = create(RendererProcess);
|
|
1761
1779
|
|
|
1762
1780
|
const {
|
|
1763
1781
|
invoke: invoke$1,
|
|
1764
|
-
set: set$
|
|
1782
|
+
set: set$2
|
|
1765
1783
|
} = create(RendererWorker);
|
|
1766
1784
|
const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
1767
1785
|
number(uid);
|
|
@@ -1867,6 +1885,27 @@ const handleContextMenu = async (state, button, x, y) => {
|
|
|
1867
1885
|
return state;
|
|
1868
1886
|
};
|
|
1869
1887
|
|
|
1888
|
+
let editorStatus;
|
|
1889
|
+
const get$2 = () => editorStatus;
|
|
1890
|
+
const applyUpdate = update => {
|
|
1891
|
+
if (update === undefined) {
|
|
1892
|
+
editorStatus = undefined;
|
|
1893
|
+
return editorStatus;
|
|
1894
|
+
}
|
|
1895
|
+
// Older editor workers omit these fields; retain their original display defaults.
|
|
1896
|
+
const next = {
|
|
1897
|
+
endOfLine: 'lf',
|
|
1898
|
+
insertSpaces: true,
|
|
1899
|
+
...editorStatus,
|
|
1900
|
+
...update
|
|
1901
|
+
};
|
|
1902
|
+
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') {
|
|
1903
|
+
throw new TypeError('The first editor status update must contain a complete status');
|
|
1904
|
+
}
|
|
1905
|
+
editorStatus = next;
|
|
1906
|
+
return editorStatus;
|
|
1907
|
+
};
|
|
1908
|
+
|
|
1870
1909
|
const textItem = (name, text, ariaLabel, tooltip) => ({
|
|
1871
1910
|
ariaLabel,
|
|
1872
1911
|
command: '',
|
|
@@ -1896,6 +1935,156 @@ const getEditorStatusBarItems = status => {
|
|
|
1896
1935
|
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
1936
|
};
|
|
1898
1937
|
|
|
1938
|
+
const dependencies = {
|
|
1939
|
+
[EditorEncoding]: ['encoding'],
|
|
1940
|
+
[EditorEndOfLine]: ['endOfLine'],
|
|
1941
|
+
[EditorIndentation]: ['insertSpaces', 'tabSize'],
|
|
1942
|
+
[EditorLanguage]: ['languageId'],
|
|
1943
|
+
[EditorPosition]: ['line', 'column']
|
|
1944
|
+
};
|
|
1945
|
+
const handleEditorStatusChanged = (state, editorStatus, previous = state) => {
|
|
1946
|
+
const {
|
|
1947
|
+
statusBarItemsRight
|
|
1948
|
+
} = state;
|
|
1949
|
+
const oldStatus = previous.editorStatus;
|
|
1950
|
+
if (!editorStatus) {
|
|
1951
|
+
if (!oldStatus) {
|
|
1952
|
+
return state;
|
|
1953
|
+
}
|
|
1954
|
+
return {
|
|
1955
|
+
...state,
|
|
1956
|
+
editorStatus,
|
|
1957
|
+
statusBarItemsRight: statusBarItemsRight.filter(item => !isEditorStatus(item.name))
|
|
1958
|
+
};
|
|
1959
|
+
}
|
|
1960
|
+
const replacements = new Map();
|
|
1961
|
+
for (const item of getEditorStatusBarItems(editorStatus)) {
|
|
1962
|
+
if (!oldStatus || dependencies[item.name].some(key => oldStatus[key] !== editorStatus[key])) {
|
|
1963
|
+
replacements.set(item.name, item);
|
|
1964
|
+
}
|
|
1965
|
+
}
|
|
1966
|
+
if (replacements.size === 0) {
|
|
1967
|
+
return state;
|
|
1968
|
+
}
|
|
1969
|
+
const updatedItems = statusBarItemsRight.map(item => {
|
|
1970
|
+
const replacement = replacements.get(item.name);
|
|
1971
|
+
replacements.delete(item.name);
|
|
1972
|
+
return replacement || item;
|
|
1973
|
+
});
|
|
1974
|
+
const notificationIndex = updatedItems.findIndex(item => item.name === Notifications);
|
|
1975
|
+
updatedItems.splice(notificationIndex === -1 ? updatedItems.length : notificationIndex, 0, ...replacements.values());
|
|
1976
|
+
return {
|
|
1977
|
+
...state,
|
|
1978
|
+
editorStatus,
|
|
1979
|
+
statusBarItemsRight: updatedItems
|
|
1980
|
+
};
|
|
1981
|
+
};
|
|
1982
|
+
|
|
1983
|
+
const renderIncremental = (oldState, newState) => {
|
|
1984
|
+
return renderItems(oldState, newState);
|
|
1985
|
+
};
|
|
1986
|
+
|
|
1987
|
+
const getRenderer = diffType => {
|
|
1988
|
+
switch (diffType) {
|
|
1989
|
+
case RenderIncremental:
|
|
1990
|
+
return renderIncremental;
|
|
1991
|
+
case RenderItems:
|
|
1992
|
+
return renderItems;
|
|
1993
|
+
default:
|
|
1994
|
+
throw new Error('unknown renderer');
|
|
1995
|
+
}
|
|
1996
|
+
};
|
|
1997
|
+
|
|
1998
|
+
const applyRender = (oldState, newState, diffResult) => {
|
|
1999
|
+
const commands = [];
|
|
2000
|
+
for (const item of diffResult) {
|
|
2001
|
+
const fn = getRenderer(item);
|
|
2002
|
+
const result = fn(oldState, newState);
|
|
2003
|
+
if (result.length > 0) {
|
|
2004
|
+
commands.push(result);
|
|
2005
|
+
}
|
|
2006
|
+
}
|
|
2007
|
+
return commands;
|
|
2008
|
+
};
|
|
2009
|
+
|
|
2010
|
+
const state = {
|
|
2011
|
+
connected: false
|
|
2012
|
+
};
|
|
2013
|
+
const isConnected = () => {
|
|
2014
|
+
const {
|
|
2015
|
+
connected
|
|
2016
|
+
} = state;
|
|
2017
|
+
return connected;
|
|
2018
|
+
};
|
|
2019
|
+
const invoke = (method, ...params) => {
|
|
2020
|
+
return invoke$2(method, ...params);
|
|
2021
|
+
};
|
|
2022
|
+
const set$1 = rpc => {
|
|
2023
|
+
set$3(rpc);
|
|
2024
|
+
state.connected = true;
|
|
2025
|
+
};
|
|
2026
|
+
|
|
2027
|
+
const renderDirect = async (uid, commands) => {
|
|
2028
|
+
const rendererWorkerCommands = commands.filter(command => command[0] === SetFocusContext);
|
|
2029
|
+
const rendererProcessCommands = commands.filter(command => command[0] !== SetFocusContext);
|
|
2030
|
+
const transactionId = await invoke('Viewlet.queueCommands', uid, rendererProcessCommands);
|
|
2031
|
+
return [...rendererWorkerCommands, ['Viewlet.commitPending', uid, transactionId]];
|
|
2032
|
+
};
|
|
2033
|
+
const render2 = (uid, diffResult) => {
|
|
2034
|
+
const {
|
|
2035
|
+
newState,
|
|
2036
|
+
oldState
|
|
2037
|
+
} = get$5(uid);
|
|
2038
|
+
set$6(uid, newState, newState);
|
|
2039
|
+
const commands = applyRender(oldState, newState, diffResult);
|
|
2040
|
+
if (!isConnected()) {
|
|
2041
|
+
return commands;
|
|
2042
|
+
}
|
|
2043
|
+
return renderDirect(uid, commands);
|
|
2044
|
+
};
|
|
2045
|
+
|
|
2046
|
+
const renderOutOfBand = async uid => {
|
|
2047
|
+
if (!isConnected()) {
|
|
2048
|
+
return;
|
|
2049
|
+
}
|
|
2050
|
+
const {
|
|
2051
|
+
newState
|
|
2052
|
+
} = get$5(uid);
|
|
2053
|
+
if (newState.initial) {
|
|
2054
|
+
return;
|
|
2055
|
+
}
|
|
2056
|
+
const diffResult = diff2(uid);
|
|
2057
|
+
if (diffResult.length === 0) {
|
|
2058
|
+
return;
|
|
2059
|
+
}
|
|
2060
|
+
const commands = await render2(uid, diffResult);
|
|
2061
|
+
if (commands.length === 0) {
|
|
2062
|
+
return;
|
|
2063
|
+
}
|
|
2064
|
+
await invoke('Viewlet.sendMultiple', commands);
|
|
2065
|
+
};
|
|
2066
|
+
|
|
2067
|
+
const handleEditorStatusChangedAll = async update => {
|
|
2068
|
+
const previous = {
|
|
2069
|
+
editorStatus: get$2()
|
|
2070
|
+
};
|
|
2071
|
+
const editorStatus = applyUpdate(update);
|
|
2072
|
+
const changedUids = [];
|
|
2073
|
+
for (const uid of getKeys()) {
|
|
2074
|
+
const {
|
|
2075
|
+
newState,
|
|
2076
|
+
oldState
|
|
2077
|
+
} = get$5(uid);
|
|
2078
|
+
const newerState = handleEditorStatusChanged(newState, editorStatus, previous);
|
|
2079
|
+
if (newState === newerState || oldState === newerState) {
|
|
2080
|
+
continue;
|
|
2081
|
+
}
|
|
2082
|
+
set$6(uid, oldState, newerState);
|
|
2083
|
+
changedUids.push(uid);
|
|
2084
|
+
}
|
|
2085
|
+
await Promise.all(changedUids.map(renderOutOfBand));
|
|
2086
|
+
};
|
|
2087
|
+
|
|
1899
2088
|
const getAriaLabel = count => {
|
|
1900
2089
|
if (count === 0) {
|
|
1901
2090
|
return 'No Notifications';
|
|
@@ -2105,90 +2294,6 @@ const handleItemsChanged = async state => {
|
|
|
2105
2294
|
return handleExtensionsChanged(state);
|
|
2106
2295
|
};
|
|
2107
2296
|
|
|
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
2297
|
const handleExtensionManagementChange = async () => {
|
|
2193
2298
|
for (const uid of getKeys()) {
|
|
2194
2299
|
const {
|
|
@@ -2199,7 +2304,7 @@ const handleExtensionManagementChange = async () => {
|
|
|
2199
2304
|
if (newState === newerState || oldState === newerState) {
|
|
2200
2305
|
continue;
|
|
2201
2306
|
}
|
|
2202
|
-
set$
|
|
2307
|
+
set$6(uid, oldState, {
|
|
2203
2308
|
...newState,
|
|
2204
2309
|
...newerState
|
|
2205
2310
|
});
|
|
@@ -2226,15 +2331,15 @@ const handleNotificationCountChanged = (state, count) => {
|
|
|
2226
2331
|
};
|
|
2227
2332
|
|
|
2228
2333
|
let latestCount;
|
|
2229
|
-
const get$
|
|
2334
|
+
const get$1 = () => {
|
|
2230
2335
|
return latestCount;
|
|
2231
2336
|
};
|
|
2232
|
-
const set
|
|
2337
|
+
const set = count => {
|
|
2233
2338
|
latestCount = count;
|
|
2234
2339
|
};
|
|
2235
2340
|
|
|
2236
2341
|
const handleNotificationCountChangedAll = async count => {
|
|
2237
|
-
set
|
|
2342
|
+
set(count);
|
|
2238
2343
|
for (const uid of getKeys()) {
|
|
2239
2344
|
const {
|
|
2240
2345
|
newState,
|
|
@@ -2244,7 +2349,7 @@ const handleNotificationCountChangedAll = async count => {
|
|
|
2244
2349
|
if (newState === newerState || oldState === newerState) {
|
|
2245
2350
|
continue;
|
|
2246
2351
|
}
|
|
2247
|
-
set$
|
|
2352
|
+
set$6(uid, oldState, newerState);
|
|
2248
2353
|
await renderOutOfBand(uid);
|
|
2249
2354
|
}
|
|
2250
2355
|
};
|
|
@@ -2259,61 +2364,10 @@ const handleExtensionManagementMessagePort = async port => {
|
|
|
2259
2364
|
commandMap: commandMap$1,
|
|
2260
2365
|
messagePort: port
|
|
2261
2366
|
});
|
|
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
|
-
};
|
|
2367
|
+
set$4(rpc);
|
|
2300
2368
|
};
|
|
2301
2369
|
|
|
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
|
-
};
|
|
2370
|
+
const supportsEditorStatusDeltas = () => true;
|
|
2317
2371
|
|
|
2318
2372
|
const handleMessagePort = async (port, viewletCommandMap, setAsRendererProcess = true) => {
|
|
2319
2373
|
const executeViewletCommand = async (uid, command, ...args) => {
|
|
@@ -2327,12 +2381,13 @@ const handleMessagePort = async (port, viewletCommandMap, setAsRendererProcess =
|
|
|
2327
2381
|
const rpc = await create$2({
|
|
2328
2382
|
commandMap: {
|
|
2329
2383
|
'StatusBar.handleEditorStatusChanged': handleEditorStatusChangedAll,
|
|
2384
|
+
'StatusBar.supportsEditorStatusDeltas': supportsEditorStatusDeltas,
|
|
2330
2385
|
'Viewlet.executeViewletCommand': executeViewletCommand
|
|
2331
2386
|
},
|
|
2332
2387
|
messagePort: port
|
|
2333
2388
|
});
|
|
2334
2389
|
if (setAsRendererProcess) {
|
|
2335
|
-
set$
|
|
2390
|
+
set$1(rpc);
|
|
2336
2391
|
}
|
|
2337
2392
|
};
|
|
2338
2393
|
|
|
@@ -2437,7 +2492,7 @@ const loadContent = async state => {
|
|
|
2437
2492
|
platform,
|
|
2438
2493
|
warningCount
|
|
2439
2494
|
} = state;
|
|
2440
|
-
const editorStatus = get$
|
|
2495
|
+
const editorStatus = get$2();
|
|
2441
2496
|
const {
|
|
2442
2497
|
builtinNotificationsEnabled,
|
|
2443
2498
|
builtinProblemsEnabled,
|
|
@@ -2462,13 +2517,34 @@ const loadContent = async state => {
|
|
|
2462
2517
|
statusBarItemsRight: statusBarItems.filter(item => isRight(item.name)),
|
|
2463
2518
|
warningCount: 0
|
|
2464
2519
|
};
|
|
2465
|
-
const
|
|
2520
|
+
const currentState = itemsVisible ? handleEditorStatusChanged(loadedState, get$2()) : loadedState;
|
|
2521
|
+
const latestNotificationCount = get$1();
|
|
2466
2522
|
if (latestNotificationCount === undefined) {
|
|
2467
|
-
return
|
|
2523
|
+
return currentState;
|
|
2468
2524
|
}
|
|
2469
|
-
return handleNotificationCountChanged(
|
|
2525
|
+
return handleNotificationCountChanged(currentState, latestNotificationCount);
|
|
2470
2526
|
};
|
|
2471
2527
|
|
|
2528
|
+
const refreshExtensionItems = wrapSerialAsyncCommand(async context => {
|
|
2529
|
+
const state = context.getState();
|
|
2530
|
+
const {
|
|
2531
|
+
statusBarItemsLeft
|
|
2532
|
+
} = state;
|
|
2533
|
+
const updated = await handleItemsChanged(state);
|
|
2534
|
+
if (updated === state) {
|
|
2535
|
+
return;
|
|
2536
|
+
}
|
|
2537
|
+
await context.updateState(current => {
|
|
2538
|
+
if (current.statusBarItemsLeft !== statusBarItemsLeft) {
|
|
2539
|
+
return current;
|
|
2540
|
+
}
|
|
2541
|
+
return {
|
|
2542
|
+
...current,
|
|
2543
|
+
statusBarItemsLeft: updated.statusBarItemsLeft
|
|
2544
|
+
};
|
|
2545
|
+
});
|
|
2546
|
+
});
|
|
2547
|
+
|
|
2472
2548
|
const renderEventListeners = () => {
|
|
2473
2549
|
return [{
|
|
2474
2550
|
name: HandleContextMenu,
|
|
@@ -2517,7 +2593,6 @@ const setComponentState = wrapCommand(applyComponentState);
|
|
|
2517
2593
|
|
|
2518
2594
|
const handleDirectMessagePort = (port, setAsRendererProcess = true) => handleMessagePort(port, commandMap, setAsRendererProcess);
|
|
2519
2595
|
const activateOnWorkspaceChange = wrapCommand(handleWorkspaceChange);
|
|
2520
|
-
const refreshExtensionItems = wrapSerialCommand(handleItemsChanged);
|
|
2521
2596
|
const handleWorkspaceChangeAndRefresh = async (uid, workspacePath) => {
|
|
2522
2597
|
await activateOnWorkspaceChange(uid, workspacePath);
|
|
2523
2598
|
await refreshExtensionItems(uid);
|
|
@@ -2528,12 +2603,13 @@ const commandMap = {
|
|
|
2528
2603
|
'StatusBar.getCommandIds': getCommandIds,
|
|
2529
2604
|
'StatusBar.getComponentDom': getComponentDom,
|
|
2530
2605
|
'StatusBar.getComponentState': getComponentState,
|
|
2531
|
-
'StatusBar.handleChange':
|
|
2606
|
+
'StatusBar.handleChange': refreshExtensionItems,
|
|
2532
2607
|
'StatusBar.handleClick': wrapCommand(handleClick),
|
|
2533
2608
|
'StatusBar.handleContextMenu': wrapCommand(handleContextMenu),
|
|
2609
|
+
'StatusBar.handleEditorStatusChanged': handleEditorStatusChangedAll,
|
|
2534
2610
|
'StatusBar.handleExtensionManagementMessagePort': handleExtensionManagementMessagePort,
|
|
2535
|
-
'StatusBar.handleExtensionsChanged':
|
|
2536
|
-
'StatusBar.handleItemsChanged':
|
|
2611
|
+
'StatusBar.handleExtensionsChanged': refreshExtensionItems,
|
|
2612
|
+
'StatusBar.handleItemsChanged': refreshExtensionItems,
|
|
2537
2613
|
'StatusBar.handleMessagePort': handleDirectMessagePort,
|
|
2538
2614
|
'StatusBar.handleNotificationCountChanged': wrapCommand(handleNotificationCountChanged),
|
|
2539
2615
|
'StatusBar.handleProblemsSummaryChange': wrapCommand(handleProblemsSummaryChange),
|
|
@@ -2548,6 +2624,7 @@ const commandMap = {
|
|
|
2548
2624
|
'StatusBar.resize': wrapCommand(resize),
|
|
2549
2625
|
'StatusBar.saveState': wrapGetter(saveState),
|
|
2550
2626
|
'StatusBar.setComponentState': setComponentState,
|
|
2627
|
+
'StatusBar.supportsEditorStatusDeltas': supportsEditorStatusDeltas,
|
|
2551
2628
|
'StatusBar.terminate': terminate
|
|
2552
2629
|
};
|
|
2553
2630
|
|
|
@@ -2555,7 +2632,7 @@ const initializeRenderWorker = async () => {
|
|
|
2555
2632
|
const rpc = await create$1({
|
|
2556
2633
|
commandMap: commandMap
|
|
2557
2634
|
});
|
|
2558
|
-
set$
|
|
2635
|
+
set$2(rpc);
|
|
2559
2636
|
};
|
|
2560
2637
|
|
|
2561
2638
|
const listen = async () => {
|