Skip to content

Latest commit

 

History

History
27 lines (20 loc) · 877 Bytes

README.md

File metadata and controls

27 lines (20 loc) · 877 Bytes

templ-goto-definition

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

Setup

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)