From 5aa4a885a51ed6cd902df2728f701334141dad81 Mon Sep 17 00:00:00 2001 From: qvalentin Date: Sun, 22 Sep 2024 13:32:04 +0200 Subject: [PATCH 1/2] fix: add docs about injection for other langs fixes https://github.com/ngalaiko/tree-sitter-go-template/issues/21 --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index 52855f1..ff6f19a 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,21 @@ More dialects could be added in the future (e.g. for html templates). :TSInstall helm ``` +### Highlighting for the templated language + +To get proper highlighting for the language that is templated (e.g. html) you need to add injections for +that language to `.config/nvim/queries/gotmpl/injections.scm`: + +```scm +((text) @injection.content + (#set! injection.language "html") + (#set! injection.combined)) +``` + +Replace html with the tree-sitter name of your required language and make sure to install it with `:TSInstall`. + +More advanced use cases would require adding more dialects (as done for helm). + > [!NOTE] > > If you are using helm, you should also install the yaml parser (:TSInstall yaml) to get [language injection][] for yaml From e9ba1d0a1fb9755ced53e380f5b46bffaa9cef53 Mon Sep 17 00:00:00 2001 From: qvalentin Date: Sun, 22 Sep 2024 13:32:27 +0200 Subject: [PATCH 2/2] fix(docs): add LazyVim tip and move AstroNvim tip --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ff6f19a..0ec98fc 100644 --- a/README.md +++ b/README.md @@ -56,11 +56,9 @@ More advanced use cases would require adding more dialects (as done for helm). > [!NOTE] > -> If you are using helm, you should also install the yaml parser (:TSInstall yaml) to get [language injection][] for yaml - -> [!TIP] +> If you are using helm, you should also install the yaml parser (:TSInstall yaml) to get [language injection][] for yaml. > -> If you are using [AstroNvim][] you can just install the [astrocommunity][] helm pack. +> In case you are using [AstroNvim][] you can just install the [astrocommunity][] helm pack or when using [LazyVim][] its [LazyVimHelm] plugin. [tree-sitter]: https://github.com/tree-sitter/tree-sitter [Golang templates]: https://golang.org/pkg/text/template/ @@ -72,3 +70,5 @@ More advanced use cases would require adding more dialects (as done for helm). [language injection]: https://tree-sitter.github.io/tree-sitter/syntax-highlighting#language-injection [AstroNvim]: https://github.com/AstroNvim/AstroNvim [astrocommunity]: https://github.com/AstroNvim/astrocommunity +[LazyVim]: https://www.lazyvim.org/ +[LazyVimHelm]: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/plugins/extras/lang/helm.lua