Skip to content
This repository has been archived by the owner on Jul 6, 2021. It is now read-only.

Wrong diagnostics appearing on locationlist #59

Open
eemed opened this issue Sep 22, 2020 · 0 comments
Open

Wrong diagnostics appearing on locationlist #59

eemed opened this issue Sep 22, 2020 · 0 comments

Comments

@eemed
Copy link

eemed commented Sep 22, 2020

Using rust_analyzer and NVIM v0.5.0-583-g7b529e791
This just seems very odd behavior.

My first asciinema

On start everything seems correct. After opening locationlist using :lopen it contains some arbitrary points in the file (they are always the same). Diagnostic signs disappear after a while on the locationlist. When the file buffer is refocused all of the signs and locationlist restore to normal. Removing any character or writing anything on the file buffer gets the arbitrary points back to location list.

Also on top of this is there a way to make locationlist report the error itself?

diagnostic-nvim configuration:

let g:diagnostic_insert_delay = 1
local nvim_lsp = require('nvim_lsp')

local on_attach = function(client, bufnr)
    require'diagnostic'.on_attach(client)

    vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
    vim.api.nvim_command('setlocal signcolumn=yes')

    -- Mappings.
    local opts = { noremap=true, silent=true }
    vim.api.nvim_buf_set_keymap(bufnr , 'n' , 'gD'        , '<cmd>lua vim.lsp.buf.declaration()<CR>'            , opts)
    vim.api.nvim_buf_set_keymap(bufnr , 'n' , 'gd'        , '<cmd>lua vim.lsp.buf.definition()<CR>'             , opts)
    vim.api.nvim_buf_set_keymap(bufnr , 'n' , 'K'         , '<cmd>lua vim.lsp.buf.hover()<CR>'                  , opts)
    vim.api.nvim_buf_set_keymap(bufnr , 'n' , 'gi'        , '<cmd>lua vim.lsp.buf.implementation()<CR>'         , opts)
    vim.api.nvim_buf_set_keymap(bufnr , 'n' , 'gy'        , '<cmd>lua vim.lsp.buf.type_definition()<CR>'        , opts)
    vim.api.nvim_buf_set_keymap(bufnr , 'n' , 'gR'        , '<cmd>lua vim.lsp.buf.rename()<CR>'                 , opts)
    vim.api.nvim_buf_set_keymap(bufnr , 'n' , 'gr'        , '<cmd>lua vim.lsp.buf.references()<CR>'             , opts)
    vim.api.nvim_buf_set_keymap(bufnr , 'n' , '<leader>f' , '<cmd>lua vim.lsp.buf.formatting()<CR>'             , opts)
    vim.api.nvim_buf_set_keymap(bufnr , 'n' , '<leader>e' , '<cmd>lua vim.lsp.util.show_line_diagnostics()<CR>' , opts)
    vim.api.nvim_buf_set_keymap(bufnr , 'n' , '<leader>a' , '<cmd>lua vim.lsp.buf.code_action()<CR>' , opts)
    -- vim.api.nvim_buf_set_keymap(bufnr    , 'n' , '<C-k>'     , '<cmd>lua vim.lsp.buf.signature_help()<CR>'         , opts)
end

local servers = {'bashls', 'tsserver', 'pyls', 'rust_analyzer'}
for _, lsp in ipairs(servers) do
    nvim_lsp[lsp].setup {
        on_attach = on_attach,
    }
end
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant