Fix to show backtraces of errors in other files

This commit is contained in:
Jonathan Tran
2025-07-01 23:25:24 -04:00
parent fba62dab98
commit ab4ebbe78a

View File

@ -372,7 +372,6 @@ export function kclErrorsToDiagnostics(
): CodeMirrorDiagnostic[] {
let nonFatal: CodeMirrorDiagnostic[] = []
const errs = errors
?.filter((err) => isTopLevelModule(err.sourceRange))
.flatMap((err) => {
const diagnostics: CodeMirrorDiagnostic[] = []
let message = err.msg
@ -410,12 +409,14 @@ export function kclErrorsToDiagnostics(
compilationErrorsToDiagnostics(err.nonFatal, sourceCode)
)
}
diagnostics.push({
from: toUtf16(err.sourceRange[0], sourceCode),
to: toUtf16(err.sourceRange[1], sourceCode),
message,
severity: 'error',
})
if (isTopLevelModule(err.sourceRange)) {
diagnostics.push({
from: toUtf16(err.sourceRange[0], sourceCode),
to: toUtf16(err.sourceRange[1], sourceCode),
message,
severity: 'error',
})
}
return diagnostics
})
return errs.concat(nonFatal)