barbar.nvim icon indicating copy to clipboard operation
barbar.nvim copied to clipboard

Untangling Dependency Cycles

Open Iron-E opened this issue 2 years ago • 1 comments

As noted in #270, it seems like we have a dependency cycle (note the double-ended arrows):

dep cycle

The best way I can think to fix this is the following:

  • Move bufferline.render(), bufferline.update(), bufferline.update_async() to bufferline.render.
  • Move all methods in bufferline.state requiring a bufferline.update() to bufferline.render
    • Alternatively: remove calls to bufferline.update() from bufferline.state, and add methods which wrap around them and call bufferline.update() to bufferline.render
  • Move bufferline.jump_mode.activate() to bufferline.render.activate_jump_mode() (bikeshedding on the name is welcome)

That would make the dependency tree look like the following:

no cycle

  • bufferline.jump_mode is now like bufferline.state but for :BufferPick— it holds data but doesn't render.
  • bufferline.render now controls all code for rendering and updating &tabline
  • bufferline.state holds information about state, but now never renders

What are your thoughts?

Iron-E avatar Jul 31 '22 22:07 Iron-E

Graph looks nice :) let's do it when we have time.

romgrk avatar Aug 01 '22 19:08 romgrk