yaml-language-server
yaml-language-server copied to clipboard
A way to disable schema loading for a specific file using modeline
Sometimes I want to be able to create a YAML file without a schema, for example to hold generic config. In some cases the naming of this file would match some generic pattern, and yaml-language-server will then try to validate this file against that schema. My editor is then filled with validation errors and bogus autocomplete suggestions.
I wish I could use the modeline to declare that this file is without a schema.
# Some ideas:
# yaml-language-server: $schema=none
# yaml-language-server: disable
# yaml-language-server: schemaless
I already tried the following, none of which worked:
# yaml-language-server: $schema=/dev/null
# yaml-language-server: $schema=null
# yaml-language-server: $schema=undefined
# yaml-language-server: $schema=
One possible solution is to disable schema store yaml.schemaStore.enable in vscode settings for vscode-yaml.
Maybe. It won't help me as I'm not using VS Code. And from the description it sounds like it's a global setting, which wouldn't help if this was just an exceptional case in a sea of files where everything works like expected. :-)
Great that you can give people with VS Code a workaround to get back to work at least! 👍
@Mange it is setting for yaml language server, not sure what IDE/Editor you are using, but it should support passing preferences for language servers.
I use VSCode, but it would be nice to be able to disable the schema validation inline...
I'd love to be able to disable validation inline as well - ideally line by line. I just ran into an issue where the schema on schemastore.org was incorrect, and the VS Code extension was flagging an error. I'd like to use a # yaml-language-server: disable-line comment to remove the error until my schemastore.org PR is accepted.
I also wanted to pitch in that a way to disable schemas just for a certain file would be much desired.
A rather convoluted bug results in ansible schemas being applied to unrelated pandoc files., and there is no way of turning the resulting spurious errors off other than disabling schemas globally.