Skip to content

Code refactoring plan #322

Description

@sudo-tee

Currently some aspect of the code need some love as the maintability is starting to sufffer.

I have identified a couple of acpect where we should iomprove the code

  • Split state.lua in multiple smaller slices (ui, jobs, model, session, etc) with functions to update the state, this way we can manage transitions in the state rather than doing it everywhere.
  • Split api.lua into commands.lua (:Opencode routing), slash_commands.lua, and api.lua (public action functions).
  • Split renderer.lua -- extract event subscription setup, permission/question coordination, and message formatting into separate concerns.
  • Deduplicate shared code -- extract set_win_option/set_buf_option and update_winbar_highlights into shared utility modules.
  • Core isn't feature-agnostic: core.lua / api.lua have feature-specific logic baked in — diff functions, markdown renderer detection (RenderMarkdown/Markview), footer mode hardcoded to only recognize build/plan.

Here is a list of the Associated PR for this

State refactor
#321

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions