fix: don't include current line in lsp references if current_line=false (#2165)

This commit is contained in:
Marcus Caisey
2022-09-17 09:14:53 +01:00
committed by GitHub
parent 1fd497e8ff
commit 4a43d13c95

View File

@@ -25,7 +25,7 @@ lsp.references = function(opts)
local locations = {} local locations = {}
if result then if result then
local results = vim.lsp.util.locations_to_items(result, vim.lsp.get_client_by_id(ctx.client_id).offset_encoding) local results = vim.lsp.util.locations_to_items(result, vim.lsp.get_client_by_id(ctx.client_id).offset_encoding)
if include_current_line then if not include_current_line then
locations = vim.tbl_filter(function(v) locations = vim.tbl_filter(function(v)
-- Remove current line from result -- Remove current line from result
return not (v.filename == filepath and v.lnum == lnum) return not (v.filename == filepath and v.lnum == lnum)