@lvce-editor/status-bar-worker 3.26.0 → 3.26.2

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.
@@ -267,7 +267,8 @@ const {
267
267
  registerCommands,
268
268
  set: set$7,
269
269
  wrapCommand,
270
- wrapGetter
270
+ wrapGetter,
271
+ wrapSerialCommand
271
272
  } = create$8();
272
273
 
273
274
  const create$7 = (uid, uri, x, y, width, height, platform, assetDir) => {
@@ -1946,13 +1947,17 @@ const getStatusBarItems = async ({
1946
1947
  return [...uiStatusBarItems.map(toStatusBarItem), ...extraItems];
1947
1948
  };
1948
1949
 
1950
+ const refreshVersions = Object.create(null);
1949
1951
  const handleExtensionsChanged = async state => {
1950
1952
  const {
1951
1953
  assetDir,
1952
1954
  errorCount,
1953
1955
  platform,
1956
+ uid,
1954
1957
  warningCount
1955
1958
  } = state;
1959
+ const refreshVersion = (refreshVersions[uid] || 0) + 1;
1960
+ refreshVersions[uid] = refreshVersion;
1956
1961
  // TODO requery status bar items
1957
1962
  const statusBarItems = await getStatusBarItems({
1958
1963
  assetDir,
@@ -1963,6 +1968,9 @@ const handleExtensionsChanged = async state => {
1963
1968
  showItems: true,
1964
1969
  warningCount
1965
1970
  });
1971
+ if (refreshVersions[uid] !== refreshVersion) {
1972
+ return state;
1973
+ }
1966
1974
  return {
1967
1975
  ...state,
1968
1976
  statusBarItemsLeft: [...statusBarItems]
@@ -2340,6 +2348,15 @@ const handleProblemsSummaryChange = (state, summary) => {
2340
2348
  };
2341
2349
  };
2342
2350
 
2351
+ const handleWorkspaceChange = async state => {
2352
+ const {
2353
+ assetDir,
2354
+ platform
2355
+ } = state;
2356
+ await invoke$3('Extensions.activateByEvent', 'onStatusBarItem', assetDir, platform);
2357
+ return state;
2358
+ };
2359
+
2343
2360
  const initialize = async () => {};
2344
2361
 
2345
2362
  const getIndex = (items, item) => {
@@ -2473,19 +2490,26 @@ const saveState = state => {
2473
2490
  };
2474
2491
 
2475
2492
  const handleDirectMessagePort = (port, setAsRendererProcess = true) => handleMessagePort(port, commandMap, setAsRendererProcess);
2493
+ const activateOnWorkspaceChange = wrapCommand(handleWorkspaceChange);
2494
+ const refreshExtensionItems = wrapSerialCommand(handleItemsChanged);
2495
+ const handleWorkspaceChangeAndRefresh = async (uid, workspacePath) => {
2496
+ await activateOnWorkspaceChange(uid, workspacePath);
2497
+ await refreshExtensionItems(uid);
2498
+ };
2476
2499
  const commandMap = {
2477
2500
  'StatusBar.create': create$7,
2478
2501
  'StatusBar.diff2': diff2,
2479
2502
  'StatusBar.getCommandIds': getCommandIds,
2480
- 'StatusBar.handleChange': wrapCommand(handleItemsChanged),
2503
+ 'StatusBar.handleChange': wrapSerialCommand(handleItemsChanged),
2481
2504
  'StatusBar.handleClick': wrapCommand(handleClick),
2482
2505
  'StatusBar.handleContextMenu': wrapCommand(handleContextMenu),
2483
2506
  'StatusBar.handleExtensionManagementMessagePort': handleExtensionManagementMessagePort,
2484
2507
  'StatusBar.handleExtensionsChanged': wrapCommand(handleExtensionsChanged),
2485
- 'StatusBar.handleItemsChanged': wrapCommand(handleItemsChanged),
2508
+ 'StatusBar.handleItemsChanged': wrapSerialCommand(handleItemsChanged),
2486
2509
  'StatusBar.handleMessagePort': handleDirectMessagePort,
2487
2510
  'StatusBar.handleNotificationCountChanged': wrapCommand(handleNotificationCountChanged),
2488
2511
  'StatusBar.handleProblemsSummaryChange': wrapCommand(handleProblemsSummaryChange),
2512
+ 'StatusBar.handleWorkspaceChange': handleWorkspaceChangeAndRefresh,
2489
2513
  'StatusBar.initialize': initialize,
2490
2514
  'StatusBar.itemLeftUpdate': wrapCommand(itemLeftUpdate),
2491
2515
  'StatusBar.itemRightCreate': wrapCommand(itemRightCreate),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/status-bar-worker",
3
- "version": "3.26.0",
3
+ "version": "3.26.2",
4
4
  "description": "Status Bar Worker",
5
5
  "repository": {
6
6
  "type": "git",