Vscode-yaml: yaml.customTags not working in 0.17.0

Created on 26 Mar 2021  路  7Comments  路  Source: redhat-developer/vscode-yaml

Describe the bug

After updating from 0.16.0 to 0.17.0 all custom tags result in errors like:
unknown tag <!GetAtt>YAML

Expected Behavior

Custom tags continue to work

Current Behavior

Use of custom tags in YAML result in error.

Steps to Reproduce

When using the settings:

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

And in YAML typing, eg.
RoleArn: !GetAtt ECSRunTaskAsyncRole.Arn

Results in error:
unknown tag <!GetAtt>YAML

Environment

  • [ ] Windows
  • [x] Mac
  • [ ] Linux
  • [ ] other (please specify)
bug

Most helpful comment

Making a change to a yaml file and then saving caused the file to reset and validation errors resolved.

All 7 comments

@data-ux I cannot reproduce this:
Screenshot 2021-03-26 at 14 20 07

I used yaml.customTags which you provide.

Can you provide more info:

  • Exact yaml.customTags preference, and any other yaml preference.
  • Is there any JSON Schema associated with your yaml file?
  • The content and name of yaml file where you has that error.

I can't reproduce it either. Can you also let us know what yaml related extensions you are using?

I am having the same issue 0.17.0. I uninstalled all extensions that relied on YAML - CloudFormation, Spring Boot Tools, and reinstalled YAML extension. Here are is a list of my remaining extensions:

DavidAnson.vscode-markdownlint
DotJoshJohnson.xml
Equinusocio.vsc-community-material-theme
Equinusocio.vsc-material-theme
equinusocio.vsc-material-theme-icons
GabrielBB.vscode-lombok
hashicorp.terraform
hediet.vscode-drawio
Ikuyadeu.r
James-Yu.latex-workshop
ms-azuretools.vscode-docker
ms-dotnettools.csharp
ms-python.python
ms-toolsai.jupyter
ms-vscode-remote.remote-containers
ms-vscode.atom-keybindings
PKief.material-icon-theme
redhat.java
redhat.vscode-yaml
shd101wyy.markdown-preview-enhanced
streetsidesoftware.code-spell-checker
VisualStudioExptTeam.vscodeintellicode
vscjava.vscode-java-debug
vscjava.vscode-java-dependency
vscjava.vscode-java-pack
vscjava.vscode-java-test
vscjava.vscode-maven
wayou.vscode-todo-highlight
yzhang.markdown-all-in-one

Here is my settings.json file:

{
    "editor.fontSize": 13,
    "terminal.integrated.fontSize": 13,
    "window.zoomLevel": 0,
    "yaml.customTags": [
        "!GetAtt",
        "!Sub",
        "!Ref",
        "!Equals sequence",
        "!FindInMap sequence",
        "!If sequence",
        "!Join sequence",
        "!reference sequence"
    ],
    "markdown-preview-enhanced.previewTheme": "monokai.css",
    "hediet.vscode-drawio.local-storage": "eyIuZHJhd2lvLWNvbmZpZyI6IntcImxhbmd1YWdlXCI6XCJcIixcImN1c3RvbUZvbnRzXCI6W10sXCJsaWJyYXJpZXNcIjpcImdlbmVyYWxcIixcImN1c3RvbUxpYnJhcmllc1wiOltcIkwuc2NyYXRjaHBhZFwiXSxcInBsdWdpbnNcIjpbXSxcInJlY2VudENvbG9yc1wiOltdLFwiZm9ybWF0V2lkdGhcIjpcIjI0MFwiLFwiY3JlYXRlVGFyZ2V0XCI6ZmFsc2UsXCJwYWdlRm9ybWF0XCI6e1wieFwiOjAsXCJ5XCI6MCxcIndpZHRoXCI6ODUwLFwiaGVpZ2h0XCI6MTEwMH0sXCJzZWFyY2hcIjp0cnVlLFwic2hvd1N0YXJ0U2NyZWVuXCI6dHJ1ZSxcImdyaWRDb2xvclwiOlwiI2QwZDBkMFwiLFwiZGFya0dyaWRDb2xvclwiOlwiIzZlNmU2ZVwiLFwiYXV0b3NhdmVcIjp0cnVlLFwicmVzaXplSW1hZ2VzXCI6bnVsbCxcIm9wZW5Db3VudGVyXCI6MCxcInZlcnNpb25cIjoxOCxcInVuaXRcIjoxLFwiaXNSdWxlck9uXCI6ZmFsc2UsXCJ1aVwiOlwiXCJ9In0=",
    "terminal.integrated.shell.osx": "/bin/zsh",
    "files.exclude": {
        "**/.classpath": true,
        "**/.project": true,
        "**/.settings": true,
        "**/.factorypath": true
    },
    "editor.suggestSelection": "first",
    "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
    "java.configuration.runtimes": [
        {
            "name": "JavaSE-1.8",
            "path": "/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home",
            "default": true
        }
    ],
    "java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx1G -Xms100m -javaagent:\"/Users/chace.anderson/.vscode/extensions/gabrielbb.vscode-lombok-1.0.1/server/lombok.jar\"",
    "workbench.colorTheme": "Material Theme Darker High Contrast",
    "latex-workshop.message.update.show": false,
    "editor.codeActionsOnSave": null,
    "editor.semanticTokenColorCustomizations": null,
    "atomKeymap.promptV3Features": true,
    "editor.multiCursorModifier": "ctrlCmd",
    "editor.formatOnPaste": true,
    "workbench.editorAssociations": [
        {
            "viewType": "jupyter.notebook.ipynb",
            "filenamePattern": "*.ipynb"
        }
    ],
    "[yaml]": {
        "editor.insertSpaces": true,
        "editor.tabSize": 2,
        "editor.autoIndent": "keep",
        "editor.quickSuggestions": {
            "other": true,
            "comments": false,
            "strings": true
        }
    }
}

I am also running the extension on MacOS. Anything else I can provide to help resolve?

Making a change to a yaml file and then saving caused the file to reset and validation errors resolved.

Making a change to a yaml file and then saving caused the file to reset and validation errors resolved.

That worked for me. It's like it load the configuration just after the file change and not when it is open.

Is it possible to use contributes: and extend the list of customTags from another extension?

I have a list of tags which are allowed for some Ansible files and I do not want them to be highlighted as unknown by YAML extension.

Ideally these tags should be configured per schema file for which we already have extension points, but even a global approach would suffice for now.

Making a change to a yaml file and then saving caused the file to reset and validation errors resolved.

Same error, same fix here, but I have to make a change and re-save the file every time I reopen vscode.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kace91 picture kace91  路  7Comments

Deilan picture Deilan  路  6Comments

teresaejunior picture teresaejunior  路  4Comments

will-l-h picture will-l-h  路  7Comments

nicholas-devlin picture nicholas-devlin  路  4Comments