Fixes Neovim gopls LSP goto definition for templ templates
When using vim.lsp.buf.definition
in a Go file for a templ template, gopls
only knows about the generated Go file. This plugin overrides vim.lsp.buf.definition
for the Go filetype and tries to open the correct temple file at the function
definition
templ
treesitter grammar is required for treesitter query to locate function name
in .templ file. If treesitter is unavailable, text search strategy is used
Lazy.nvim
return {
"catgoose/templ-goto-definition",
ft = { "go" },
config = true,
dependenciies = "nvim-treesitter/nvim-treesitter", -- optional
}
See this templ issue: a-h/templ#387 VSCode version not made by me, but was mentioned in the above issue: a-h/templ#387 (comment)