{"id":13676201,"url":"https://github.com/ngalaiko/tree-sitter-go-template","last_synced_at":"2025-04-05T14:04:18.332Z","repository":{"id":41271150,"uuid":"372306168","full_name":"ngalaiko/tree-sitter-go-template","owner":"ngalaiko","description":"Golang template grammar for tree-sitter","archived":false,"fork":false,"pushed_at":"2025-01-29T18:19:23.000Z","size":446,"stargazers_count":104,"open_issues_count":7,"forks_count":29,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-29T13:05:40.532Z","etag":null,"topics":["go","parser","template","tree-sitter"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ngalaiko.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-05-30T20:09:45.000Z","updated_at":"2025-03-24T10:58:39.000Z","dependencies_parsed_at":"2024-01-14T14:31:07.362Z","dependency_job_id":"ce148cc2-a9a9-4cf9-a2d5-f5861640ae4b","html_url":"https://github.com/ngalaiko/tree-sitter-go-template","commit_stats":{"total_commits":41,"total_committers":5,"mean_commits":8.2,"dds":"0.29268292682926833","last_synced_commit":"fd9e1c6647e5e9b23918d00d1e48710d0f703e19"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ngalaiko%2Ftree-sitter-go-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ngalaiko%2Ftree-sitter-go-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ngalaiko%2Ftree-sitter-go-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ngalaiko%2Ftree-sitter-go-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ngalaiko","download_url":"https://codeload.github.com/ngalaiko/tree-sitter-go-template/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247345850,"owners_count":20924102,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","parser","template","tree-sitter"],"created_at":"2024-08-02T13:00:20.099Z","updated_at":"2025-04-05T14:04:18.309Z","avatar_url":"https://github.com/ngalaiko.png","language":"C","funding_links":[],"categories":["C","JavaScript"],"sub_categories":[],"readme":"## Announcement\n\nThe original author stopped using helm (which he mostly wrote this package for) on a daily basis, so he didn't really keep up with the development of tree sitter, and nvim-tree-sitter.\nSome people have been found to keep the repo going, so if you have ideas for improvements feel free to open issues or pull requests.\n\n# tree-sitter-go-template\n\n[![Build/test](https://github.com/ngalaiko/tree-sitter-go-template/actions/workflows/ci.yaml/badge.svg)](https://github.com/ngalaiko/tree-sitter-go-template/actions/workflows/ci.yaml)\n\n[Golang templates][] grammar for [tree-sitter][].\n\nAlso includes a [helm][] dialect. The concept of a dialect is that it uses the same parser, but can have different queries (e.g. for different injections).\nMore dialects could be added in the future (e.g. for html templates).\n\n## NeoVim integration using [nvim-treesitter][]\n\n-   Setup filetype detection:\n\n    -   using [lua](https://neovim.io/doc/user/lua.html#vim.filetype):\n\n    ```lua\n    vim.filetype.add({\n      extension = {\n        gotmpl = 'gotmpl',\n      },\n      pattern = {\n        [\".*/templates/.*%.tpl\"] = \"helm\",\n        [\".*/templates/.*%.ya?ml\"] = \"helm\",\n        [\"helmfile.*%.ya?ml\"] = \"helm\",\n      },\n    })\n    ```\n\n-   Install [nvim-treesitter][] as described here: [nvim-treesitter-install][]\n-   Install the parser you want to use:\n\n```vim\n:TSInstall gotmpl\n:TSInstall helm\n```\n\n### Highlighting for the templated language\n\nTo get proper highlighting for the language that is templated (e.g. html) you need to add injections for\nthat language to `.config/nvim/queries/gotmpl/injections.scm`:\n\n```scm\n((text) @injection.content\n (#set! injection.language \"html\")\n (#set! injection.combined))\n```\n\nReplace html with the tree-sitter name of your required language and make sure to install it with `:TSInstall`.\n\nMore advanced use cases would require adding more dialects (as done for helm).\n\n\u003e [!NOTE]\n\u003e\n\u003e If you are using helm, you should also install the yaml parser (:TSInstall yaml) to get [language injection][] for yaml.\n\u003e\n\u003e In case you are using [AstroNvim][] you can just install the [astrocommunity][] helm pack or when using [LazyVim][] its [LazyVimHelm] plugin.\n\n[tree-sitter]: https://github.com/tree-sitter/tree-sitter\n[Golang templates]: https://golang.org/pkg/text/template/\n[nvim-treesitter instructions]: https://github.com/nvim-treesitter/nvim-treesitter#adding-parsers\n[nvim-treesitter-install]: https://github.com/nvim-treesitter/nvim-treesitter?tab=readme-ov-file#installation\n[nvim-treesitter]: https://github.com/nvim-treesitter/nvim-treesitter\n[helm]: https://helm.sh\n[vim-helm]: https://github.com/towolf/vim-helm\n[language injection]: https://tree-sitter.github.io/tree-sitter/syntax-highlighting#language-injection\n[AstroNvim]: https://github.com/AstroNvim/AstroNvim\n[astrocommunity]: https://github.com/AstroNvim/astrocommunity\n[LazyVim]: https://www.lazyvim.org/\n[LazyVimHelm]: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/plugins/extras/lang/helm.lua\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fngalaiko%2Ftree-sitter-go-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fngalaiko%2Ftree-sitter-go-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fngalaiko%2Ftree-sitter-go-template/lists"}