Skip to content

Commit

Permalink
Allow for unindented comment after node props (#242)
Browse files Browse the repository at this point in the history
  • Loading branch information
eemeli committed Mar 13, 2021
1 parent 8ef0157 commit 7c0e083
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/cst/ParseContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ export class ParseContext {
const noIndicatorAsIndent =
parent.type === Type.SEQ_ITEM && parent.context.atLineStart
if (
src[inEnd] !== '#' &&
!Node.nextNodeIsIndented(src[inEnd], indentDiff, !noIndicatorAsIndent)
)
break
Expand Down
14 changes: 14 additions & 0 deletions tests/doc/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,20 @@ key1: &default
# This key ...
subkey1: value1
key2:
<<: *default\n`
expect(YAML.parse(src, { merge: true })).toMatchObject({
key1: { subkey1: 'value1' },
key2: { subkey1: 'value1' }
})
})

test('reported 3', () => {
const src = `
key1: &default
# This key ...
subkey1: value1
key2:
<<: *default\n`
expect(YAML.parse(src, { merge: true })).toMatchObject({
Expand Down

0 comments on commit 7c0e083

Please sign in to comment.