mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-23 01:58:53 +01:00
markdown toc should include full span to next header
The folding range should exclude blank lines before the next header level
This commit is contained in:
@@ -65,14 +65,10 @@ export class TableOfContentsProvider {
|
||||
|
||||
// Get full range of section
|
||||
return toc.map((entry, startIndex): TocEntry => {
|
||||
const start = entry.line;
|
||||
let end: number | undefined = undefined;
|
||||
for (let i = startIndex + 1; i < toc.length; ++i) {
|
||||
if (toc[i].level <= entry.level) {
|
||||
end = toc[i].line - 1;
|
||||
if (document.lineAt(end).isEmptyOrWhitespace && end >= start + 1) {
|
||||
end = end - 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user