fix: don't include current line in lsp references if current_line=false (#2165)
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user