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

Custom tags not working #137

Closed
rvansa opened this issue Nov 16, 2018 · 11 comments
Milestone

Comments

@rvansa
Copy link

@rvansa rvansa commented Nov 16, 2018

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.

@JPinkney

This comment has been minimized.

Copy link
Member

@JPinkney JPinkney commented Nov 16, 2018

What errors are you getting?

@rvansa

This comment has been minimized.

Copy link
Author

@rvansa rvansa commented Nov 19, 2018

!con is underlined with unknown tag <!constantPerSec>
: gee is underlined with bad indentation of sequence entry

@JPinkney

This comment has been minimized.

Copy link
Member

@JPinkney JPinkney commented Nov 19, 2018

I think in this case you would technically need to do:

"yaml.customTags": [
"!constantParSec sequence"
]

However it looks like there are quite a few bugs in custom tags right now anyways so that won't work currently. I'm working on a fix

@rvansa

This comment has been minimized.

Copy link
Author

@rvansa rvansa commented Nov 19, 2018

That gets me only halfway: With !constantPerSec sequence the : gee is underlined with
unacceptable node kind for !<!constantPerSec> tag; it should be "sequence", not "scalar"

When I try !constantPerSec scalar, it complains about indentation...

Do you plan to include 'any' type as well? Or will you make sure that the same tag can be applied to multiple types? Thanks.

@JPinkney

This comment has been minimized.

Copy link
Member

@JPinkney JPinkney commented Nov 30, 2018

Currently, there are no plans to include (the code that has the issue doesn't live here it lives in http://github.com/mulesoft-labs/yaml-ast-parser/issues iirc).

Or will you make sure that the same tag can be applied to multiple types? Thanks.

I hope to do this/someone adds this in the future, it would be very useful.

@AndyJPhillips

This comment has been minimized.

Copy link

@AndyJPhillips AndyJPhillips commented Jan 23, 2019

I'm was getting a similar problem (Cloudformation yaml tags were causing unknown tag errors), I managed to 'fix' it by:

  • disabling all dependent VSCode extensions (Ansible etc)
  • disabling the YAML extension
  • re-enable the YAML extension

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

@AndyJPhillips

This comment has been minimized.

Copy link

@AndyJPhillips AndyJPhillips commented Jan 23, 2019

In more news - as soon as I re-enable the Ansible 0.5.2 extension and reload it breaks the yaml custom tags

@efim-a-efim

This comment has been minimized.

Copy link

@efim-a-efim efim-a-efim commented Mar 7, 2019

Same problem here. Looks like Ansible extension breaks YAML custom tags functionality.

@JPinkney JPinkney added this to the 0.4.0 milestone Mar 12, 2019
@JPinkney

This comment has been minimized.

Copy link
Member

@JPinkney JPinkney commented May 28, 2019

The ansible extension uses a fork of this one for some reason 🤷‍♂ and because of that we can't actually stop it from showing the error see: #178 but it looks like the actual issue was fixed so I'm going to close the issue

@JPinkney JPinkney closed this May 28, 2019
@smiller171

This comment has been minimized.

Copy link

@smiller171 smiller171 commented May 28, 2019

I'm not able to get it working even after disabling the Ansible extension unfortunately.

@JPinkney

This comment has been minimized.

Copy link
Member

@JPinkney JPinkney commented May 28, 2019

@smiller171 Can you open a new issue with your custom tags and also a picture whats in the text document (similar to what was posted in the issue) and other extensions installed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.