From 220a2b05c6c42dcbaa0c84292cbb318ddee4ff49 Mon Sep 17 00:00:00 2001 From: Mathias Fussenegger Date: Wed, 19 Feb 2020 20:24:56 +0100 Subject: LSP/references: Add context to locations returned by server This changes the `textDocument/references' callback to annotate the locations returned by the server with the content present at the locations range. The quickfix list then looks as follows: cr8/insert_fake_data.py|17 col 32| from .misc import parse_table, parse_version cr8/insert_fake_data.py|43 col 15| version = parse_version(r['rows'][0][0]) cr8/java_magic.py|8 col 22| from cr8.misc import parse_version cr8/java_magic.py|30 col 19| version = parse_version(fst) cr8/java_magic.py|33 col 16| return parse_version(version_str) Instead of: cr8/insert_fake_data.py|17 col 32| cr8/insert_fake_data.py|43 col 15| cr8/java_magic.py|8 col 22| cr8/java_magic.py|30 col 19| cr8/java_magic.py|33 col 16| --- runtime/lua/vim/lsp/util.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/lua/vim/lsp/util.lua') diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua index 21e0dbfd1f..803d9443b7 100644 --- a/runtime/lua/vim/lsp/util.lua +++ b/runtime/lua/vim/lsp/util.lua @@ -824,7 +824,7 @@ function M.locations_to_items(locations) filename = fname, lnum = row + 1, col = col + 1; - text = temp.msg; + text = temp.msg or line; }) end end -- cgit From 38201650cd60c001c4b639f30ca45f1b8eba98ca Mon Sep 17 00:00:00 2001 From: Mathias Fussenegger Date: Sun, 23 Feb 2020 13:00:48 +0100 Subject: LSP: Remove diagnostic message handling in locations_to_items `locations_to_items` is for turning `Location[]` into items, not for `Diagnostic[]` --- runtime/lua/vim/lsp/util.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'runtime/lua/vim/lsp/util.lua') diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua index 803d9443b7..5f0fe8ceb4 100644 --- a/runtime/lua/vim/lsp/util.lua +++ b/runtime/lua/vim/lsp/util.lua @@ -797,7 +797,7 @@ 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 = start, msg= d.message }) + table.insert(grouped[fname], {start = start}) end @@ -824,7 +824,7 @@ function M.locations_to_items(locations) filename = fname, lnum = row + 1, col = col + 1; - text = temp.msg or line; + text = line; }) end end -- cgit