vscode-kubernetes-tools: schema validation conflicts with other vscode extension on templates yaml
In our monorepo we have a custom folder named “templates” where we store yaml files not related to kubernetes and to which we apply custom schema validation using “redhat.vscode-yaml” extension.
The problem is that when Kubernetes extension is enabled it takes over schema validation of any yaml file located in this folder due to pattern collision "**/templates/*.yaml"
.
Is there any way to tell kubernetes-tools extension to step back and ignore “templates/*.yaml” pattern so that vscode will use our schema for those files?
About this issue
- Original URL
- State: open
- Created a year ago
- Comments: 15
❤️☕️💡 Thank you both! Aha @lstocchi and @yury-kozlov I think I got it now, the moment file is under the
template
folder the icon instantly changes, (With extension enable)So, it is surely not the
shouldProvideSchemaFor
akaconsideration-filter
issue it is thehelmCompletionProvider
issue which is part of the extension and gets added way top in the stack. As mentioned the screenshot might add more clarity and as to explain whytemplates
file are behaving that way.Proposed Solution: (something I could try)
helmCompletionProvider
enablement - shall we do it via somenew user setting
~> aka something likevs-kubernetes.skip-helm-completion:
- if set totrue
we can test the skipping of filter bit (Which when I tested locally does work and identify the file as right file.Thank you so much! WDYT?
@yury-kozlov - could you sanity-check my comment above? Is it definitely the tooltip in your screenshot that indicates that schema validation is happening?
Please let us know if @Tatsinnit’s
.vsix
helps at all.Because I can’t reproduce this myself, I’m wondering if this might be down to a combination of extensions being active (the K8s one plus something else, maybe Helm related?). I’m imagining something like the K8s extension identifies the file as being a helm template (because of a file path pattern), but something else does the schema validation.
Yes I was thinking about having a setting to change the default behavior but i’m not sure it’s actually possible.
@Tatsinnit i guess that the problem is if the file is under a
templates
folder. You can see that the plugin intervenes in the yaml because the file icon changes. I suppose we should find a way to avoid registering thehelmCompletionProvider
when required.@Tatsinnit thank you for a thorough check! One question: what is the path of yaml file you are testing (with exclude comment)? On my machine the issue happened when the file is stored inside “templates” folder.
Thanks @yury-kozlov and @lstocchi . Cool, I can play around with this tomorrow and will loop back once I found any workaround or solution for this. Thanks heaps