-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
enh(parser) post-highlightBlock callbacks via plugin #2285
Conversation
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.
I haven't yet tried it, just had a look, but generally I like it. See a couple of comments in code.
@egor-rogov How you feeling about this in general? Can I polish it up for merging? (which requires building out the class functionality, writing some tests, better docs.) I'll ping you again for a final review, but I wanted to make sure you're cool with the naming before I put more effort into this. |
Definitely yes. |
Don't we resolve that by just saying "always use the event names", as suggested above: class DataLanguagePlugin {
constructor(options) {
this.prefix = options.dataPrefix;
}
'after:highlightBlock'({block, result}) {
// ...
}
} |
We do. |
I want to review the tests here and perhaps add a few more but is this otherwise good to merge? |
@egor-rogov Ping? |
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.
Sorry for delay.
I like it!
First pass at simple plugin API to allow things like:
I realize I need to document the plugin API itself and the callbacks, but how does this look at a high level? We'd also support classes for more complex plugins:
Passing a class being the preferred way for more complex things, and the object based approach serves for one-liners to make them easy to whip up.