This repository has been archived on 2025-01-07. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
opdavies.nvim/lua/opdavies/lsp/handlers.lua
2024-02-29 16:29:04 +00:00

23 lines
653 B
Lua

local M = {}
M.definition = function()
local params = vim.lsp.util.make_position_params()
vim.lsp.buf_request(0, "textDocument/definition", params, function(err, result, ctx, config)
local new_result = vim.tbl_filter(function(v)
-- TODO: remove definitions within vendor-bin directory for PHP files?
-- Remove any definitions within the nix store via the .direnv directory.
return not string.find(v.targetUri, ".direnv")
end, result)
if #new_result > 0 then
result = new_result
end
vim.lsp.handlers["textDocument/definition"](err, result, ctx, config)
vim.cmd [[normal! zz]]
end)
end
return M