aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_editor/src/lib.rs17
1 files changed, 3 insertions, 14 deletions
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<HighlightedRange> {
107} 107}
108 108
109pub fn diagnostics(file: &File) -> Vec<Diagnostic> { 109pub fn diagnostics(file: &File) -> Vec<Diagnostic> {
110 let mut res = Vec::new(); 110 file.errors().into_iter().map(|err| Diagnostic {
111
112 for node in file.syntax().descendants() {
113 if node.kind() == ERROR {
114 res.push(Diagnostic {
115 range: node.range(),
116 msg: "Syntax Error".to_string(),
117 });
118 }
119 }
120 res.extend(file.errors().into_iter().map(|err| Diagnostic {
121 range: TextRange::offset_len(err.offset, 1.into()), 111 range: TextRange::offset_len(err.offset, 1.into()),
122 msg: err.msg, 112 msg: "Syntax Error: ".to_string() + &err.msg,
123 })); 113 }).collect()
124 res
125} 114}
126 115
127pub fn syntax_tree(file: &File) -> String { 116pub fn syntax_tree(file: &File) -> String {