tree-sitter-godoc
November 2, 2025 ยท View on GitHub
This parser...
- identifies structural regions in
godocoutput so to efficiently delegate Go syntax highlighting to the tree-sitter-go parser via tree-sitter query injections. - is designed to work with godoc.nvim.
Quickstart for Neovim users
Using nvim-treesitter (main branch)
- Configure how to install the
godocparser:
require('nvim-treesitter.parsers').godoc = {
install_info = {
url = "https://github.com/fredrikaverpil/tree-sitter-godoc",
files = {"src/parser.c"},
branch = "main",
},
filetype = "godoc",
}
- Install parsers via TSInstall:
:TSInstall godoc go
- Copy queries into Neovim configuration:
cp queries/*.csm ~/.config/nvim/after/queries/godoc/
Development
Prerequisites
- tree-sitter CLI
- A C compiler
Building
# Generate the parser from grammar.js
tree-sitter generate
# Test the grammar
tree-sitter test
# Build the parser
tree-sitter build
Testing with playground
tree-sitter playground
Then paste some go doc output to see how it's parsed.
Contributing
Contributions welcome! Please open an issue or PR.