yaml-language-server: [Regression] Cloudformation Support

Originally closed issue in https://github.com/redhat-developer/yaml-language-server/issues/20 but it looks like Cloudformation support is no longer present.

image

This is with the following tags:

...
    "yaml.customTags": [
        "!Ref",
        "!GetAtt",
        "!FindInMap sequence",
        "!FindInMap scalar",
        "!GetAtt",
        "!GetAZs",
        "!Cidr",
        "!ImportValue",
        "!Join sequence",
        "!Select",
        "!Split",
        "!Sub sequence",
        "!Sub scalar",
        "!And",
        "!Equals",
        "!If",
        "!Not",
        "!Or"
    ]

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 22
  • Comments: 23 (5 by maintainers)

Most upvoted comments

This is the full set of required configurations (worked for me):

{
    "window.zoomLevel": 0,
    "workbench.colorTheme": "Material Theme Darker",
    "yaml.customTags": [
        "!And scalar",
        "!And mapping",
        "!And sequence",                
        "!If scalar",
        "!If mapping",
        "!If sequence",                
        "!Not scalar",
        "!Not mapping",
        "!Not sequence",                
        "!Equals scalar",
        "!Equals mapping",
        "!Equals sequence",                
        "!Or scalar",
        "!Or mapping",
        "!Or sequence",                
        "!FindInMap scalar",
        "!FindInMap mappping",        
        "!FindInMap sequence",
        "!Base64 scalar",
        "!Base64 mapping",
        "!Base64 sequence",                
        "!Cidr scalar",
        "!Cidr mapping",
        "!Cidr sequence",                
        "!Ref scalar",
        "!Ref mapping",
        "!Ref sequence",                
        "!Sub scalar",
        "!Sub mapping",
        "!Sub sequence",                
        "!GetAtt scalar",
        "!GetAtt mapping",
        "!GetAtt sequence",                
        "!GetAZs scalar",
        "!GetAZs mapping",
        "!GetAZs sequence",                
        "!ImportValue scalar",
        "!ImportValue mapping",
        "!ImportValue sequence",                
        "!Select scalar",
        "!Select mapping",
        "!Select sequence",
        "!Split scalar",
        "!Split mapping",
        "!Split sequence",                
        "!Join scalar",
        "!Join mapping",
        "!Join sequence"                
    ],
    "yaml.format.enable": true,
}

Hi everyone! Its been a long time coming but I’ve finally got custom tags working when you have a tag with multiple different types. That means in the next version you’re able to do:

"yaml.customTags": [
        "!myTag1 scalar",
        "!myTag1 mapping",
        "!myTag1 sequence",
    ]

and the document will report no errors if you have something like:

test: !myTag1 hello_world

test2: !myTag1
  hello: world

test3: !myTag1
  - hello: world

Replacing "!Equals", with "!Equals sequence", in the settings worked for me for this

This works for me, but if you are using scalar types with those you will have issues

    "yaml.customTags": [
        "!fn",
        "!And",
        "!If",
        "!Not",
        "!Equals",
        "!Or",
        "!FindInMap sequence",
        "!Base64",
        "!Cidr",
        "!Ref",
        "!Sub",
        "!GetAtt",
        "!GetAZs",
        "!ImportValue",
        "!Select",
        "!Split",
        "!Join sequence"
    ]

I ended up using this one so far…

"yaml.customTags": [
        "!fn",
        "!And",
        "!If",
        "!Not",
        "!Equals",
        "!Or",
        "!FindInMap sequence",
        "!Base64",
        "!Cidr",
        "!Ref",
        "!Sub",
        "!GetAtt",
        "!GetAZs",
        "!ImportValue",
        "!Select",
        "!Split",
        "!Join sequence",
        "!Select sequence"
    ]

The CloudFormation extension has added support to do this configuration automatically. https://github.com/awslabs/aws-cfn-lint-visual-studio-code/pull/65

none of the customTags options work when you mix and max sequence and scalar. it only uses the first one and doesn’t allow for the alternative option. so far the only way to go is "yaml.validate": false.

It appears that after added “!If sequence” to the list of custom tags, I need to restart my editor and it will work.

Not currently. Would you like to contribute one? I can show you where to get started.

It also triggers follow on errors like missed comma between flow collection entries but that seems to be a knock on effect of the previous