yaml-language-server icon indicating copy to clipboard operation
yaml-language-server copied to clipboard

A way to disable schema loading for a specific file using modeline

Open Mange opened this issue 4 years ago • 7 comments
trafficstars

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=

Mange avatar Apr 21 '21 07:04 Mange

One possible solution is to disable schema store yaml.schemaStore.enable in vscode settings for vscode-yaml.

evidolob avatar May 18 '21 12:05 evidolob

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 avatar May 19 '21 08:05 Mange

@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.

evidolob avatar May 19 '21 08:05 evidolob

I use VSCode, but it would be nice to be able to disable the schema validation inline...

calexandre avatar Sep 28 '21 11:09 calexandre

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.

twelvelabs avatar Oct 15 '22 20:10 twelvelabs

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.

chrisgrieser avatar Apr 24 '23 21:04 chrisgrieser