diff --git a/crates/ra_editor/src/lib.rs b/crates/ra_editor/src/lib.rs index 15aaac1721..906ee11fe7 100644 --- a/crates/ra_editor/src/lib.rs +++ b/crates/ra_editor/src/lib.rs @@ -107,21 +107,10 @@ pub fn highlight(file: &File) -> Vec { } pub fn diagnostics(file: &File) -> Vec { - let mut res = Vec::new(); - - for node in file.syntax().descendants() { - if node.kind() == ERROR { - res.push(Diagnostic { - range: node.range(), - msg: "Syntax Error".to_string(), - }); - } - } - res.extend(file.errors().into_iter().map(|err| Diagnostic { + file.errors().into_iter().map(|err| Diagnostic { range: TextRange::offset_len(err.offset, 1.into()), - msg: err.msg, - })); - res + msg: "Syntax Error: ".to_string() + &err.msg, + }).collect() } pub fn syntax_tree(file: &File) -> String {