Giter VIP home page Giter VIP logo

Comments (23)

lorcanoeire avatar lorcanoeire commented on May 28, 2024 64

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

from yaml-language-server.

JPinkney avatar JPinkney commented on May 28, 2024 27

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

from yaml-language-server.

zoellner avatar zoellner commented on May 28, 2024 13

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

from yaml-language-server.

deepu105 avatar deepu105 commented on May 28, 2024 11

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

from yaml-language-server.

mandersondesign avatar mandersondesign commented on May 28, 2024 10

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

from yaml-language-server.

17twenty avatar 17twenty commented on May 28, 2024 1

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

from yaml-language-server.

JPinkney avatar JPinkney commented on May 28, 2024 1

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

from yaml-language-server.

tanduong avatar tanduong commented on May 28, 2024 1

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

from yaml-language-server.

strannik19 avatar strannik19 commented on May 28, 2024 1

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.

from yaml-language-server.

benkehoe avatar benkehoe commented on May 28, 2024 1

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

from yaml-language-server.

JPinkney avatar JPinkney commented on May 28, 2024

What are the errors?

from yaml-language-server.

17twenty avatar 17twenty commented on May 28, 2024
unacceptable node kind for !<!FindInMap> tag; it should be "scalar", not "sequence"

from yaml-language-server.

JPinkney avatar JPinkney commented on May 28, 2024

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.

from yaml-language-server.

17twenty avatar 17twenty commented on May 28, 2024

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!

from yaml-language-server.

dessite avatar dessite commented on May 28, 2024

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

from yaml-language-server.

str3tch avatar str3tch commented on May 28, 2024

I have similar error for !Join:

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

from yaml-language-server.

farmerbean avatar farmerbean commented on May 28, 2024

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.

from yaml-language-server.

wgroenewald avatar wgroenewald commented on May 28, 2024

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

from yaml-language-server.

sgtoj avatar sgtoj commented on May 28, 2024

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

from yaml-language-server.

dan-petty avatar dan-petty commented on May 28, 2024

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

from yaml-language-server.

dan-petty avatar dan-petty commented on May 28, 2024

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

from yaml-language-server.

JPinkney avatar JPinkney commented on May 28, 2024

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.

from yaml-language-server.

Splike avatar Splike commented on May 28, 2024

@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

from yaml-language-server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.