Skip to content

Commit

Permalink
fix: Allow top level headings without a child
Browse files Browse the repository at this point in the history
  • Loading branch information
sgryjp authored and trond-snekvik committed Apr 15, 2023
1 parent 9185320 commit 2ddf703
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ class RstSectionProvider implements vscode.DocumentSymbolProvider {
}
}

stack[stack.length - 1].children.push(section);
if (stack.length === 0) {
roots.push(section);
} else {
stack[stack.length - 1].children.push(section);
}
} else {
roots.push(section);
hierarchy.push(section.type);
Expand Down

0 comments on commit 2ddf703

Please sign in to comment.