vscode-yaml icon indicating copy to clipboard operation
vscode-yaml copied to clipboard

Add capability to ignore schema errors

Open derrike opened this issue 2 years ago • 1 comments

Is your enhancement related to a problem? Please describe.

When using certain yaml files with underlying schemas, there are times where a syntax error is shown that the user would like to ignore. The syntax error may be a false positive and not a true problem, but still shows as an error in VSCode. Currently, there is no way to workaround this other than to disable the schema on the entire file using a blank schema (please correct me if I'm wrong here).

The syntax errors are presented as red underlines in the file. Also, the "problematic" yaml file is highlighted red and shows the syntax error count next to it. This is frustrating because this is valid syntax and I know it is not an error, so I would like to ignore it. This is shown in the screenshot below:

image

Describe the solution you would like

I would like to be able to ignore specific schema errors with an inline comment. For example, if I put a comment on the line, the language server recognizes it and ignores the specific schema error on that line. An example would be like the screenshot below:

image

If the # ignore comment is found, the red underline would go away and there would be no error here.

Describe alternatives you have considered

Other alternatives:

A yaml. settings entry in VSCode settings file that would include a specific string matcher that ignore schema errors. For example, something like this:

{
    "yaml.schemaStore.ignore": [
        "!reference"
    ]
}

Additional Context

While this problem could be addressed by the maintainers of a specific schema, that is usually a slow process. Adding this feature would empower users to ignore syntax issues that don't apply to them and move faster.

Thanks for your consideration!

derrike avatar Sep 29 '23 14:09 derrike

This seems like the same as https://github.com/redhat-developer/vscode-yaml/issues/666, I'd like to see this feature as well!

this-fifo avatar Oct 03 '23 20:10 this-fifo