Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on <Plug>(toggle-lsp-diag-vtext) #13

Open
savchenko opened this issue Jan 6, 2024 · 2 comments
Open

Error on <Plug>(toggle-lsp-diag-vtext) #13

savchenko opened this issue Jan 6, 2024 · 2 comments

Comments

@savchenko
Copy link

Default config, LSP attached and operational:

E5108: Error executing lua ...ggle-lsp-diagnostics.nvim/lua/toggle_lsp_diagnostics.lua:90: attempt to index a nil value
stack traceback:
        ...ggle-lsp-diagnostics.nvim/lua/toggle_lsp_diagnostics.lua:90: in function 'toggle_diagnostic'
        ...ggle-lsp-diagnostics.nvim/lua/toggle_lsp_diagnostics.lua:109: in function 'toggle_virtual_text'
        [string ":lua"]:1: in main chunk
@WhoIsSethDaniel
Copy link
Owner

WhoIsSethDaniel commented Jan 22, 2024

I can't duplicate this. Do you have somewhere where I can look at your configuration?

Also, what version of nvim are you using?

@savchenko
Copy link
Author

Sorry, I have replaced this plugin with a small Lua snippet. Likely to be of no use, but just for context:

    { -- Underline error display
        url = 'https://git.sr.ht/~whynothugo/lsp_lines.nvim',
        config = function()

            local lsp_lines = require('lsp_lines')
            local counter = 0

            local ll_toggle = function() -- Flip between diag. types
                if counter == 0 then
                    vim.diagnostic.config({ virtual_text = false, virtual_lines = false })
                    vim.api.nvim_echo({{ "Diagnostic in code turned OFF", "Comment" }}, true, {})
                    counter = counter + 1
                elseif counter == 1 then
                    vim.diagnostic.config({ virtual_text = false, virtual_lines = true })
                    vim.api.nvim_echo({{ "Underline diagnostics", "Comment" }}, true, {})
                    counter = counter + 1
                elseif counter == 2 then
                    vim.diagnostic.config({ virtual_text = { prefix = '' }, virtual_lines = false })
                    vim.api.nvim_echo({{ "Inline diagnostics", "Comment" }}, true, {})
                    counter = 0
                end
            end

            lsp_lines.setup()

            vim.keymap.set("", "<leader>te",
                ll_toggle, { desc = "Toggle LSP diagnostics" }
            )

            ll_toggle() -- Disable by default
        end
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants