improve render reading

pull/13571/head
Alexandru RADOVICI 2025-05-19 15:31:37 +03:00
parent 1e22259fd4
commit 3bff12f995
2 changed files with 15 additions and 19 deletions

View File

@ -683,6 +683,9 @@ impl Client {
]), ]),
..Default::default() ..Default::default()
}), }),
/*experimental: Some(
serde_json::from_str("{\"colorDiagnosticOutput\": true}").unwrap(),
),*/
..Default::default() ..Default::default()
}, },
trace: None, trace: None,

View File

@ -295,26 +295,19 @@ fn diag_picker(
.immediately_show_diagnostic(doc, view.id); .immediately_show_diagnostic(doc, view.id);
}, },
) )
.with_preview(move |_editor, diag| { .with_preview(move |_editor, diag| match diag.diag.data {
// let a: Option<(PathOrId, Option<(usize, usize)>)> = Some(ref data) => {
// location_to_file_location(&diag.location); if let Some(error_string) = data
// let document = Document::default(editor.config.clone(), editor.syn_loader.clone()); .as_object()
// editor.document_by_path(path) .and_then(|object| object.get("rendered"))
match diag.diag.data { .and_then(|rendered| rendered.as_str())
Some(ref data) => Some(( {
PathOrId::Document( Some((PathOrId::Document(error_string.to_string()), Some((0, 0))))
data.as_object() } else {
.unwrap() location_to_file_location(&diag.location)
.get("rendered") }
.unwrap()
.as_str()
.unwrap()
.to_string(),
),
Some((0, 0)),
)),
None => location_to_file_location(&diag.location),
} }
None => location_to_file_location(&diag.location),
}) })
.truncate_start(false) .truncate_start(false)
} }