vscode-yaml
vscode-yaml copied to clipboard
"unidentified alias" not expected
Describe the bug
When using an anchor like this:
foo:
- &name bar
*name:
- baz
Expected Behavior
Syntax is valid, so I expect no error
Ouput via yamllint
---
bar:
- baz
foo:
- bar
Current Behavior

Environment
- [x] Windows
- [ ] Mac
- [ ] Linux
- [ ] other (please specify)
@eemeli This looks like one case where the parser is acting differently. Can you check it?
yamllint is wrong here. Unfortunately, : is a valid alias character, which means that it doesn't get included as a mapping indicator here, but as a part of the alias.
The error is a bit surprising, though. At least with the latest yaml@2, that input ought to result in an error
YAMLParseError: Implicit map keys need to be followed by map values at line 3, column 1:
- &name bar
*name:
^^^^^^
and a warning
YAMLWarning: Alias ending in : is ambiguous at line 3, column 6:
*name:
^
I also see the same 2 errors with the latest release.
@gorkem When testing this manually myself, I see this:

Is there a way for vscode-yaml to also show the warnings produced by yaml?
@eemeli can you check the "Problems" view, if there are more reported?
Just noticed that I was looking at a build from HEAD which lists 2 problems as expected. When I revert to 1.6.0 it shows only a single item.
We have a similar use case for the yaml files we use in puppet. While the YAML extension complains about this problem, the Puppet's engine is able to consume the YAML files as intended without any problem.