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

Create base TreeMessage for tree messages? #2487

Closed
rodrigogiraoserrao opened this issue May 4, 2023 · 8 comments
Closed

Create base TreeMessage for tree messages? #2487

rodrigogiraoserrao opened this issue May 4, 2023 · 8 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request Task

Comments

@rodrigogiraoserrao
Copy link
Contributor

OptionList has a OptionMessage that is inherited by the two OptionList messages.
Is it worth doing the same for the tree messages? There are 4 messages whose code is exactly the same, the only thing that changes is the name of the class.

@rodrigogiraoserrao rodrigogiraoserrao added enhancement New feature or request question Further information is requested labels May 4, 2023
@davep
Copy link
Contributor

davep commented May 4, 2023

IIRC I made that change once but it got reversed. Might be worth looking back through history.

I think the objection was to do with impact on documentation, so perhaps we're in a better place now.

(To be clear, I'm massively pro common parent class)

@rodrigogiraoserrao
Copy link
Contributor Author

IIRC I made that change once but it got reversed. Might be worth looking back through history.

You are right, and I was the one who removed the base class 😆 f34685b

I think the objection was to do with impact on documentation, so perhaps we're in a better place now.

I see the point. It isn't super obvious what attributes the OptionList messages have.
Maybe if we add a sentence in the docstrings for those messages to check the base class, then we can inherit from those messages and we can, once more, have a TreeMessage base class.

Thoughts, @willmcgugan?

Untitled

@rodrigogiraoserrao
Copy link
Contributor Author

(If we decide against a TreeMessage, we should probably split OptionMessage too.)

@willmcgugan
Copy link
Collaborator

I think with @davep 's change to the @on decorator it makes sense to have common base classes.

The docs issue is annoying.

@rodrigogiraoserrao
Copy link
Contributor Author

The docs issue is annoying.

Not being super clear what attributes the messages have?

@rodrigogiraoserrao rodrigogiraoserrao added documentation Improvements or additions to documentation Task and removed question Further information is requested labels May 31, 2023
@willmcgugan
Copy link
Collaborator

Exactly. The indirection means that some people will miss the attributes in the base class.

@willmcgugan
Copy link
Collaborator

It probably does make some sense to have a common base class. But it doesn't seem all that useful: I can't see a reason why you would want to respond to multiple tree events in a single handler.

Closing this, because it just doesn't seem worth changing, unless we have an identiable need for it.

Copy link

Don't forget to star the repository!

Follow @textualizeio for Textual updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request Task
Projects
None yet
Development

No branches or pull requests

3 participants