diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-10-11 10:18:33 +0100 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-10-11 10:18:33 +0100 |
commit | 9b155c89764b8413df6b32edfde94fce1d9c15ec (patch) | |
tree | c044687f5ef2cd992bcf0e6611ce6a750cbb437a /crates/ra_editor | |
parent | 7e55aaeeed318a13b429d4b23c68569033bae0a3 (diff) | |
parent | edd162bda8be065d3e0fc0a70052ce32eeb82553 (diff) |
Merge #118
118: Remove error publishing through publishDecorations r=matklad a=aochagavia
The errors are already reported by `publishDiagnostics`
Closes #109
Co-authored-by: Adolfo OchagavĂa <[email protected]>
Diffstat (limited to 'crates/ra_editor')
-rw-r--r-- | crates/ra_editor/src/lib.rs | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/crates/ra_editor/src/lib.rs b/crates/ra_editor/src/lib.rs index fe0045378..906ee11fe 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<HighlightedRange> { | |||
88 | let mut res = Vec::new(); | 88 | let mut res = Vec::new(); |
89 | for node in file.syntax().descendants() { | 89 | for node in file.syntax().descendants() { |
90 | let tag = match node.kind() { | 90 | let tag = match node.kind() { |
91 | ERROR => "error", | ||
92 | COMMENT | DOC_COMMENT => "comment", | 91 | COMMENT | DOC_COMMENT => "comment", |
93 | STRING | RAW_STRING | RAW_BYTE_STRING | BYTE_STRING => "string", | 92 | STRING | RAW_STRING | RAW_BYTE_STRING | BYTE_STRING => "string", |
94 | ATTR => "attribute", | 93 | ATTR => "attribute", |
@@ -108,21 +107,10 @@ pub fn highlight(file: &File) -> Vec<HighlightedRange> { | |||
108 | } | 107 | } |
109 | 108 | ||
110 | pub fn diagnostics(file: &File) -> Vec<Diagnostic> { | 109 | pub fn diagnostics(file: &File) -> Vec<Diagnostic> { |
111 | let mut res = Vec::new(); | 110 | file.errors().into_iter().map(|err| Diagnostic { |
112 | |||
113 | for node in file.syntax().descendants() { | ||
114 | if node.kind() == ERROR { | ||
115 | res.push(Diagnostic { | ||
116 | range: node.range(), | ||
117 | msg: "Syntax Error".to_string(), | ||
118 | }); | ||
119 | } | ||
120 | } | ||
121 | res.extend(file.errors().into_iter().map(|err| Diagnostic { | ||
122 | range: TextRange::offset_len(err.offset, 1.into()), | 111 | range: TextRange::offset_len(err.offset, 1.into()), |
123 | msg: err.msg, | 112 | msg: "Syntax Error: ".to_string() + &err.msg, |
124 | })); | 113 | }).collect() |
125 | res | ||
126 | } | 114 | } |
127 | 115 | ||
128 | pub fn syntax_tree(file: &File) -> String { | 116 | pub fn syntax_tree(file: &File) -> String { |