diff options
author | Matthieu Coudron <mattator@gmail.com> | 2020-01-28 10:45:25 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2020-01-28 01:45:25 -0800 |
commit | e956ea767241268861f0a8f7556700516849b112 (patch) | |
tree | 1daaf95375fbba524e4b23d99253367bfc5823a1 /runtime/lua/vim/lsp/util.lua | |
parent | b2062368e79f03dde86ea0c02adf61e18f6103ac (diff) | |
download | rneovim-e956ea767241268861f0a8f7556700516849b112.tar.gz rneovim-e956ea767241268861f0a8f7556700516849b112.tar.bz2 rneovim-e956ea767241268861f0a8f7556700516849b112.zip |
LSP: show diagnostic in qf/loclist #11777
instead of the content of the file at this line.
ref https://github.com/neovim/nvim-lsp/issues/69
Diffstat (limited to 'runtime/lua/vim/lsp/util.lua')
-rw-r--r-- | runtime/lua/vim/lsp/util.lua | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua index df82e2d412..6a1b73045e 100644 --- a/runtime/lua/vim/lsp/util.lua +++ b/runtime/lua/vim/lsp/util.lua @@ -704,7 +704,7 @@ do end local position_sort = sort_by_key(function(v) - return {v.line, v.character} + return {v.start.line, v.start.character} end) -- Returns the items with the byte position calculated correctly and in sorted @@ -721,17 +721,21 @@ function M.locations_to_items(locations) for _, d in ipairs(locations) do local start = d.range.start local fname = assert(vim.uri_to_fname(d.uri)) - table.insert(grouped[fname], start) + table.insert(grouped[fname], {start = start, msg= d.message }) end + + local keys = vim.tbl_keys(grouped) table.sort(keys) -- TODO(ashkan) I wish we could do this lazily. for _, fname in ipairs(keys) do local rows = grouped[fname] + table.sort(rows, position_sort) local i = 0 for line in io.lines(fname) do - for _, pos in ipairs(rows) do + for _, temp in ipairs(rows) do + local pos = temp.start local row = pos.line if i == row then local col @@ -744,7 +748,7 @@ function M.locations_to_items(locations) filename = fname, lnum = row + 1, col = col + 1; - text = line; + text = temp.msg; }) end end |