languages/go: add injections for gotmpl

This commit is contained in:
Snoweuph 2026-04-19 18:51:41 +02:00
commit 56db4e1cbd
No known key found for this signature in database
GPG key ID: BEFC41DA223CEC55
3 changed files with 28 additions and 2 deletions

View file

@ -104,6 +104,10 @@
- Renamed `languages.ts` to `languages.typescript`.
- Added {option}`vim.languages.go.treesitter.gotmpl.injection` and Renamed
`languages.go.treesitter.gotmplPackage` to
{option}`vim.languages.go.treesitter.gotmpl.package`
## Changelog {#sec-release-0-9-changelog}
[SecBear](https://github.com/SecBear):

View file

@ -362,6 +362,7 @@ in {
# 2026-04-19
[
(mkRenamedOptionModule ["vim" "utility" "vim-wakatime" "cli-path"] ["vim" "utility" "vim-wakatime" "setupOpts" "cli_path"])
(mkRenamedOptionModule ["vim" "languages" "go" "treesitter" "gotmplPackage"] ["vim" "languages" "go" "treesitter" "gotmpl" "package"])
]
];
}

View file

@ -143,7 +143,14 @@ in {
gomodPackage = mkGrammarOption pkgs "gomod";
gosumPackage = mkGrammarOption pkgs "gosum";
goworkPackage = mkGrammarOption pkgs "gowork";
gotmplPackage = mkGrammarOption pkgs "gotmpl";
gotmpl = {
package = mkGrammarOption pkgs "gotmpl";
injection = mkOption {
type = str;
default = "html";
description = "Treesitter language to inject in Go templates";
};
};
};
lsp = {
@ -274,7 +281,21 @@ in {
cfg.treesitter.gomodPackage
cfg.treesitter.gosumPackage
cfg.treesitter.goworkPackage
cfg.treesitter.gotmplPackage
cfg.treesitter.gotmpl.package
];
queries = [
{
type = "injections";
filetypes = ["gotmpl"];
content = ''
;; extends
((text) @injection.content
(#set! injection.language "${cfg.treesitter.gotmpl.injection}")
(#set! injection.combined)
)
'';
}
];
};
})