-
Notifications
You must be signed in to change notification settings - Fork 33
GLSP-1568: Refactor MenuItem API #450
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
Conversation
- Adjust context menu item provider to new `ServerMenuItem` API - Extend workflow context menu provider - Add a hidden item for testing - Add a `Readonly` mode toggle entry Part of eclipse-glsp/glsp#1586 GLSP-1587: - Add missing action handler for `SetEditModeAction` - Align base `CommandPaletteActionProvider` with java-server implementation (do not return empty for readonly by default) Fixes eclipse-glsp/glsp#1587 Requires eclipse-glsp/glsp-client#450
Adjust Theia GLSP context menu service for new MenuItem API. Ensure that isEnabled,isVisible and isToggled are properly forwarded to the Theia Menu item Part of eclipse-glsp/glsp#1586 Requires: eclipse-glsp/glsp-client#450 Requires: eclipse-glsp/glsp-server-node#116
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.
Overall everything works as expected but I'm not convinced that we should change the protocol in this way, please see my inline comments.
| */ | ||
| export interface MenuItem extends LabeledAction { | ||
|
|
||
| export type MenuItem = ClientMenuItem; |
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.
Overall, I think we should keep the name MenuItem as the central type in the protocol and not deprecate it. My reasoning is as follows:
- It does not make sense to have both
ServerMenuItemandClientMenuItemin the protocol as the protocol should only have types for the communication between server and client and therefore all types here should be serializable. - That means we should fix the
MenuItemtype to have flags but not functions forisEnabled,isVisible, and isToggled`. I know that means we are breaking the protocol API but I'd argue that it is a very small break of something that has never actually worked in the first place. Adopters who are using that interface on the client-side might have to fix their typing so it definitely needs to be stated prominently in the changelog. - I do understand that we need the
ClientMenuItemtype with the functions on the client side. Either it should be a separate type or a type that extendsMenuItemby (additionally) allowing the functions. ServerMenuItemis therefore unnecessary and should be removed completely.
What do you think?
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.
Agreed. I pushed an update.
Pleaser re-review
- Refactor `MenuItem` API - Split into `ClientMenuItem` and `ServerMenuItem` (serializable) - Deprecate original `MenuItem` - Refactor `ServerContextMenuItemProvider` to properly map `ServerMenuItem`s to the client version - Replace deprecates usage of `MenuItem` with `ClientMenuItem` Also - Fix issue in `ToolManager` that prevented proper reactivation of default tools when switching back from readonly to edit mode - Ensure that the `Delete` context menu is deactivated if the editor is readonly - Add missing i18n messages for context menu labels and sort messages.json alphabetically - Fix copy right headers and regenerate index Part of: eclipse-glsp/glsp#1586
- Adjust context menu item provider to new `ServerMenuItem` API - Extend workflow context menu provider - Add a hidden item for testing - Add a `Readonly` mode toggle entry Part of eclipse-glsp/glsp#1586 GLSP-1587: - Add missing action handler for `SetEditModeAction` - Align base `CommandPaletteActionProvider` with java-server implementation (do not return empty for readonly by default) Fixes eclipse-glsp/glsp#1587 Requires eclipse-glsp/glsp-client#450
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.
Thank you for the quick turnaround! LGTM!
* GLSP-1586: Refactor MenuItem API - Adjust context menu item provider to new `ServerMenuItem` API - Extend workflow context menu provider - Add a hidden item for testing - Add a `Readonly` mode toggle entry Part of eclipse-glsp/glsp#1586 GLSP-1587: - Add missing action handler for `SetEditModeAction` - Align base `CommandPaletteActionProvider` with java-server implementation (do not return empty for readonly by default) Fixes eclipse-glsp/glsp#1587 Requires eclipse-glsp/glsp-client#450 * Update yarn.lock
* GLSP-1586: Adjust to new MenuItem API Adjust Theia GLSP context menu service for new MenuItem API. Ensure that isEnabled,isVisible and isToggled are properly forwarded to the Theia Menu item Part of eclipse-glsp/glsp#1586 Requires: eclipse-glsp/glsp-client#450 Requires: eclipse-glsp/glsp-server-node#116 * Upgrade yarn lock
What it does
MenuItemAPIClientMenuItemandServerMenuItem(serializable)MenuItemServerContextMenuItemProviderto properly mapServerMenuItems to the client versionMenuItemwithClientMenuItemAlso
ToolManagerthat prevented proper reactivation of default tools when switching back from readonly to edit modeDeletecontext menu is deactivated if the editor is readonlyPart of: eclipse-glsp/glsp#1586
How to test
Follow-ups
Changelog