@lvce-editor/problems-view 1.31.3 → 1.33.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.
@@ -2599,12 +2599,24 @@ const set = rpc => {
2599
2599
  state.connected = true;
2600
2600
  };
2601
2601
 
2602
- const handleMessagePort = async port => {
2602
+ const handleMessagePort = async (port, viewletCommandMap, setAsRendererProcess = true) => {
2603
+ const executeViewletCommand = async (uid, command, ...args) => {
2604
+ const fn = viewletCommandMap[`Problems.${command}`];
2605
+ if (typeof fn !== 'function') {
2606
+ throw new TypeError(`Viewlet command not found: ${command}`);
2607
+ }
2608
+ await fn(uid, ...args);
2609
+ await invoke$1('Viewlet.requestRender', uid);
2610
+ };
2603
2611
  const rpc = await create$5({
2604
- commandMap: {},
2612
+ commandMap: {
2613
+ 'Viewlet.executeViewletCommand': executeViewletCommand
2614
+ },
2605
2615
  messagePort: port
2606
2616
  });
2607
- set(rpc);
2617
+ if (setAsRendererProcess) {
2618
+ set(rpc);
2619
+ }
2608
2620
  };
2609
2621
 
2610
2622
  const getIcon = (uri, fileIconCache) => {
@@ -3776,6 +3788,7 @@ const toggleShowWarnings = state => {
3776
3788
  };
3777
3789
  };
3778
3790
 
3791
+ const handleDirectMessagePort = (port, setAsRendererProcess = true) => handleMessagePort(port, commandMap, setAsRendererProcess);
3779
3792
  const commandMap = {
3780
3793
  'Problems.collapseAll': wrapCommand(collapseAll$1),
3781
3794
  'Problems.copyMessage': wrapCommand(copyMessage),
@@ -3798,7 +3811,7 @@ const commandMap = {
3798
3811
  'Problems.handleDiagnosticsChange': wrapCommand(handleDiagnosticsChange),
3799
3812
  'Problems.handleFilterInput': wrapCommand(handleFilterInput),
3800
3813
  'Problems.handleIconThemeChange': wrapCommand(handleIconThemeChange),
3801
- 'Problems.handleMessagePort': handleMessagePort,
3814
+ 'Problems.handleMessagePort': handleDirectMessagePort,
3802
3815
  'Problems.handleScrollBarCaptureLost': wrapCommand(handleScrollBarCaptureLost),
3803
3816
  'Problems.handleScrollBarClick': wrapCommand(handleScrollBarClick),
3804
3817
  'Problems.handleScrollBarMove': wrapCommand(handleScrollBarMove),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/problems-view",
3
- "version": "1.31.3",
3
+ "version": "1.33.0",
4
4
  "description": "Problems View Worker",
5
5
  "repository": {
6
6
  "type": "git",