glsp icon indicating copy to clipboard operation
glsp copied to clipboard

Tool activated CSS modifications are lost after model update

Open paulreuter opened this issue 2 years ago • 3 comments

Tools that add CSS classes for visual feedback ( such as element-deletion-mode, or edge-creation-mode ) do so when enabled.

On model change, those CSS classes are lost but the tool may stay enabled (deletion mode, holding CTRL when connecting edges, custom mode changes).

The tool then needs to be disabled and reenabled to restore visual feedback.

paulreuter avatar Oct 11 '23 12:10 paulreuter

@paulreuter Thank you very much for raising this bug! And sorry for the delayed response. The issue was added to the wrong board and didn't show up our project board that we use for planning.

We've prioritized this issue and it's now at the top of our backlog. We'll perform an initial analysis in the coming weeks.

If you have any further updates or information, please add them to this issue. And, if you're interested in working on the fix yourself, we're happy to support whereever needed. Your help would be much appreciated!

planger avatar Jan 25 '24 11:01 planger

@planger I finally got around to investigating a bit closer.

In my own tools, there are multiple sets of orthogonal modes that are applied across multiple calls of dispatchFeedback, similar to the CursorCSS set. I did not realize that only the most recent call to dispatchFeedback is stored in the IFeedbackActionDispatcher and replayed on model update, which always ended up as the RemoveFeedbackEdgeAction from the tools reinitialize call.

I solved this by maintaining two lists of CSS classes to be added / removed in the tool and overrode the dispatchFeedback method to append an additional ModifyCSSFeedbackAction to the super call. Since this issue is something every tool that needs CSS feedback needs to tackle, perhaps it makes sense to put this functionality into the base class? If so, I can contribute that. Otherwise this issue can be closed.

paulreuter avatar Feb 12 '24 01:02 paulreuter

@paulreuter Thank you very much for the analysis! Yes please, if you think it makes sense to put generic behavior into the base framework, please feel free to open a PR. If possible, please make sure to avoid impacting any existing API. Thank you!

planger avatar Feb 12 '24 07:02 planger

Feedback dispatching as been reworked with https://github.com/eclipse-glsp/glsp-client/pull/342. I think this issue can be closed now.

tortmayr avatar May 16 '24 08:05 tortmayr