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|
This commit is contained in:
Mathias Fussenegger 2020-02-19 20:24:56 +01:00
parent 52124f286c
commit 220a2b05c6
1 changed files with 1 additions and 1 deletions

View File

@ -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