KEY_OVER_1024_CHARS error with large indented blocks of comments
See original GitHub issueDescribe the bug If there’s a large block of comments hanging indented under a key, that can trigger an error suggesting that the next key indicator is too far away.
To Reproduce
const comment = `# Test comment
owners:
# Test comment
business:
- email: great.googly@fortitude.com
name: Moogly
- distributionList: HopsNBops@easterbunny.org
# Another comment, large block of text, large block of text, large block of text
# Another comment, large block of text, large block of text, large block of text
# Another comment, large block of text, large block of text, large block of text
# Another comment, large block of text, large block of text, large block of text
# Another comment, large block of text, large block of text, large block of text
# Large block of text, large block of text, large block of text, large block of text, large block of text,
# large block of text, large block of text, large block of text, large block of text, large block of text,
# large block of text, large block of text, large block of text, large block of text, large block of text,
# large block of text, large block of text, large block of text, large block of text, large block of text,
# large block of text, large block of text, large block of text, large block of text, large block of text,
# large block of text, large block of text, large block of text, large block of text, large block of text,
# large block of text, large block of text, large block of text, large block of text, large block of text,
stage: one
`;
console.log(yaml.parse(comment));
The script produces the error:
YAMLParseError: The : indicator must be at most 1024 chars after the start of an implicit block mapping key at line 22, column 1:
# large block of text, large block of text, large block of text, large block of…
stage: one
^^^^^
Removing the indent from the first block of comments works around the error.
Expected behaviour The text is valid YAML, it should be parsed, no matter how many comments there are or whether they’re indented.
Versions (please complete the following information):
- Environment: Node.js 16.15.1
yaml
: 2.1.1
Issue Analytics
- State:
- Created a year ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Indent comments within blocks · Issue #219 - GitHub
The reason for this is commenting-out blocks of code tends to be a temporary action, where you intend to either delete or uncomment...
Read more >Expected an indent block in comment - Stack Overflow
I faced a weird error, "Expected an indent Block" in a comment out line - #______ICHIMOKU SYSTEM's COMPONENTS_____ center = False = see...
Read more >IndentationError: expected an indented block - LearnDataSci
As the error implies, this occurs after statements that require indenting, such as after if statements, for loops and try except exception handling....
Read more >Can you comment out large blocks of text without having ... - IBM
Problem. I have a series of large syntax jobs in SPSS for Windows. I'd often like to comment out large portions of those...
Read more >comment indentation can break code indentation
The issues with incorrect comment indentation is affecting the indentation of the CODE that follows the comments, too. The attached screen show shows...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There was a bug in updating the offset during composition for empty mapping values with trailing comments. Thank you for reporting this!
Fixed version released as v2.1.2.
Closing as presumably fixed.