vscode-yaml: Custom tags not working
I have trouble getting the custom tags working. This are my user settings:
cat ~/.config/Code/User/settings.json
{
"workbench.editor.enablePreview": false,
"workbench.editor.enablePreviewFromQuickOpen": false,
"yaml.customTags": [ "!rampPerSec", "!constantPerSec"]
}
and this is the yaml that fails to be parsed:
foo:
- !constantPerSec bar: gee
VSCode version: 1.28.2 YAML Support by Red Hat version: 0.1.0 possibly conflicting plugin? Ansible 0.5.2 (extension association is to YAML, not ansible, though).
I’ll be grateful for any hints. I’ve tried restarting VSCode couple of times, or placing the yaml.customTags
to workspace settings instead but it did not help. Removing exclamation marks didn’t help either. Thank you.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 15 (6 by maintainers)
Commits related to this issue
- Update instructions for custom tags that have sequences See https://github.com/redhat-developer/vscode-yaml/issues/137 for reference — committed to oogetyboogety/cloudformation-template-schema by oogetyboogety 3 years ago
- Update instructions for custom tags that have sequences (#57) See https://github.com/redhat-developer/vscode-yaml/issues/137 for reference Co-authored-by: Kevin DeJong <kddejong@amazon.com> — committed to aws-cloudformation/cloudformation-template-schema by oogetyboogety 2 years ago
I’m was getting a similar problem (Cloudformation yaml tags were causing unknown tag errors), I managed to ‘fix’ it by:
For reference my versions are:
VSCode: 1.30.2 YAML extension: 0.2.1
Here’s my yaml.customTags:
"yaml.customTags": [ "!And sequence", "!Equals sequence", "!If sequence", "!Not sequence", "!Or sequence", "!Base64", "!Cidr sequence", "!FindInMap sequence", "!GetAtt", "!GetAZs", "!ImportValue", "!Join sequence", "!Select sequence", "!Split sequence", "!Sub", "!Ref" ]
I have also tried @AndyJPhillips method above and am not able to get custom tags to work after disabling all extensions and re-enabling just the YAML extension.
I have tried removing all custom tags and just trying one at a time. None are working. I am trying to get the Cloudformation (!Ref, !Sub, etc) custom tags to work.
I’ve tried with just !Ref, !Sub. I’ve tried !Sub scalar, !Sub sequence, !Sub mapping. Nothing.
EDIT: So apparently not only does the Ansible extension break customTags, also the Cloud Code extension breaks it.
If you copy your “yaml.customTags” in settings and add the same to “cloudcode.yaml.customTags”, this fixes it.
Also with the Ansible extension enabled, if you set “ansible.validation”: false the customTags will still work as well.
Or to rephrase this bug is caused by https://github.com/adamvoss/vscode-yaml/issues/16 extension which hijacks yaml customTagsconfig and overrides it for all YAML files, not only for Ansible ones, breaking a huge number of YAML tools.
I posted another workaround at https://github.com/VSChina/vscode-ansible/issues/230#issuecomment-561281378.
Same problem here. Looks like Ansible extension breaks YAML custom tags functionality.