miette
miette copied to clipboard
how can i read source_back when call with_source_code before
it's sometimes useful to get source_code as string back if we need to convert miette report to other diagnostic info like vscode lsp format, but it seems impossible to get it back, so it seems we need to wrap our own diagnostic to save source_code, but I'm not sure it's a good practice
struct MyDiagnostic {
inner: Arc<miette::Report>,
source_code: Arc<src>
}
You should be able to downcast any Report into a dyn Diagnostic, and then call .source_code() on it, to get the source code, if available.