|
|
@@ -70,11 +70,12 @@ export function getNewDiagnostics(
|
|
|
// // - New error in file3 (1:1)
|
|
|
|
|
|
// will return empty string if no problems with the given severity are found
|
|
|
-export function diagnosticsToProblemsString(
|
|
|
+export async function diagnosticsToProblemsString(
|
|
|
diagnostics: [vscode.Uri, vscode.Diagnostic[]][],
|
|
|
severities: vscode.DiagnosticSeverity[],
|
|
|
cwd: string,
|
|
|
-): string {
|
|
|
+): Promise<string> {
|
|
|
+ const documents = new Map<vscode.Uri, vscode.TextDocument>()
|
|
|
let result = ""
|
|
|
for (const [uri, fileDiagnostics] of diagnostics) {
|
|
|
const problems = fileDiagnostics.filter((d) => severities.includes(d.severity))
|
|
|
@@ -100,7 +101,10 @@ export function diagnosticsToProblemsString(
|
|
|
}
|
|
|
const line = diagnostic.range.start.line + 1 // VSCode lines are 0-indexed
|
|
|
const source = diagnostic.source ? `${diagnostic.source} ` : ""
|
|
|
- result += `\n- [${source}${label}] Line ${line}: ${diagnostic.message}`
|
|
|
+ const document = documents.get(uri) || (await vscode.workspace.openTextDocument(uri))
|
|
|
+ documents.set(uri, document)
|
|
|
+ const lineContent = document.lineAt(diagnostic.range.start.line).text
|
|
|
+ result += `\n- [${source}${label}] ${line} | ${lineContent} : ${diagnostic.message}`
|
|
|
}
|
|
|
}
|
|
|
}
|