Skip to content
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

Added support for multiple handlers #7

Merged
merged 1 commit into from
Dec 1, 2022
Merged

Added support for multiple handlers #7

merged 1 commit into from
Dec 1, 2022

Conversation

spoenemann
Copy link
Member

In some cases it is necessary to register multiple handlers for the same message type in the VS Code extension (not in the webview). The change includes the following:

  • Store an array of message handlers for each message type.
  • Add a parameter to filter by sender, for example to register a handler only for a specific webview instance.
  • Return a Disposable that can be used to remove a message handler when it's no longer needed.
  • Webview registration returns information on the message participant (webview id) that can be used for filtering)
  • Requests can be handled only if there is exactly one message handler for which the configured sender matches the incoming message.

@spoenemann spoenemann requested a review from dhuebner November 30, 2022 14:42
Copy link
Member

@dhuebner dhuebner left a comment

Choose a reason for hiding this comment

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

Looks really good. A possibility to register handlers for a special sender makes the library more flexible.

LGTM!

@dhuebner dhuebner merged commit d1c76db into main Dec 1, 2022
@spoenemann spoenemann deleted the sprotty-vscode branch December 1, 2022 13:18
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