Server side notifications #1533
-
Hi guys, I'm trying to find a way to send server side notification for 'model changed' and be able to show the @SourceModelChangedAction@ on all clients that displays diagrams loaded from the same file/URI. Problem is even if the @sourceModelChanged@ action is sent to all concerning clients the notification is ignored if the client diagram isn't visible (the current editor in VSCode is the one that saved the model triggering the notification for other clients). As the use case I'm trying to implement something like 'diagram partitioning', this works fine on the server-side with an @SourceModelStorage@ implementation and custom @SourceModelWatcher@ but the final result isn't quite what I was trying to achieve :( Any idea how something like this could be solved? Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
So far I've solved that in the editor provider with a hook on the @WebviewPanel@ @onDidChangeViewState@ - when not visible the @SourceModelChangedAction@ is postponed till visible again, will just dispatch that again on the @GlspVscodeConnector@ and the default action handler will show the notification. There might be an easier way though, so I'm open to any ideas :) |
Beta Was this translation helpful? Give feedback.
@akera-io I just double checked the code and as I expected, we do not really prevent the views from receiving and processing any message but it is much rather a setting in the VS Code Messenger API: The VSCode Messenger has an option called
ignoreHiddenViews
that is set to true by default. This stops the diagram client from receiving any action messages whenever the webview is considered hidden, for example if you have it as one of your tabs but it is not the editor in focus. Currently, ourGlspVscodeConnector
simply creates a messenger without allowing you to pass any options1. There is already an open issue in GLSP 2 to make that more customizable but you should be able still override i…