Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Regression] Cloudformation Support #77

Closed
17twenty opened this issue Jul 19, 2018 · 23 comments
Closed

[Regression] Cloudformation Support #77

17twenty opened this issue Jul 19, 2018 · 23 comments
Labels
Milestone

Comments

@17twenty
Copy link

Originally closed issue in #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"
    ]
@JPinkney
Copy link
Contributor

What are the errors?

@17twenty
Copy link
Author

unacceptable node kind for !<!FindInMap> tag; it should be "scalar", not "sequence"

@17twenty
Copy link
Author

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

@JPinkney
Copy link
Contributor

It looks like instead of checking if the !FindInMap contains either scalar or sequence its looking like it is instead throwing an error when one one is found but not the other.

@JPinkney JPinkney added the bug label Jul 21, 2018
@17twenty
Copy link
Author

The sample above is from the AWS codepipeline tutorial here https://s3.amazonaws.com/cloudformation-examples/user-guide/continuous-deployment/wordpress-single-instance.zip

Hope that helps!

@dessite
Copy link

dessite commented Oct 15, 2018

Any luck with fixing?
I have error

unknown tag <!Ref>

despite having

"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"
    ]

@str3tch
Copy link

str3tch commented Oct 16, 2018

I have similar error for !Join:

unacceptable node kind for !<!Join> tag; it should be "scalar", not "sequence"

@farmerbean
Copy link

I had this issue too. Custom tags setup in user.settings, etc.

Removed cloudformation plugin
Removed rhel yaml plugin

Added in cloudformation plugin
(cloudformation plugin installed rhel yaml dependency)

Problem now (temporarily I assume!) resolved.

@wgroenewald
Copy link

Still not working for me. This is the contents of my settings.json:
{ "workbench.startupEditor": "newUntitledFile", "git.enableSmartCommit": true, "window.zoomLevel": 0, "files.associations": {}, "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"] }

Still get the error, unknown tag <!Equals>

Anyone have any luck resolving yet?
Tried reinstalling Cloudformation and YAML for RHEL plugin, no luck

@deepu105
Copy link

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"
    ]

@sgtoj
Copy link

sgtoj commented Nov 15, 2018

I resolved a similar issue by renaming my template to end with yaml extension. Same file throws errors with yml extension.

@dan-petty
Copy link

Is there a fix in the works for this? Have to disable validation make the editor usable:
"yaml.validate": false

@JPinkney
Copy link
Contributor

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

@dan-petty
Copy link

I'm not familiar with vscode extensions but I can take a look...

@JPinkney
Copy link
Contributor

I believe the problem stems from: https://github.com/redhat-developer/yaml-language-server/blob/master/src/languageservice/parser/yamlParser.ts#L256 where we use the custom tags and put them into the yaml-ast-parser.

@tanduong
Copy link

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

@mandersondesign
Copy link

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"
    ]

@strannik19
Copy link

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.

@zoellner
Copy link

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

@JPinkney
Copy link
Contributor

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

@Splike
Copy link

Splike commented Apr 4, 2019

@JPinkney That's pretty cool! If I just have

"yaml.customTags": [
        "!myTag1"
    ]

I think it would make sense that scalar, mapping and sequence should all be accepted for !myTag1

@lorcanoeire
Copy link

lorcanoeire commented Jul 16, 2019

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,
}

@benkehoe
Copy link

The CloudFormation extension has added support to do this configuration automatically. aws-cloudformation/cfn-lint-visual-studio-code#65

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests