@lvce-editor/status-bar-worker 2.3.0 → 2.4.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.
@@ -1245,23 +1245,28 @@ const diff2 = uid => {
1245
1245
  return result;
1246
1246
  };
1247
1247
 
1248
- const getMatchingItem = (itemsLeft, itemsRight, name) => {
1249
- for (const item of itemsLeft) {
1250
- if (item.name === name) {
1251
- return item;
1252
- }
1253
- }
1254
- for (const item of itemsRight) {
1248
+ const getMatchingItemInternal = (items, name) => {
1249
+ for (const item of items) {
1255
1250
  if (item.name === name) {
1256
1251
  return item;
1257
1252
  }
1258
1253
  }
1259
1254
  return undefined;
1260
1255
  };
1256
+ const getMatchingItem = (itemsLeft, itemsRight, name) => {
1257
+ return getMatchingItemInternal(itemsLeft, name) ?? getMatchingItemInternal(itemsRight, name);
1258
+ };
1261
1259
 
1262
1260
  const handleClickExtensionStatusBarItem = async name => {
1263
- // @ts-ignore
1264
- await invoke$1(`ExtensionHostStatusBar.executeCommand`, name);
1261
+ // TODO maybe relay this to extension management worker,
1262
+ // and it forwards it to the right extension host?
1263
+
1264
+ try {
1265
+ // @ts-ignore
1266
+ await invoke$1(`ExtensionHostStatusBar.executeCommand`, name);
1267
+ } catch (error) {
1268
+ console.error(new VError(error, `Failed to execute status bar command: ${name}`));
1269
+ }
1265
1270
  };
1266
1271
 
1267
1272
  const handleClickNotification = async () => {
@@ -1516,6 +1521,10 @@ const handleExtensionsChanged = async state => {
1516
1521
  };
1517
1522
  };
1518
1523
 
1524
+ const handleItemsChanged = async state => {
1525
+ return handleExtensionsChanged(state);
1526
+ };
1527
+
1519
1528
  const id = 7201;
1520
1529
  const sendMessagePortToExtensionHostWorker = async port => {
1521
1530
  await sendMessagePortToExtensionHostWorker$1(port, id);
@@ -2102,9 +2111,11 @@ const commandMap = {
2102
2111
  'StatusBar.create': create,
2103
2112
  'StatusBar.diff2': diff2,
2104
2113
  'StatusBar.getCommandIds': getCommandIds,
2114
+ 'StatusBar.handleChange': wrapCommand(handleItemsChanged),
2105
2115
  'StatusBar.handleClick': wrapCommand(handleClick),
2106
2116
  'StatusBar.handleContextMenu': wrapCommand(handleContextMenu),
2107
2117
  'StatusBar.handleExtensionsChanged': wrapCommand(handleExtensionsChanged),
2118
+ 'StatusBar.handleItemsChanged': wrapCommand(handleItemsChanged),
2108
2119
  'StatusBar.initialize': initialize,
2109
2120
  'StatusBar.itemLeftUpdate': wrapCommand(itemLeftUpdate),
2110
2121
  'StatusBar.itemRightCreate': wrapCommand(itemRightCreate),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/status-bar-worker",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "description": "Status Bar Worker",
5
5
  "repository": {
6
6
  "type": "git",