Add setting to disable automatic schema detection for matching YAML files#1251
Conversation
Signed-off-by: Morgan Chang <shin19991207@gmail.com>
datho7561
left a comment
There was a problem hiding this comment.
I think the name of the setting could be better.
Maybe disableSchemaDetection?
…ionand change schema priority Signed-off-by: Morgan Chang <shin19991207@gmail.com>
datho7561
left a comment
There was a problem hiding this comment.
Looks good and works well. Thanks, Morgan!
We might need to comb through the issue list to find similar bugs and close them, I know this was a pain point for a bunch of users.
|
@shin19991207 @datho7561 would it not make sense to auto-disable it for common schemas in some way? E.g. if the "Docker DX" extension is installed, it does not care about: "compose*y*ml",
"docker-compose*y*ml",I know other extensions does similar things for this, and it is a good practice because then thousand developers do not need to manually update their settings for common files and extensions. The new solution is good, but I do definitely think it can be more DX friendly. |
|
That sounds like a good idea. We'd need some mechanism to detect that the docker extension is installed. We'd probably also want GitHub Actions. I can't think of any others off the top of my head. We'd probably need to do this on the VS Code side, then, which means the mechanism wouldn't work for eg. neovim, helix, zed etc.. but I still think it's worth doing it. |
|
@datho7561 I do know that https://github.com/hverlin/mise-vscode does discover if other extensions are installed, I have not investigated how or if what they do is idiomatic though. |
What does this PR do?
Adds the
yaml.schemaDetectionDisableForsetting for disabling automatically detected schemas for specific YAML files by glob pattern. The expected value is a glob pattern or list of glob patterns.This is intended for cases where schemas from Schema Store or schema association notifications are incorrectly applied to files with generic names. Explicit schemas still take precedence, so users can continue to opt into validation with the
yaml.schemassetting or a modeline.Also update https://github.com/redhat-developer/yaml-language-server/pull/1251/changes#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R116 because absolute paths in
yaml.schemasdoes work fine.What issues does this PR fix or reference?
Fixes redhat-developer/vscode-yaml#245
Is it tested? How?
some.sam.ymlwith following content: