From 26d34cc4439174af45d493a14c41631121fa2ccd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20Ochagav=C3=ADa?= Date: Wed, 10 Oct 2018 16:49:32 +0200 Subject: Remove error publishing through publishDecorations --- crates/ra_editor/src/lib.rs | 1 - 1 file changed, 1 deletion(-) (limited to 'crates') diff --git a/crates/ra_editor/src/lib.rs b/crates/ra_editor/src/lib.rs index fe0045378..15aaac172 100644 --- a/crates/ra_editor/src/lib.rs +++ b/crates/ra_editor/src/lib.rs @@ -88,7 +88,6 @@ pub fn highlight(file: &File) -> Vec { let mut res = Vec::new(); for node in file.syntax().descendants() { let tag = match node.kind() { - ERROR => "error", COMMENT | DOC_COMMENT => "comment", STRING | RAW_STRING | RAW_BYTE_STRING | BYTE_STRING => "string", ATTR => "attribute", -- cgit v1.2.3 From edd162bda8be065d3e0fc0a70052ce32eeb82553 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20Ochagav=C3=ADa?= Date: Wed, 10 Oct 2018 16:59:46 +0200 Subject: Report errors only once --- crates/ra_editor/src/lib.rs | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'crates') diff --git a/crates/ra_editor/src/lib.rs b/crates/ra_editor/src/lib.rs index 15aaac172..906ee11fe 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 { -- cgit v1.2.3