Open sgtoj opened 4 years ago
I think the appropriate thing to do here, for now. Is to allow a person to configure if the YAML completion is enabled or disabled.
I'm trying to figure out a clever way to enable/disable as needed but it may be messy.
It would be useful to exclude specific patterns as well. In my case, I use Serverless Framework to do deploys, and rely on this VSCode plugin + cfn-python-lint to do validation of the yml resources. This works reasonably well, except that the plugin tries to be smart and runs linting on the autogenerated .serverless/*.json files, which contains a json file that's not a CloudFormation template but seems to be picked as such.
A simple way to ignore a path via e.g. plugin settings would be great for my use case. A better way is for the plugin to take into account the .cfnlintrc that I have defined in the workspace root, in the same way as the cfn-lint command does when I run it there. This also addresses the use case mentioned in the top comment.
Thoughts?
+1
Just ran into this issue today as well working with serverless-state.json
files
I ran into this today with it picking up my local package.json
(an exceptionally common Node config file - I shouldn't need to explain its significance), and its attempt to format the file ended up breaking it.
I decided to simply disable format on paste for JSON files specifically, as this isn't the only formatter that's given me grief with files of that format.
@dead-claudia as far as I'm aware, the cfn-lint
extension does not currently format any files, any chance another extension is causing that formatting on paste?
@sgtoj the current version of the plugin will only validate against CloudFormation templates. It no longer overrides the settings of redhat.vscode-yaml
@dead-claudia I will look into it. You can set cfnLint.format.enable
so it doesn't format.
@kddejong I normally use YAML exclusively for CFN configs anyways, so it wasn't all that painful to just disable.
@PatMyron Nothing else shows up in my list of JSON formatters when I ran "Format document with...", and it's extremely unlikely this is being caused by any other extension.
Looking into better logic on the formatting functionality now.
Agreed let me see what it would look like to add some file pattern matching
Can a setting be added to use cfn-lint extension to lint specific GLOB patterns? I would like to set
yaml.validate
VS Code setting toenable
for non-CloudFormation templates.