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

Incorrectly classifies !Ref and !GetAtt as an unknown tag in serverless #93

Open
2 tasks
Ankcorn opened this issue Jul 14, 2020 · 7 comments
Open
2 tasks
Assignees

Comments

@Ankcorn
Copy link

Ankcorn commented Jul 14, 2020

  • I'm submitting a ...

    • ✅ bug report
    • feature request
    • support request => Please do not submit support request here, see note at the top of this template.
  • What is the current behavior?

This tool incorrectly classifies !Ref and !GetAtt as an unknown tag in serverless

image

  • If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via
    https://github.com/Ankcorn/serverless-fullstack-example-app
    You can test this yml is acceptable by deploying this stack

  • What is the expected behavior?
    Serverless IDE allows !Ref and !GetAtt where the target is a Resource

  • What is the motivation/use case for changing the behavior?

More concise and easy to type yml files

  • Please tell us about your environment:

    • Plugin version
      0.5.24
    • VSCode version
      1.4.7
    • Template type
      Serverless Framework
@BrutalSimplicity
Copy link
Contributor

I think you can fix this by adding the intrinsic AWS functions as supported tags for yaml. It's not the cleanest solution as these tags will always show up in your intellisense regardless of what type of yaml file your editing, but it does get rid of the error given by the extension.

https://marketplace.visualstudio.com/items?itemName=aws-scripting-guy.cform

After installation, open your User Settings (Ctrl + ,) and paste preferences below into your settings file.

Note: This will whitelist CloudFormation intrinsic functions tags. Otherwise you will end up with Unknown Tag showing up in your YAML document.

    // Custom tags for the parser to use
    "yaml.customTags": [
        "!And",
        "!If",
        "!Not",
        "!Equals",
        "!Or",
        "!FindInMap sequence",
        "!Base64",
        "!Cidr",
        "!Ref",
        "!Sub",
        "!GetAtt",
        "!GetAZs",
        "!ImportValue",
        "!Select",
        "!Select sequence",
        "!Split",
        "!Join sequence"
    ],
    // Enable/disable default YAML formatter (requires restart)
    "yaml.format.enable": true,

@pavelvlasov
Copy link
Contributor

Thanks for reporting @Ankcorn! As @BrutalSimplicity mentioned, it's an issue with vscode yaml plugin. The solution above should solve the problem.

@Ankcorn
Copy link
Author

Ankcorn commented Jul 25, 2020

It works thanks both of you

@Swaps76
Copy link

Swaps76 commented Jul 30, 2021

Hi, I can't see where to past into the file - I click cmd +, to get to preferences, and then I have the following screen;
image
but I can't see where to edit the 'user settings file'. Is this the default settings file or vs code settings file? I can only toggle settings in here rather than edit files. Thanks.

@outspokeio
Copy link

@Swaps76 Here's where it is on my machine:
c:/Users/{name}/AppData/Roaming/Code/User/settings.json

@mo-martinwilson
Copy link

mo-martinwilson commented Jan 13, 2023

I think you can fix this by adding the intrinsic AWS functions as supported tags for yaml. It's not the cleanest solution as these tags will always show up in your intellisense regardless of what type of yaml file your editing, but it does get rid of the error given by the extension.

https://marketplace.visualstudio.com/items?itemName=aws-scripting-guy.cform

After installation, open your User Settings (Ctrl + ,) and paste preferences below into your settings file.

Note: This will whitelist CloudFormation intrinsic functions tags. Otherwise you will end up with Unknown Tag showing up in your YAML document.

    // Custom tags for the parser to use
    "yaml.customTags": [
        "!And",
        "!If",
        "!Not",
        "!Equals",
        "!Or",
        "!FindInMap sequence",
        "!Base64",
        "!Cidr",
        "!Ref",
        "!Sub",
        "!GetAtt",
        "!GetAZs",
        "!ImportValue",
        "!Select",
        "!Select sequence",
        "!Split",
        "!Join sequence"
    ],
    // Enable/disable default YAML formatter (requires restart)
    "yaml.format.enable": true,

Tha's great — thanks. The only thing I needed to change was to append sequence to !If, i.e. !If sequence

@joshuakcockrell
Copy link

I was encountering this error with the "!GetAtt" command, even after adding the yaml.customTags settings.

Screenshot 2023-03-07 at 9 37 50 PM

@mo-martinwilson suggestion fixed it for me.
Solution: change the line to: "!GetAtt sequence"

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

No branches or pull requests

7 participants