I used diagnostic Api for finding compilation errors. It works well in debug mode but after creating .VSIX it is not working.
Can Any one help me ?
const diagnostics = vscode.languages.getDiagnostics();
const filteredDiagnostics = diagnostics
.filter(([uri, diagnosticList]) => modifiedFilesTobeChecked.includes(uri.fsPath) && Array.isArray(diagnosticList))//checks only the modified files
.reduce((acc, [uri, diagnosticList]) => {
const errors = diagnosticList.filter(d => d.severity === vscode.DiagnosticSeverity.Error);
errorCount = errors?.length + errorCount;
if (errors.length > 0) {
errorFiles.push(uri.fsPath); // Store files that have errors
}
if (errors.length) {
if (!acc[uri.fsPath]) {
acc[uri.fsPath] = []; // Initialize array if not present
}
acc[uri.fsPath].push(...errors.map(d => ({
message: d.message,
line: d.range.start.line + 1
})));
}
return acc;