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

Extendibility of elements #1258

Open
dvdking opened this issue Jul 18, 2023 · 0 comments
Open

Extendibility of elements #1258

dvdking opened this issue Jul 18, 2023 · 0 comments

Comments

@dvdking
Copy link

dvdking commented Jul 18, 2023

The problem is modifying internal behaviour of an element without writing a completely new one.

Let's take as an example SelectionPrompt. I wanted to add additional input handling to handle numbers from input as a selection index. Right now, there is no way to do that, as the class itself is sealed, and all inner classes are internal, so I cannot even create a simple copy of the class but need to copypaste the whole hierarchy of internal dependencies or create my own from ground up or not use nuget package and have copy of lib code.
Other places also might benefit from extendibility, for example customization of rendering.

Possible solution is to avoid sealed internal classes and non-virtual methods without possibility to override their behaviour.
Alternatively leave classes sealed but all internals could be made public to create custom classes.
And the third, the safest, option is to add hooks to the main functionality of elements. Like it is done with SelectionPrompt.Converter.


Please upvote 👍 this issue if you are interested in it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo 🕑
Development

No branches or pull requests

1 participant