Skip to content

Commit

Permalink
fix(lsp): no locations found notification (#980)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibhagwan committed Jan 2, 2024
1 parent 949f3ca commit f4f3671
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions lua/fzf-lua/providers/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -92,23 +92,21 @@ local function location_handler(opts, cb, _, result, ctx, _)
return true
end, result)
end
local items = {}
-- Although `make_entry.file` filters for `cwd_only` we filter
-- here to accurately determine `jump_to_single_result` (#980)
if opts.cwd_only then
result = vim.tbl_filter(function(x)
local fname = vim.uri_to_fname(x.targetUri)
if not path.is_relative(fname, opts.cwd) then
return false
end
return true
end, result)
end
result = vim.tbl_filter(function(x)
local item = vim.lsp.util.locations_to_items({ x }, encoding)[1]
table.insert(items, item)
if opts.cwd_only and not path.is_relative(item.filename, opts.cwd) then
return false
end
return true
end, result)
-- Jump immediately if there is only one location
if opts.jump_to_single_result and #result == 1 then
jump_to_location(opts, result[1], encoding)
return
end
local items = vim.lsp.util.locations_to_items(result, encoding)
if opts.filter and type(opts.filter) == "function" then
items = opts.filter(items)
end
Expand Down

0 comments on commit f4f3671

Please sign in to comment.