Skip to content

[audit] vim._core.ui2 accesses a private internal API — fragile experimental block #86

Description

@stanfish06

What

lua/config/options.lua:143–150 calls require("vim._core.ui2") — a module under the _core namespace. The leading underscore is Neovim's convention for internal/private modules: no stability guarantee, no public docs, can be renamed or removed at any release without notice.

Where

lua/config/options.lua:143–150

if not vim.g.vscode then
    local ok, ui2 = pcall(require, "vim._core.ui2")
    if ok then
        pcall(ui2.enable)
        vim.notify("ui2 enabled", vim.log.levels.INFO)
    else
        vim.notify("ui2 disabled (could be old nvim or api shift, check options.lua)", vim.log.levels.WARN)
    end
end

Why it matters

  • The module path vim._core.ui2 has already shifted between nightly builds. The pcall prevents a hard crash, but if the module is removed the WARN banner fires on every startup with no user-visible fix path.
  • If ui2 ships a public API, Neovim will expose it through a documented path (e.g., vim.ui2 or via :help). Tracking the private path adds ongoing maintenance burden.
  • There is no :help entry for vim._core.ui2, making it hard to know what ui2.enable actually does or what the intended stable replacement will be.

Recommended action

  1. Short term: leave the pcall guard in place (it's already there from [audit] fix WARN→INFO log level for ui2 success notification #85's PR), but add a comment pointing to the tracking issue so future-you knows why this exists.
  2. Long term: watch the Neovim nightly news (news-0.12, news.txt) for the public ui2 API landing. When it does, replace this block with the documented call and remove the private require.
  3. If ui2 is no longer relevant: remove the block entirely — it fires a notification on every startup for a feature with no stable API surface.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions