cfn-lint-visual-studio-code icon indicating copy to clipboard operation
cfn-lint-visual-studio-code copied to clipboard

More intelligent handling of yaml.validateUsingJsonSchema configuration

Open ralish opened this issue 2 years ago • 1 comments

The cfnLint.validateUsingJsonSchema setting is disabled by default (false). If the default is used, either by not defining the setting in the VS Code configuration or explicitly setting it to false, then on the extension being activated the yaml.validate setting will be set to false in the user's VS Code global configuration. This has several problems:

  1. Setting yaml.validate to false will disable validation for all YAML documents, not just those which are CloudFormation templates. This makes the cfnLint.validateUsingJsonSchema misleading, as it's really enabling/disabling YAML validation globally.
  2. This behaviour makes it effectively impossible to use the extension in a workspace which contains CloudFormation templates to be linted (with validation disabled) alongside other YAML documents for which validation should be enabled.

In addition, if cfnLint.validateUsingJsonSchema is enabled, the previously configured yaml.validate setting will not be set to true. That's broadly the correct behaviour w.r.t. not modifying user settings unexpectedly, but it does mean that the extension effectively "breaks" YAML validation by default, requiring additional steps to enable it again alongside validation for CloudFormation templates.

ralish avatar Jan 24 '22 23:01 ralish

Agreed. I'm working on a better way to integrate into the YAML Language server that I believe will resolve this.

kddejong avatar Jul 28 '22 17:07 kddejong

In the newest version we no longer depend on vscode-yaml extension. We have instead integrated yaml-language-server into the service side of this plugin. This should resolve this issue. Please let me know if you are continuing to have issues.

kddejong avatar Aug 17 '22 15:08 kddejong

Great work, thanks @kddejong.

ralish avatar Aug 29 '22 21:08 ralish