mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-03-28 17:42:40 +01:00
#247 - Fix front matter highlighting
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
|
||||
### 🐞 Fixes
|
||||
|
||||
- [#247](https://github.com/estruyf/vscode-front-matter/issues/247): Fix the front matter highlighting in markdown documents
|
||||
|
||||
## [6.0.0] - 2022-01-25 - [Release Notes](https://beta.frontmatter.codes/updates/v6.0.0)
|
||||
|
||||
|
||||
@@ -15,10 +15,6 @@ export class MarkdownFoldingProvider implements FoldingRangeProvider {
|
||||
|
||||
const range = MarkdownFoldingProvider.getFrontMatterRange(document);
|
||||
if (range) {
|
||||
MarkdownFoldingProvider.start = null;
|
||||
MarkdownFoldingProvider.end = null;
|
||||
MarkdownFoldingProvider.endLine = null;
|
||||
|
||||
MarkdownFoldingProvider.triggerHighlighting();
|
||||
|
||||
ranges.push(new FoldingRange(range.start.line, range.end.line, FoldingRangeKind.Region));
|
||||
@@ -65,16 +61,24 @@ export class MarkdownFoldingProvider implements FoldingRangeProvider {
|
||||
let start = null;
|
||||
let end = null;
|
||||
let endLine = null;
|
||||
|
||||
MarkdownFoldingProvider.start = null;
|
||||
MarkdownFoldingProvider.end = null;
|
||||
MarkdownFoldingProvider.endLine = null;
|
||||
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
const line = lines[i];
|
||||
if (line.startsWith(lineStart) || line.startsWith(lineEnd)) {
|
||||
if (i === 0 && start === null) {
|
||||
start = i;
|
||||
MarkdownFoldingProvider.start = start;
|
||||
} else if (start !== null && end === null) {
|
||||
end = i;
|
||||
endLine = line.length;
|
||||
|
||||
MarkdownFoldingProvider.end = end;
|
||||
MarkdownFoldingProvider.endLine = endLine;
|
||||
|
||||
MarkdownFoldingProvider.triggerHighlighting();
|
||||
|
||||
return new Range(new Position(start, 0), new Position(end, endLine));
|
||||
|
||||
Reference in New Issue
Block a user