You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Node range overlaps in some cases.
For example one node has range [0, 22, 22] and next node has [22, 42, 42] offsets, which is impossible one char cannot belongs to two different nodes.
To Reproduce
Run this test:
test('Range',()=>{consttext=`scripts: node1: test node2: testauthors: - name:Foo - email: bar`constcomposer=newComposer();constparser=newParser();consttokens=parser.parse(text);constdocs=composer.compose(tokens);constdoc=Array.from(docs)[0];expect(((doc.contentsasYAMLMap).get('scripts')asYAMLMap).range).toEqual([11,37,37]);expect((findPair((doc.contentsasYAMLMap).items,'authors')?.keyasNode).range).toEqual([38,44,44]);})
thous test fail as key authors has range [37, 44, 44] but scripts map ends on 37th character. It seems that key authors starts with \n on previous line.
Expected behaviour
Nodes range should not overlap.
Versions (please complete the following information):
Environment: Node.js 12
yaml: 2.0.0-5
The text was updated successfully, but these errors were encountered:
Hm, OK, can you update jsdoc for ranges, and explain what that numbers mean?
I mean that value-end,node-end should be treated as indexEnd param for substring method.
Describe the bug
Node range overlaps in some cases.
For example one node has range
[0, 22, 22]
and next node has[22, 42, 42]
offsets, which is impossible one char cannot belongs to two different nodes.To Reproduce
Run this test:
thous test fail as key
authors
has range[37, 44, 44]
butscripts
map ends on37
th character. It seems that keyauthors
starts with\n
on previous line.Expected behaviour
Nodes range should not overlap.
Versions (please complete the following information):
yaml
: 2.0.0-5The text was updated successfully, but these errors were encountered: