Yaml dict keys with ":" parsed incorrectly #1735
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Escaping of dict key don't work
Parsing stops at first found
:Could you point me at the documentation that describes the expected behavior here? (I can't reach the person who actually wrote the Yaml mode, and I've never used Yaml in my life.)
Here is official gude to basic "Mappings" markup ways.
It says that Mapping key even not have to be escaped, just inserting space after it
So even this example should be valid.
Also mappings have JSON-like "flow" format, but have no clarifications about space-folowed keys.
This example will raise parse error if we remove quotes from key.
Therefore, it can still rely on exact JSON parsing algoritm (where quoting of keys is always required).
Could you try with the attached patch?
Just tried, thanks :)
This case
parsed correctly now 👌
But flow formats behaves differently:
is highlights
ga:metricsas key. Expected intuitively, but broken on parser example.If flow-map is sub-item of global document, it's keys became unhighlighted:
subkeyis plain text colored in Codemirror, but expected to be colored as key. 😕Right. The YAML mode was contributed by someone else, and doesn't seem prepared to these kind of subtleties. I am personally not motivated to improve or rewrite it, but such a pull request would be very welcome.
okay, thanks. Maybe make sense to rewrite this mode or use existing parsing solutions like https://github.com/nodeca/js-yaml package.
BTW, it also uses Codemirror as demo editor engine.