Skip to content

Commit 7c0e083

Browse files
committed
Allow for unindented comment after node props (#242)
1 parent 8ef0157 commit 7c0e083

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/cst/ParseContext.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ export class ParseContext {
135135
const noIndicatorAsIndent =
136136
parent.type === Type.SEQ_ITEM && parent.context.atLineStart
137137
if (
138+
src[inEnd] !== '#' &&
138139
!Node.nextNodeIsIndented(src[inEnd], indentDiff, !noIndicatorAsIndent)
139140
)
140141
break

tests/doc/parse.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,20 @@ key1: &default
488488
# This key ...
489489
subkey1: value1
490490
491+
key2:
492+
<<: *default\n`
493+
expect(YAML.parse(src, { merge: true })).toMatchObject({
494+
key1: { subkey1: 'value1' },
495+
key2: { subkey1: 'value1' }
496+
})
497+
})
498+
499+
test('reported 3', () => {
500+
const src = `
501+
key1: &default
502+
# This key ...
503+
subkey1: value1
504+
491505
key2:
492506
<<: *default\n`
493507
expect(YAML.parse(src, { merge: true })).toMatchObject({

0 commit comments

Comments
 (0)