Skip to content

Conversation

@tortmayr
Copy link
Contributor

@tortmayr tortmayr commented Oct 7, 2025

What it does

  • Refactor MenuItem API
    • Split into ClientMenuItem and ServerMenuItem (serializable)
    • Deprecate original MenuItem
    • Refactor ServerContextMenuItemProvider to properly map ServerMenuItems 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

How to test

Follow-ups

Changelog

  • This PR should be mentioned in the changelog
  • This PR introduces a breaking change (if yes, provide more details below for the changelog and the migration guide)

tortmayr added a commit to eclipse-glsp/glsp-server-node that referenced this pull request Oct 7, 2025
- 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
tortmayr added a commit to eclipse-glsp/glsp-theia-integration that referenced this pull request Oct 7, 2025
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
Copy link
Contributor

@martin-fleck-at martin-fleck-at left a 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;
Copy link
Contributor

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 ServerMenuItem and ClientMenuItem in 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 MenuItem type to have flags but not functions for isEnabled, 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 ClientMenuItem type with the functions on the client side. Either it should be a separate type or a type that extends MenuItem by (additionally) allowing the functions.
  • ServerMenuItem is therefore unnecessary and should be removed completely.

What do you think?

Copy link
Contributor Author

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
tortmayr added a commit to eclipse-glsp/glsp-server-node that referenced this pull request Oct 8, 2025
- 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
Copy link
Contributor

@martin-fleck-at martin-fleck-at left a 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!

@tortmayr tortmayr merged commit eb23ff3 into master Oct 8, 2025
6 checks passed
@tortmayr tortmayr deleted the glsp-1586 branch October 8, 2025 15:35
tortmayr added a commit to eclipse-glsp/glsp-server-node that referenced this pull request Oct 9, 2025
* 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
tortmayr added a commit to eclipse-glsp/glsp-theia-integration that referenced this pull request Oct 10, 2025
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants