Open lesley-tw opened 5 years ago
We do look for yaml and json files. From there we try to determine if they are a CloudFormation template.
Let me test a few things here. I think I can give you a more definitive solution.
The quick fix on an individual file is to switch the language of the file.
https://code.visualstudio.com/docs/languages/overview#_changing-the-language-for-the-selected-file
You can more permanently make that change by following this. https://code.visualstudio.com/docs/languages/overview#_can-i-map-additional-file-extensions-to-a-language
@cmmeyer Not sure how far down this we should go. There is absolutely a contingent of .template folks. I'm not sure we could more globally enable .template as a CloudFormation template that we would then lint. I may have to see if there are some easier options for this. These workarounds above should provide a solution until we can discuss this more.
I certainly have .template
files on my laptop as well, but I've always expected I would have to tell my IDE what the actual contents were (YAML/JSON). CloudFormation isn't the only software that uses templates, and I'd hate to muck things up for folks who use ".template" to mean something else.
@kddejong Thank you for the comment. It can work now.
Can we just expose the file mappings as a configuration option? Leave the defaults alone but allow overrides?
@rjlohan possibly. We could change this to *. https://github.com/awslabs/aws-cfn-lint-visual-studio-code/blob/master/package.json#L19-L22
I think the problem is the .template doesn't associate with a language (unless someone installed a language plugin). We could add the ability to associate to an extension but I would have to look into this... I'm just not sure off the top of my head. The good thing is cfn-lint
doesn't care about json or yaml.
We could better document this fix as well.
"files.associations": {
"*.template": "yaml"
}
I have several *.template file, and all file begin with
AWSTemplateFormatVersion: '2010-09-09'
at first line, but I cannot get any lint on the file.When I click other .yml file, it will output
Don't believe this is a CloudFormation template.
, it correct, because it really not a cloudformation template, but when I click the cloudformation template .template file, it doesn't have any output messages.Anyone could help? Should I modify any config?