Skip to content

Commit

Permalink
fix: handle tag indenting properly with diagnostic output
Browse files Browse the repository at this point in the history
  • Loading branch information
rvagg committed May 28, 2021
1 parent 0846f50 commit 5312923
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion lib/diagnostic.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,21 @@ function * tokensToDiagnostic (inp, width = 100) {
}

if (!token.type.terminal) {
indent.push(token.type.name === 'map' ? token.value * 2 : token.value)
switch (token.type.name) {
case 'map':
indent.push(token.value * 2)
break
case 'array':
indent.push(token.value)
break
// TODO: test tags .. somehow
/* c8 ignore next 5 */
case 'tag':
indent.push(1)
break
default:
throw new Error(`Unknown token type '${token.type.name}'`)
}
} else {
if (indent.length) {
indent[indent.length - 1]--
Expand Down

0 comments on commit 5312923

Please sign in to comment.