-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#472 Refactor action defintion to interfaces #171
Conversation
7d05103
to
2e6ac2d
Compare
Sprotty moved away from class based approach for action definiton and solely relies on interfaces now. To be able to update to the latest sprotty version GLSP needs to to do the same. Otherwise action definitions might clash and there will be an inconsistent mix of class and interface definitions. This PR refactors the action definitions in the base protocol & the glsp client to interfaces. Action definitions that are reused from sprotty are marked with `extends sprotty.XYZAction`. In addition, to the pure interface definition for each action/operation type a namespace is provided that offers utility functions for type checking and creating new instances. - Refactor all action definitions to interfaces+namespaces - Refactor all action constructions calls to use the new `Action.create() `approach instead of the old `new Action()` approach - Add tests for the action utility function (is, create etc.) of all protocol actions. - Replace all old typeguard functions like `isComputedBoundsAction` with their new namespace counterpart (SetBoundsAction.is) - Add `isOperation`:true boolean property to the operation interface. This serves as discriminator to make actions & operations distinguishable on a type level. - Update to latest sprotty version - Update to latest glsp-config package to make use of the new no-deprecated eslint rules. - Add package specific eslint warnings for restricted/discourages imports. Also: - Disable hover-popup listener when the Ede creation tool is active - Update changelog Contributed on behalf of STMicroelectronics
2e6ac2d
to
92ea478
Compare
#472 - Consume the new glsp-client and sprotty version and update the code base to comply to the new action definitions - Update linking script - Update to latest glsp-config package to make use of the new no-deprecated eslint rules. - Add package specific eslint warnings for restricted/discourages imports. #559 - Consume new @eclipse-glsp/config version and update to typescript 4.5.5. - Adapt code to conform to new "strict" mode and "noImplicitOverride" - Cleanup dev dependencies and move common dependencies into package root Part of eclipse-glsp/glsp/issues/472 Part of eclipse-glsp/glsp/issues/559 Requires eclipse-glsp/glsp-client#171 Contributed on behalf of STMicroelectronics
#472 - Consume the new glsp-protocol version and update the code base to comply to the new action definitions #559 - Consume new @eclipse-glsp/config version and update to typescript 4.5.5. - Adapt code to conform to new "strict" mode and "noImplicitOverride" - Cleanup dev dependencies and move common dependencies into package root Part of eclipse-glsp/glsp/issues/472 Part of eclipse-glsp/glsp/issues/559 Requires eclipse-glsp/glsp-client#171 Contributed on behalf of STMicroelectronics
#472 - Consume the new glsp-protocol version and update the code base to comply to the new action definitions #559 - Consume new @eclipse-glsp/config version and update to typescript 4.5.5. - Adapt code to conform to new "strict" mode and "noImplicitOverride" - Cleanup dev dependencies and move common dependencies into package root #492 Update workflow builders to provide the same improved styled components as the Java GLSP server Part of eclipse-glsp/glsp/issues/472 Part of eclipse-glsp/glsp/issues/559 Part of eclipse-glsp/glsp/issues/492 Requires eclipse-glsp/glsp-client#171 Contributed on behalf of STMicroelectronics
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent work! Thank you very much for this comprehensive change!
Great that you also added lots of typedoc and unit tests! 💯
I made a couple of edit suggestions and comments about the typedocs. While most of them are great, there are several which imho don't really add information. I tend to prefer omitting those, because they add noise without helping.
I tested with eclipse-glsp/glsp-theia-integration#110 and observed a few regressions:
- Task editing doesn't work: after selecting type or duration, the input disappears
- Validation throws an error (
Missing handler for action { kind: 'applyMarkers',...
) - Resize and move restrictors for overlaps don't work... I'm not sure though if this is a regression or didn't work in the first place
- Open push command (in Theia) doesn't select the correct element (could be unrelated too)
Is there a particular reason why we really copy and not import and re-export all Sprotty actions? I think there was a reason, but I can't remember right now. Now reviewing the code it feels like a lot of maintenance overhead with the risk of getting out of sync?
Again, excellent work on this huge change! Thanks for your persistence!
packages/protocol/src/action-protocol/__tests__/element-text-editing.spec.ts
Outdated
Show resolved
Hide resolved
Thank you for your fast review. I'm going to address the feedback right away.
This problem seems to be already present on the current master
This is related to eclipse-glsp/glsp/issues/394. Currently the movement restrictor is not enabled for the workflow example.
I assume you are referring to the actions in the protocol package?
Since we extend from the sprotty interfaces I don't see any risks of getting out of sync. This ensure that we are always compliant to the sprotty definition. I would even argue that is is a better approach in terms of API stability. With a simple reexport we would pick up breaking changes much later (if at all). |
Ah, right, now I see. Thanks! |
- Remove comments that add no additional value - Merge TYPES & GLSP_TYPES service identifier definitions and reexport them in @eclipse-glsp/client. The "old" GLSP_TYPES namespace has been deprecated but is still available to ease the migration pain for (early) adopters. - Adapt base-protocol.spec test case names. After reviewer aprroval the same naming pattern will be applied to all other test cases. - Fix command definition for `ApplyMarkersCommand` - Fix incorrect `LabeledAction.is` method - Fix duplicate and autogenerated names in example1.wf
99ec84a
to
5423dc0
Compare
I have pushed an update that should address all the raised issues.
Should be fixed now. Was related to a incorrect implementation of
Fixed. Was related to an incorrect
As mentioned before, movement restrictors for the Workflow example are currently disabled.
Fixed. It seems like we introduced duplicate names when changing the Workflow example styling. I updated all example1.wf files. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent, thanks a lot!
I did a few inline suggestions that you should be able to directly apply, mostly to typedoc.
So the only thing left is imho to adjust the text in the other tests. But I already approve for you to spare another review cycle.
Thanks again for your persistence with this large and important change! Now we are consistent and up to date with Sprotty again, and it is simpler for adopters when it comes to importing classes and registering DI implementations! 💯
examples/workflow-glsp/src/direct-task-editing/direct-task-editor.ts
Outdated
Show resolved
Hide resolved
@planger Thank you for the detailled review. I have updated the JS-DOC according to your suggestions and applied the new naming scheme to all test cases. So now we should be ready to merge |
#472 - Consume the new glsp-protocol version and update the code base to comply to the new action definitions #559 - Consume new @eclipse-glsp/config version and update to typescript 4.5.5. - Adapt code to conform to new "strict" mode and "noImplicitOverride" - Cleanup dev dependencies and move common dependencies into package root #492 Update workflow builders to provide the same improved styled components as the Java GLSP server Part of eclipse-glsp/glsp/issues/472 Part of eclipse-glsp/glsp/issues/559 Part of eclipse-glsp/glsp/issues/492 Requires eclipse-glsp/glsp-client#171 Contributed on behalf of STMicroelectronics
Consume new client version & update TS #472 - Consume the new glsp-client and sprotty version and update the code base to comply to the new action definitions - Update linking script - Update to latest glsp-config package to make use of the new no-deprecated eslint rules. - Add package specific eslint warnings for restricted/discourages imports. #559 - Consume new @eclipse-glsp/config version and update to typescript 4.5.5. - Adapt code to conform to new "strict" mode and "noImplicitOverride" - Cleanup dev dependencies and move common dependencies into package root Part of eclipse-glsp/glsp/issues/472 Part of eclipse-glsp/glsp/issues/559 Requires eclipse-glsp/glsp-client#171 Contributed on behalf of STMicroelectronics
#472 - Consume the new glsp-protocol version and update the code base to comply to the new action definitions #559 - Consume new @eclipse-glsp/config version and update to typescript 4.5.5. - Adapt code to conform to new "strict" mode and "noImplicitOverride" - Cleanup dev dependencies and move common dependencies into package root #492 Update workflow builders to provide the same improved styled components as the Java GLSP server Part of eclipse-glsp/glsp/issues/472 Part of eclipse-glsp/glsp/issues/559 Part of eclipse-glsp/glsp/issues/492 Requires eclipse-glsp/glsp-client#171 Contributed on behalf of STMicroelectronics
#472 - Consume the new glsp-protocol version and update the code base to comply to the new action definitions #559 - Consume new @eclipse-glsp/config version and update to typescript 4.5.5. - Adapt code to conform to new "strict" mode and "noImplicitOverride" - Cleanup dev dependencies and move common dependencies into package root #492 Update workflow builders to provide the same improved styled components as the Java GLSP server Part of eclipse-glsp/glsp/issues/472 Part of eclipse-glsp/glsp/issues/559 Part of eclipse-glsp/glsp/issues/492 Requires eclipse-glsp/glsp-client#171 Contributed on behalf of STMicroelectronics
#472 - Consume the new glsp-protocol version and update the code base to comply to the new action definitions #559 - Consume new @eclipse-glsp/config version and update to typescript 4.5.5. - Adapt code to conform to new "strict" mode and "noImplicitOverride" - Cleanup dev dependencies and move common dependencies into package root #492 Update workflow builders to provide the same improved styled components as the Java GLSP server Part of eclipse-glsp/glsp/issues/472 Part of eclipse-glsp/glsp/issues/559 Part of eclipse-glsp/glsp/issues/492 Requires eclipse-glsp/glsp-client#171 Contributed on behalf of STMicroelectronics
Sprotty moved away from class based approach for action definition and solely relies on interfaces now.
To be able to update to the latest sprotty version GLSP needs to to do the same. Otherwise action definitions might clash
and there will be an inconsistent mix of class and interface definitions.
This PR refactors the action definitions in the base protocol & the glsp client to interfaces. Action definitions that are reused from sprotty are marked
with
extends sprotty.XYZAction
. In addition, to the pure interface definition for each action/operation type a namespace is provided that offers utility functions for type checking and creating new instances.Action.create()
approach instead of the oldnew Action()
approachisComputedBoundsAction
with their new namespace counterpart (SetBoundsAction.is)isOperation
:true boolean property to the operation interface. This serves as discriminator to make actions & operations distinguishable on atype level.
Also:
Contributed on behalf of STMicroelectronics