Open baptman21 opened 9 months ago
I also added the injections file, we need to check if adding it in the queries directory makes it usable without manually adding it.
I think I found a case where this does not work correctly:
{{ if .Values }}
- name: {{ .Chart.Name }}-{{ $variable }}
image: "test"
{{- end }}
the yaml after $variable
is not rendered correctly.
Can we fix this?
Edit: I guess i know, why this is not working, correct me if I'm wrong. The injected yaml looks like this, which is not highlighted correctly by the yaml grammar.
- name: -
image: "test"
With the combined injections, this will break the yaml highlighting for the rest of the file, the old option would only break one line.
Other than that I can confirm that this fixes the issues described in https://github.com/ngalaiko/tree-sitter-go-template/issues/3, so https://github.com/ngalaiko/tree-sitter-go-template/pull/10 would not be needed anymore.
@qvalentin I just tinkered around with this myself and it can be fixed by quoting the value like so:
- name: "{{ .Chart.Name }}-{{ $variable }}"
That should be good practice anyway and won't risk breaking the generated yaml, if the template values evaluate to whitespace.
I'm also fine with merging this, I just wanted to point out what I noticed.
Did I just find another case? I can't really explain this one.
spec:
triggers:
- type: prometheus
metadata:
query: sum(rate(http_requests_total{deployment="my-deployment"}[2m]))
quer: test
broken: highlight
Did I just find another case? I can't really explain this one.
spec: triggers: - type: prometheus metadata: query: sum(rate(http_requests_total{deployment="my-deployment"}[2m])) quer: test broken: highlight
the query
should be wrapped in single quotes.
I think I found a case where this does not work correctly:
{{ if .Values }} - name: {{ .Chart.Name }}-{{ $variable }} image: "test" {{- end }}
the yaml after
$variable
is not rendered correctly.Can we fix this?
Edit: I guess i know, why this is not working, correct me if I'm wrong. The injected yaml looks like this, which is not highlighted correctly by the yaml grammar.
- name: - image: "test"
With the combined injections, this will break the yaml highlighting for the rest of the file, the old option would only break one line.
Other than that I can confirm that this fixes the issues described in #3, so #10 would not be needed anymore.
This is expected and not an issue.
@baptman21 lets merge this, it is also already included in https://github.com/nvim-treesitter/nvim-treesitter like this already.
Following #4 , we only need injections with the
combined
option to get a better result, this should fix most render issues, maybe even the ones in #10 but this needs to be checked.In the mean time this injection gives a better render.