kosayoda / nvim-lightbulb

VSCode 💡 for neovim's built-in LSP.
MIT License
783 stars 27 forks source link

[BUG]: Ignore setting does not seem to work #39

Closed willdavidow closed 1 year ago

willdavidow commented 2 years ago

I copied the config example from the main readme and made adjustments to include null-ls in the ignore pattern and have the plugin manage creating autocmds. The issue there is that I see the lightbulb on every single line and it's including null-ls even though I have it in my ignore config.

I did some additional testing by setting autocmd to false in the config, then added my own autocmd with the ignore setting included in every update call, and it works as expected.

Long story short: it appears that the ignore setting just doesn't work at all when passed into the main plugin configuration and the only way to ignore specific LSP code actions is to include the ignore configuration there.

My nvim-lightbulb config:

local status_ok, lightbulb = pcall(require, "nvim-lightbulb")
if not status_ok then
  return
end

lightbulb.setup({
    -- LSP client names to ignore
    -- Example: {"sumneko_lua", "null-ls"}
    ignore = {
        "null-ls",
    },
    sign = {
        enabled = true,
        -- Priority of the gutter sign
        priority = 10,
    },
    float = {
        enabled = false,
        -- Text to show in the popup float
        text = "💡",
        -- Available keys for window options:
        -- - height     of floating window
        -- - width      of floating window
        -- - wrap_at    character to wrap at for computing height
        -- - max_width  maximal width of floating window
        -- - max_height maximal height of floating window
        -- - pad_left   number of columns to pad contents at left
        -- - pad_right  number of columns to pad contents at right
        -- - pad_top    number of lines to pad contents at top
        -- - pad_bottom number of lines to pad contents at bottom
        -- - offset_x   x-axis offset of the floating window
        -- - offset_y   y-axis offset of the floating window
        -- - anchor     corner of float to place at the cursor (NW, NE, SW, SE)
        -- - winblend   transparency of the window (0-100)
        win_opts = {},
    },
    virtual_text = {
        enabled = false,
        -- Text to show at virtual text
        text = "💡",
        -- highlight mode to use for virtual text (replace, combine, blend), see :help nvim_buf_set_extmark() for reference
        hl_mode = "replace",
    },
    status_text = {
        enabled = false,
        -- Text to provide when code actions are available
        text = "💡",
        -- Text to provide when no actions are available
        text_unavailable = ""
    },
    autocmd = {
        enabled = true,
        -- see :help autocmd-pattern
        pattern = {"*"},
        -- see :help autocmd-events
        events = {"CursorHold", "CursorHoldI"}
    },
})

-- vim.cmd [[autocmd CursorHold,CursorHoldI * lua require'nvim-lightbulb'.update_lightbulb({ ignore = {"null-ls"} })]]
kosayoda commented 2 years ago

Hi! Thanks for catching this bug. I don't have much time lately, but I appreciate the workaround in the meantime.

chrisgrieser commented 1 year ago

I also encountered this issue, although ignoring null-ls in update_lightbulb didn't work for me. (Since I rarely use the blame line stuff, I have disabled this part of null ls though.)