mrjosh / helm-ls

⎈ Language server for Helm ⎈
MIT License
195 stars 16 forks source link

How to show sane errors for helper files? #90

Open MikaelElkiaer opened 1 week ago

MikaelElkiaer commented 1 week ago

I have a bunch of helper templates - e.g. templates/_example.tpl. With the default config, they will show a bunch of errors, as they are interpreted as Kubernetes files - e.g. if indentation is wrong or it contains the same key, it will show as an error.

image

I have tried overriding the config with

settings = {
  ['helm-ls'] = {
    yamlls = {
      config = {
        schemas = {
          kubernetes = "templates/**/[!_]*"
        },
      }
    },
  },
},

But this will still show errors as the file is interpreted as a single yaml file, despite it containing multiple defines.

qvalentin commented 1 week ago

Hi thanks for reporting, this requires a fix, here are some possible ways I have in mind to implement it:

  1. Hide certain diagnostics inside define blocks: E.g. all diagnostics like "Property foo is not allowed"
  2. Disable yamlls for .tpl files (this is kind of obvious, I don't know why I did not think of this earlier)
  3. Allow configuring a pattern for files which should have yamlls enabled/disabled.

I think your config change is not working because yamlls only allows very primitive glob patterns.

MikaelElkiaer commented 1 week ago

Thanks for clarifying. And well done on the PR! Looking forward to this improvement.