Open svrx opened 3 years ago
having troubles replicating the issue going to have to do some more work to dig deeper on this one.
I was able to replicate the only issue I have is that CloudFormation yaml doesn't support aliasing.
Directly, indeed it doesn't!
Although there are workarounds to make it work through pre-processing.
Such as described here at https://github.com/aws/serverless-application-model/issues/228, through aws cloudformation package
or even just through simple parse and render script.
I understand your question, as it isn't directly accepted by the API. Maybe a warning should be generated when anchors or references are detected, if this turn out to be supported.
Question that remains is, should an IDE integration inherit constraints of target system and break or rather support the developer and provide advice?
Maybe this extension could catch the errors and handle them in some way instead of passing them on to the vscode-yaml extension? Or replace the node-yaml-parser? I might have a go at a PR, but not making any promises.
Can you set this extension to only run on specified yaml files?
=== Background ===
I'm having the same problem. However, this also happens in non-cloudformation (bitbucket pipeline) yaml files that DOES support aliasing. I have resorted to disabling/enabling this extension depending on the file I'm working on, but that is more effort than just running cfn-lint
manually.
According to https://github.com/redhat-developer/vscode-yaml/issues/425#issuecomment-790685036, they will update to handle errors thrown from contributing extensions, but it doesn't seem like that has been sorted yet.
They also indicate that the error is coming from node-yaml-parser, which doesn't seem to be maintained. Worth replacing with something else?
@sebastian-fredriksson-bernholtz could you share your bitbucket pipeline YAML file? Wondering if it's affected by this PR that recognized more CloudFormation templates: https://github.com/aws-cloudformation/cfn-lint-visual-studio-code/pull/201
It seems like the main issue impacting me is that Cloudformation Linter causes vscode-yaml validation to be turned off. I'm not sure that the error indicated by the error messages mentioned in the ticket is the cause of my problem.
=== More information ===
@PatMyron You can find the file attached. However, after looking at that PR, I checked the output and found that it detects that it isn't a Cloudformation file.
I realised that the "yaml.validate" setting is being set to false when the Cloudformation linter is enabled. If I switch it back to true the validation works, despite vscode-yaml still outputting error messages. But it toggles to false again on reload when I have the cfn linter extension enabled. Knowing this makes it much more convenient for me.
Happy to provide any information that can help debug, if you think something still needs to be changed in this extension. Below is a screenshot with the cfn linter output, a screen recording to show what I'm experiencing, and my bitbucket pipeline file.
Describe the bug
When user anchors or references in CloudFormation YAML files, schemas stops working when anchors/references are used.
Originally chased with
redhat.vscode-yaml
in https://github.com/redhat-developer/vscode-yaml/issues/425, but became clear the issue was being caused by this extension.Since CloudFormation supports anchors and references through the
aws cloudformation package
path, would it make sense to fix the underlying issue?Expected Behavior
It works as normal.
Current Behavior
Following error keeps repeating as elements are hovered.
Steps to Reproduce
Environment