Skip to content

Commit 0c36095

Browse files
authored
Merge pull request #76 from joshua-dean/fix/trailing-endregion
Handle trailing endregion
2 parents 3741355 + 855f895 commit 0c36095

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/common.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,15 @@ export class SymbolNode {
113113
const docSymbol = docSymbols[i];
114114
for (let j = i + 1; j < docSymbols.length; j++) {
115115
const sibling = docSymbols[j];
116-
if (docSymbol.range.contains(sibling.range)) {
116+
// The second clause handles the case when the sibling is a region,
117+
// so the "endregion" might not be contained by the docSymbol.range
118+
if (
119+
docSymbol.range.contains(sibling.range) ||
120+
(
121+
docSymbol.range.contains(sibling.range.start) &&
122+
sibling.detail === "__om_Region__"
123+
)
124+
) {
117125
docSymbol.children.push(sibling);
118126
docSymbols.splice(j, 1);
119127
j--;

0 commit comments

Comments
 (0)