diff --git a/docs/manual/release-notes/rl-0.9.md b/docs/manual/release-notes/rl-0.9.md index c56ccc50..1d5040c8 100644 --- a/docs/manual/release-notes/rl-0.9.md +++ b/docs/manual/release-notes/rl-0.9.md @@ -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): diff --git a/modules/extra/deprecations.nix b/modules/extra/deprecations.nix index 760b7b38..99785c2e 100644 --- a/modules/extra/deprecations.nix +++ b/modules/extra/deprecations.nix @@ -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"]) ] ]; } diff --git a/modules/plugins/languages/go.nix b/modules/plugins/languages/go.nix index 6831fe9c..afe9d1b2 100644 --- a/modules/plugins/languages/go.nix +++ b/modules/plugins/languages/go.nix @@ -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) + ) + ''; + } ]; }; })