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

refactor: reduce tree specific complexity in commands.py #8077

Open
toofar opened this issue Jan 19, 2024 · 0 comments
Open

refactor: reduce tree specific complexity in commands.py #8077

toofar opened this issue Jan 19, 2024 · 0 comments
Labels
component: tree tabs Issues related to tree tabs functionality

Comments

@toofar
Copy link
Member

toofar commented Jan 19, 2024

Several commands related to manipulating tabs now have duplicate logic paths that have to be maintained. For contributors who want to change, or add, commands it would be great if they didn't have to think about tree traversal. It would be great if we could push logic down into the tabbed browser or even the notree data structure.

There are some places where this might not be possible, or some places where we think there is existing non-tree related code that should get the same treatment.

Some ideas:

  • for places where we are handling new commands or arguments (like --sibling) this isn't so bad because it isn't a new logic path just to handle tabs, but even then there might be stuff that we could move out to reduce the line noise.
  • for recursive operations could we teach the tree structure to take care of them somehow? We may also have to teach the tree about tab type nodes in this case so it can apply actions to them when closed, moved, hidden, whatever (that might even be able to be handled by connected to node signals when adding tabs)
  • treating collapsed tabs and hidden nodes specially is a recurring theme that seems error prone. We might want to look at calling code and see if we can teach the tree to take care of all that somehow
  • it might not help move things out of the file but it may help to reduce the line count to experiment with the visitor pattern. A lot of cases where the tree is traversed it's only with the intention of taking an action for each node, have a common pattern to take care of more traversal details could help reduce the line count and introduce some more consistency to tree traveral
@toofar toofar added the component: tree tabs Issues related to tree tabs functionality label Jan 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: tree tabs Issues related to tree tabs functionality
Projects
Status: Backlog
Development

No branches or pull requests

1 participant