I’m using Visual Studio 2022 (Not VS Code). When editing AWS CloudFormation templates in the yaml format, Visual Studio highlights the intrinsic functions like !Ref
and !Sub
as syntax errors. In the list of errors, the message given is Unresolved tag:!Sub
. I have already installed the AWS Toolkit for Visual Studio and it does provide Intellisense suggestions when editing the yaml file, but still flags the intrinsic functions as errors. All the solutions I can find for this problem only apply to VS Code, or to templates in the JSON format.
I have also tried adding the comment at the top of the file with the schema information.
# yaml-language-server: $schema=https://raw.githubusercontent.com/awslabs/goformation/master/schema/cloudformation.schema.json
.
This gives some recommendations for missing properties but still flags !Ref
, !Sub
, etc. as syntax errors.
Does anybody know how to configure Visual Studio 2022 so it recognizes the CloudFormation intrinsic functions and does not flag them as errors?
2
Answers
I think you need to configure the
!Ref
as yaml custom tag in your VSsettings.json
for it to avoid showing the error messageIn your vscode settings.json: