You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In GLSP we use an extended version of sprotty's ActionDispatcher that adds some additional API methods.
These API methods are not reflected in the default IActionDispatcher interface. As a consequence we often use the implementation type (GLSPActionDispatcher) directly when injecting. In the end we end up with different variants of injecting the action dispatcher:
// When we only use API methods from the default sprotty dispacher we often use:
@inject(TYPES.IActionDispatcher)protected actionDispatcher: IActionDispatcher// When we need the extended API we either use
@inject(TYPES.IActionDispatcherprotectedactionDispatcher: GLSPActionDispatcher// or
@inject(GLSPActionDispatcher)protectedactionDispatcher: GLSPActionDispatcher
In the end this is quite confusing and we end up with a weird mix of injecting either the implementation class directly, or injection the generic TYPE identifier and then set the type itself to the implementation class. In any case we have the implicit assumption here that the TYPES.IActionDispatcher class is always an instance of GLSPActionDispatcher.
While this assumption is very reasonable we should make it explicit. With @eclipse-glsp/sprotty package we have the possibility to directly add the additional API to the IActionDispatcher interface and can then consistently use the IActionDispatcher type for injecting.
In addition, this should also avoid potential breakages if an adopter binds a custom IActionDispatcher that is not derived from the GLSPActionDispatcher.
The text was updated successfully, but these errors were encountered:
- Rename `action-override` module of @eclipse-glsp/sprotty to `api-override` which a better fit.
- Add additional API methods of the `GLSPActionDispatcher` directly to the `IActionDispatcher` interface and update related code for consistent usage of the interface. Export new `IActionDispatcher` interface via api-override
- Also add API override for `IVNodePostProcessor`
Also:
- Adjust directs imports of `matchesKeystroke` and `toArray` from sprotty. Import from @eclipse/glsp-sprotty instead
Fixeseclipse-glsp/glsp#1416
In GLSP we use an extended version of sprotty's
ActionDispatcher
that adds some additional API methods.These API methods are not reflected in the default
IActionDispatcher
interface. As a consequence we often use the implementation type (GLSPActionDispatcher
) directly when injecting. In the end we end up with different variants of injecting the action dispatcher:In the end this is quite confusing and we end up with a weird mix of injecting either the implementation class directly, or injection the generic TYPE identifier and then set the type itself to the implementation class. In any case we have the implicit assumption here that the TYPES.IActionDispatcher class is always an instance of
GLSPActionDispatcher
.While this assumption is very reasonable we should make it explicit. With
@eclipse-glsp/sprotty
package we have the possibility to directly add the additional API to theIActionDispatcher
interface and can then consistently use the IActionDispatcher type for injecting.In addition, this should also avoid potential breakages if an adopter binds a custom IActionDispatcher that is not derived from the GLSPActionDispatcher.
The text was updated successfully, but these errors were encountered: