Search code examples
visual-studio-codesyntaxyamlkubernetes-helmgo-templates

Helm template: commas break syntax highlight


I'm using a comma in a Go template action

metadata:
  name: {{ $route.name }}-route
  annotations:
    konghq.com/strip-path: {{ default true $route.stripPath | quote }}
    {{- if ne (len $route.plugins) 0 }}
    {{- $pluginsString := join "," $route.plugins }}
    konghq.com/plugins: {{ $pluginsString | quote }}
    {{- end }}

This is what my syntax highlight looks like: enter image description here

And then that "error"/"broken syntax" then propagates to the rest of the file, basically showing everything with the same color, which is very annoying.

Is there a way to prevent commas from breaking the syntax highlight in VS Code?


Solution

  • Installing the Kubernetes extension on VS Code adds Intellisense on Helm charts and templates.

    Language Mode of .yaml file will be auto-detected as helm-template in the bottom right of the screen :

    vscode screenshot