Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support other base languages #25

Open
LandazuriPaul opened this issue Oct 29, 2024 · 0 comments
Open

Support other base languages #25

LandazuriPaul opened this issue Oct 29, 2024 · 0 comments

Comments

@LandazuriPaul
Copy link

Feature request description

This extension is great for Go template files which are pure text based files. But I use a lot of YAML, TOML or even shell (bash/zsh) files which are templated with Go in different projects. In such scenarios, I have to choose between having the base language syntax highlighting (in which case any Go templating is considered as an error and breaking anything after the first templating instance) or having the Go template syntax highlighting (in which case I lose any other base language highlighting). Ideally, it would be great to have both highlighting working.

As an illustration of what I'm talking about, GoLand offers this feature with the Go Template extension and a setting tweak.

Screenshot 2024-10-29 at 17 30 31

From the screenshot above, you can see that this combination of syntax allows for:

  • the repeated path field to be detected as an error for the YAML structure
  • give proper syntax highlighting for both languages (YAML + Go Template)
  • offers completion for Go templating
  • the $bas typo to be detected as an error as this Go Template variable doesn't exist

Currently, when using this extension, I have to choose between the go-template file type (1) and the yaml file type. These give me the below results:

(1) Screenshot 2024-10-29 at 17 31 45

(2) Screenshot 2024-10-29 at 17 32 06

Note

Maybe I just didn't understand how to set up this extension and it already supports it. If this is the case, I'm happy to open a little PR to add a line or two in the README.md as it seems that I'm not the only one being a bit confused for this specific point. For example, see this StackOverflow issue.

When looking for similar issues in this GitHub repository (and potential solutions/settings), I found this response mentioning an issue that apparently has been resolved by VS Code now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant