eclipse-sprotty / sprotty-server

Server implementation for the Sprotty diagramming framework
https://eclipse.org/sprotty
Eclipse Public License 2.0
23 stars 19 forks source link

[selection] avoid bad selection cycles #73

Closed JanKoehnlein closed 4 years ago

JanKoehnlein commented 4 years ago

The DiagramLanguageServer reacts to changes of the cursor position in the text document via DocumentHighlight requests with changing the selection of the diagram. The algorithm to detect the SModel element tries to find the childmost element whose trace contains the position. The selection of this SModel element then fires back to the editor via a OpenInTextEditor request.

The latter is a problem as it moves the cursor, in particular when the element under the cursor doesn't have a traced SModel element.

We should make sure the selection from the DocumentHighlight is not returned to the client. We could do that by setting the receivedFromServerProperty to true on the respective actions, such that they are not forwarded to the client again. This property is currently missing from the Xtend impls of the Action classes.

JanKoehnlein commented 4 years ago

Real problem was that the selection from the DiagramHighlightService was handled immediately locally by the DiagramSelectionListener. Added a flag to prevent that