mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-04-27 03:47:37 +00:00
languages/go: add injections for gotmpl
This commit is contained in:
parent
c4b940239b
commit
56db4e1cbd
3 changed files with 28 additions and 2 deletions
|
|
@ -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)
|
||||
)
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue