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

Plugin support for hover #393

Merged
merged 11 commits into from
Jul 21, 2022
Merged

Plugin support for hover #393

merged 11 commits into from
Jul 21, 2022

Conversation

TwitchBronBron
Copy link
Member

@TwitchBronBron TwitchBronBron commented Apr 20, 2021

Moves the getHover functionality into the plugin API so plugins can participate in providing hover support.

Notable changes:

  • add new beforeProvideHover, provideHover, afterProvideHover plugin events.
  • Plugins can push 0 or more Hovers to the event.hovers collection.
  • All hovers are deduped, and then merged into a single markdown string each separated by a single newline. This allows multiple plugins to provide hovers for a given position. If plugins don't want to step on each other, they can first check that the event.hovers is empty.
  • modify the plugin event pipleline to short-circuit if the handler returns false. This is useful for onGetHover because only a single plugin may contribute a hover, so the first one that contributes needs to indicate they did so.
  • move BrsFile getHover functionality into the BscPlugin. I didn't change the core logic, I just copied the code and made it work within the new object.

src/PluginInterface.ts Outdated Show resolved Hide resolved
src/interfaces.ts Outdated Show resolved Hide resolved
@TwitchBronBron TwitchBronBron merged commit 9c26575 into master Jul 21, 2022
@TwitchBronBron TwitchBronBron deleted the plugin-hover branch July 21, 2022 12:57
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.

5 participants