lsp: remove definitions from vendor-bin
This commit is contained in:
parent
ba2c700af6
commit
579b90e6a8
|
@ -4,11 +4,23 @@ M.definition = function()
|
||||||
local params = vim.lsp.util.make_position_params()
|
local params = vim.lsp.util.make_position_params()
|
||||||
|
|
||||||
vim.lsp.buf_request(0, "textDocument/definition", params, function(err, result, ctx, config)
|
vim.lsp.buf_request(0, "textDocument/definition", params, function(err, result, ctx, config)
|
||||||
local new_result = vim.tbl_filter(function(v)
|
local bufnr = ctx.bufnr
|
||||||
-- TODO: remove definitions within vendor-bin directory for PHP files?
|
local ft = vim.api.nvim_buf_get_option(bufnr, "filetype")
|
||||||
|
|
||||||
|
local new_result = vim.tbl_filter(function(v)
|
||||||
-- Remove any definitions within the nix store via the .direnv directory.
|
-- Remove any definitions within the nix store via the .direnv directory.
|
||||||
return not string.find(v.targetUri, ".direnv")
|
if string.find(v.targetUri, ".direnv") then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Remove definitions within vendor-bin directory for PHP files.
|
||||||
|
if ft == "php" then
|
||||||
|
if string.find(v.targetUri, "vendor%-bin") then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return true
|
||||||
end, result)
|
end, result)
|
||||||
|
|
||||||
if #new_result > 0 then
|
if #new_result > 0 then
|
||||||
|
|
Reference in a new issue