zed icon indicating copy to clipboard operation
zed copied to clipboard

Yaml Syntax Highlighting not working for Helm templates

Open 0xDones opened this issue 1 year ago • 6 comments

Check for existing issues

  • [X] Completed

Describe the bug / provide steps to reproduce it

Helm/go templates break the yaml syntax highlighting feature as you can see in the screenshot below.

Environment

Zed: v0.123.6 (Zed) OS: macOS 14.3.1 Memory: 16 GiB Architecture: x86_64

If applicable, add mockups / screenshots to help explain present your vision of the feature

image

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

If you only need the most recent lines, you can run the zed: open log command palette action to see the last 1000.

No response

0xDones avatar Feb 27 '24 15:02 0xDones

This is a issue known issue https://github.com/ikatyang/tree-sitter-yaml/issues/36

You can enclose the template syntax in single quotes as a workaround

TerminalFi avatar Feb 27 '24 15:02 TerminalFi

I understand, but it doesn't make sense all the time to enclose the template with quotes, for example:

{{- if .Values.serviceMonitorEnabled }}
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
...
{{- end }}

On VSCode it works as expected: image

0xDones avatar Feb 27 '24 17:02 0xDones

I want this new feature too. It would be greatly appreciated if you could prioritize its implementation in upcoming releases 👍

yasithab avatar Mar 09 '24 06:03 yasithab

I want this new feature too. It would be greatly appreciated if you could prioritize its implementation in upcoming releases 👍

It appears to be an upstream issue according to https://github.com/zed-industries/zed/issues/8487#issuecomment-1966851220, so there's not much we can prioritise.

Moshyfawn avatar Mar 10 '24 01:03 Moshyfawn

Relatively new Zed user here. Is there a way to tell Zed to ignore a subset of files? I added a helm chart to my project, and now I have 315 errors..., which makes it difficult to see my very real errors.

object88 avatar Mar 25 '24 03:03 object88

I believe that tree-sitter-go-template is the better approach, because they even support helm dialect: https://github.com/ngalaiko/tree-sitter-go-template/blob/master/dialects/helm

I tried to get helm language support added earlier this year here: https://github.com/zed-industries/zed/pull/7259

And I started a discussion for it here: https://github.com/zed-industries/zed/discussions/7260

Now, I'm just trying to get Helm supported via extensions: https://github.com/zed-industries/extensions/pull/443

cabrinha avatar May 16 '24 20:05 cabrinha

@cabrinha Please let us now if you find out how to package this as an extension. Hopefully we can get this working.

I see there is a closed pull request for #7259 ending with

Going to close this for now, but it should be possible to package this as an extension. @ConradIrwin

As well as a new currently open issue at zed-industries/extensions/issues/186

Should we close this issue and follow up to the latter issue?

Finally I see that the business is going on at zed-industries/extensions/pull/746 but I can't unfortunately help at the moment.

malikbenkirane avatar Jun 24 '24 11:06 malikbenkirane

@malikbenkirane https://github.com/zed-industries/extensions/issues/186 should stay open until the editor supports Helm.

https://github.com/zed-industries/extensions/pull/746 is where the business is going on, but I need some help with:

  • Making sure Zed identifies certain .yaml files as Helm and knows the difference and when to use Helm vs. YAML
  • Getting the CI tests to pass
  • Making sure the language server is being used correctly

cabrinha avatar Jun 24 '24 22:06 cabrinha