Helm 模板:逗号分隔语法高亮

问题描述 投票:0回答:1

我在 Go 模板操作中使用逗号

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 }}

这就是我的语法突出显示的样子:

然后“错误”/“损坏的语法”传播到文件的其余部分,基本上以相同的颜色显示所有内容,这非常烦人。

有没有办法防止逗号破坏 VS Code 中的语法高亮?

visual-studio-code syntax yaml kubernetes-helm go-templates
1个回答
0
投票

在 VS Code 上安装 Kubernetes 扩展 可在 Helm 图表和模板上添加 Intellisense。

.yaml

文件的
语言模式将被自动检测为屏幕右下角的
helm-template

© www.soinside.com 2019 - 2024. All rights reserved.