https://github.com/catgoose/templ-goto-definition
Fixes golang templ goto definition to open .templ file instead of generated .go file
https://github.com/catgoose/templ-goto-definition
golang neovim-plugin nvim-plugin templ
Last synced: 11 months ago
JSON representation
Fixes golang templ goto definition to open .templ file instead of generated .go file
- Host: GitHub
- URL: https://github.com/catgoose/templ-goto-definition
- Owner: catgoose
- Created: 2024-09-08T13:51:37.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-09T00:13:38.000Z (almost 2 years ago)
- Last Synced: 2025-03-22T04:02:48.976Z (over 1 year ago)
- Topics: golang, neovim-plugin, nvim-plugin, templ
- Language: Lua
- Homepage:
- Size: 4.88 KB
- Stars: 23
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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
```lua
return {
"catgoose/templ-goto-definition",
ft = { "go" },
config = true,
dependenciies = "nvim-treesitter/nvim-treesitter", -- optional
}
```
See this templ issue:
VSCode version not made by me, but was mentioned in the above issue: