Skip to content

feat: add bidirectional request/response protocol support#480

Merged
tortmayr merged 3 commits into
masterfrom
feature/server-side-requests
Apr 24, 2026
Merged

feat: add bidirectional request/response protocol support#480
tortmayr merged 3 commits into
masterfrom
feature/server-side-requests

Conversation

@martin-fleck-at
Copy link
Copy Markdown
Contributor

What it does

Enable symmetric request/response handling between client and server. Complements the server-side changes in glsp-server-node.

  • Add optional timeout field to RequestAction
  • Update requestUntil() default to respect action.timeout
  • Stamp effective timeout onto action in requestUntil() so the receiving side can respect it
  • Use request() vs requestUntil() in handleServerRequest and handleClientRequest based on action.timeout presence
  • Fix && vs || bug in requestId emptiness checks
  • Fix RequestAction import to resolve GLSP protocol type
  • Add async handleServerRequest() in GLSPModelSource with RejectAction error handling
  • Add GetSelectionHandler for server-initiated selection queries
  • Add GetEditorContextAction / SetEditorContextAction protocol types and handler in EditorContextService

Relates to eclipse-glsp/glsp#607

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)

Enable symmetric request/response handling between client and server.
Complements the server-side changes in glsp-server-node.

- Add optional `timeout` field to `RequestAction`
- Update `requestUntil()` default to respect `action.timeout`
- Stamp effective timeout onto action in `requestUntil()` so the
  receiving side can respect it
- Use `request()` vs `requestUntil()` in `handleServerRequest` and
  `handleClientRequest` based on `action.timeout` presence
- Fix `&&` vs `||` bug in requestId emptiness checks
- Fix `RequestAction` import to resolve GLSP protocol type
- Add async `handleServerRequest()` in `GLSPModelSource` with
  `RejectAction` error handling
- Add `GetSelectionHandler` for server-initiated selection queries
- Add `GetEditorContextAction` / `SetEditorContextAction` protocol
  types and handler in `EditorContextService`

Relates to eclipse-glsp/glsp#607
Copy link
Copy Markdown
Contributor

@tortmayr tortmayr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Martin! Great new feature.
I did a first high-level review of the code and added some comments.
In addition, I quickly tested the client-server change in combination. From what I can see we don't have any regressions. Everything seems to work as expected.

Comment thread packages/client/src/features/select/get-selection-handler.ts Outdated
Comment thread packages/protocol/src/action-protocol/contexts.ts Outdated
Comment thread packages/protocol/src/action-protocol/contexts.ts Outdated
Comment thread packages/client/src/features/select/select-module.ts Outdated
Comment thread packages/client/src/base/model/glsp-model-source.ts Outdated
Comment thread packages/client/src/base/model/glsp-model-source.ts
- Rename SetEditorContextAction to EditorContextResult
- Extend EditorContext with optional viewport and canvasBounds
- Use EditorContext property in response instead of flat fields
- Move GetSelectionHandler into SelectionService
- Extract sendResponseToServer() hook in GLSPModelSource
- Use IActionDispatcher instead of GLSPActionDispatcher in declare
@martin-fleck-at
Copy link
Copy Markdown
Contributor Author

@tortmayr Thank you! I updated the PR accordingly!

Comment thread packages/client/src/features/select/select-module.ts Outdated
@tortmayr tortmayr self-requested a review April 24, 2026 15:45
Copy link
Copy Markdown
Contributor

@tortmayr tortmayr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, all review points are adressed.
The compatibility build with the server PR also succeeded:
https://github.com/eclipse-glsp/glsp-client/actions/runs/24898345067

LGTM! 👍🏼

@tortmayr tortmayr merged commit aa1cf84 into master Apr 24, 2026
6 checks passed
@tortmayr tortmayr deleted the feature/server-side-requests branch April 24, 2026 15:54
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.

2 participants