( issue: ValidationIssue, fm: ParsedFrontmatter )
| 24 | } |
| 25 | |
| 26 | function issueRange( |
| 27 | issue: ValidationIssue, |
| 28 | fm: ParsedFrontmatter |
| 29 | ): vscode.Range { |
| 30 | const field = fm.fields.get(issue.field); |
| 31 | |
| 32 | if (!field) { |
| 33 | // Missing field — highlight the closing `---` line |
| 34 | return new vscode.Range(fm.endLine, 0, fm.endLine, 3); |
| 35 | } |
| 36 | |
| 37 | if (issue.target === "key") { |
| 38 | return toVscodeRange(field.keyRange); |
| 39 | } |
| 40 | |
| 41 | // Default to value range for "value" and "block" targets when field exists |
| 42 | return toVscodeRange(field.valueRange); |
| 43 | } |
| 44 | |
| 45 | function toVscodeRange(range: { |
| 46 | start: { line: number; col: number }; |
no test coverage detected