YAML lexer treats // as a comment, breaking values that start with //
#1333
walles
started this conversation in
^ Lexer Requests and Bugs
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
Since v2.25.0 the YAML lexer has an unconditional
//.*$→Commentrule, added in #1278 to address #1271.YAML has exactly one comment syntax:
#. Per YAML 1.2.2 §6.6 Comments, "An explicit comment is marked by a#indicator." As a result, any value that begins with//is now highlighted as a comment. This breaks UNC paths and protocol-relative URLs.Values with
//in the middle are unaffected —url: https://example.com/xandregex: "a//b"still highlight correctly. It is specifically values starting with//.I left a comment on #1271 explaining why that issue's premise was incorrect: its sample is not valid YAML, so the rule improves rendering of invalid YAML at the cost of misrendering valid YAML.
To Reproduce
Paste into the Chroma Playground with language YAML:
Expected: only the last line contains a comment.
Actual: lines 1 and 2 have their values highlighted as comments.
🤖 Report written by Claude (Sonnet 5)
All reactions