Skip to content

Hooking CmdlineEnter breaks vim.diagnostics.config in other config #582

@philpennock

Description

@philpennock

Using: neovim 0.11.2 (on Linux),
with Lazy to load, and using the recommended configuration from the ray-x/go.nvim README.md.

I was having a problem where configuration I provided to vim.diagnostics.config(my_config) was disappearing after running any nvim :command. My understanding is that this reset is that "something" has called vim.diagnostics.config({}), where an empty object causes a reset to defaults.

I finally tracked it down to ray-x/go.nvim : disabling the loading of this module allowed my config to persist; re-enabling the module but commenting out the recommended event = {"CmdlineEnter"}, directive allowed my config to persist.

I think (but could be wrong) that this relates to lua/go.lua:

249   if type(_GO_NVIM_CFG.diagnostic) == 'boolean' then

266   else
267     local dcfg = vim.tbl_extend('force', {}, _GO_NVIM_CFG.diagnostic)
268     vim.diagnostic.config(dcfg)
269   end

If I add this to the Lazy load block (so passed to config):

    opts = {
      disable_defaults = true,
    },

then the problem goes away, but it does cause go.nvim to trigger errors on other things being undefined.

Note that I'm not even editing a Go file, but a YAML file.

At present, the only reliable means I have of getting my configuration to persist is to just drop the event registration for CmdlineEnter for go.nvim.

Possibly related issues:

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