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

Overriding a HtmlRenderer extension function: cannot call super #2435

Open
glureau opened this issue Apr 13, 2022 · 0 comments
Open

Overriding a HtmlRenderer extension function: cannot call super #2435

glureau opened this issue Apr 13, 2022 · 0 comments
Labels
enhancement An issue for a feature or an overall improvement plugin-api Everything related to Dokka's plugin API

Comments

@glureau
Copy link
Contributor

glureau commented Apr 13, 2022

Is your feature request related to a problem? Please describe

Because Kotlin cannot call the super extension function, it's not possible to override a method from a HtmlRenderer (for example). In this case, either you need to copy/paste (like here) or you need to delegates. Problem with delegates is that you have to use it on the interface and HtmlRenderer and DefaultRenderer are classes, so you cannot use Kotlin delegation on them. Only option remaining is to extends DefaultRenderer, implements the X methods, and delegates manually to a HtmlRenderer... (making it hard to change a bit the rendering)

Describe the solution you'd like

Avoiding extension function for open/abstract methods could be a solution. Fixing KT-11488 could be a cleaner solution.

(For my requirement, an alternative could be to have a way to override code blocks based on language.)

Describe alternatives you've considered

Only viable alternative for me is to duplicate the code from HtmlRenderer, and maintain the copy up-to-date.

Are you willing to provide a PR?

Yes I could, but do we really want to replace extension functions by standard functions? (I mean, code is nice and clean right now...)

@glureau glureau added the enhancement An issue for a feature or an overall improvement label Apr 13, 2022
@IgnatBeresnev IgnatBeresnev added the plugin-api Everything related to Dokka's plugin API label Dec 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An issue for a feature or an overall improvement plugin-api Everything related to Dokka's plugin API
Projects
None yet
Development

No branches or pull requests

2 participants