Skip to content

Commit

Permalink
fix: support LocationLink (#94)
Browse files Browse the repository at this point in the history
* support LocationLink

* use targetSelectionRange
  • Loading branch information
saecki committed Oct 22, 2021
1 parent 691f05e commit 7f3761b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lua/trouble/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,9 @@ end
function M.process_item(item, bufnr)
local filename = vim.api.nvim_buf_get_name(bufnr)
local uri = vim.uri_from_bufnr(bufnr)
local start = item.range["start"]
local finish = item.range["end"]
local range = item.range or item.targetSelectionRange
local start = range["start"]
local finish = range["end"]
local row = start.line
local col = start.character

Expand Down Expand Up @@ -154,7 +155,8 @@ function M.locations_to_items(results, default_severity)
for bufnr, locs in pairs(results or {}) do
for _, loc in pairs(locs.result or locs) do
if not vim.tbl_isempty(loc) then
local buf = loc.uri and vim.uri_to_bufnr(loc.uri) or bufnr
local uri = loc.uri or loc.targetUri
local buf = uri and vim.uri_to_bufnr(uri) or bufnr
loc.severity = loc.severity or default_severity
table.insert(ret, M.process_item(loc, buf))
end
Expand Down

0 comments on commit 7f3761b

Please sign in to comment.