Skip to content

setup() still loads the UI and diff library at startup #580

Closed

Description

@dobsontom

#275 deferred the UI and the C diff library until the first :CodeDiff, but setup() still loads both. It re-applies the highlights with require("codediff.ui").setup_highlights(), and the codediff.ui facade requires the view and core modules, which load libvscode_diff through FFI. So any config that calls setup() at startup pays ~5 ms for it here, with 87 codediff modules loaded where 4 are needed.

function M.setup(opts)
local config = require("codediff.config")
config.setup(opts)
local render = require("codediff.ui")
render.setup_highlights()
end

Requiring codediff.ui.highlights directly, as plugin/codediff.lua already does, would fix it.

#581

Activity

  1. added a commit that references this issue on Nov 14, 2026
    0e457ad
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