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 <aochagavia92@gmail.com>
This commit is contained in:
commit
9b155c8976
@ -88,7 +88,6 @@ pub fn highlight(file: &File) -> Vec<HighlightedRange> {
|
||||
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",
|
||||
@ -108,21 +107,10 @@ pub fn highlight(file: &File) -> Vec<HighlightedRange> {
|
||||
}
|
||||
|
||||
pub fn diagnostics(file: &File) -> Vec<Diagnostic> {
|
||||
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 {
|
||||
|
@ -20,13 +20,6 @@ export class Highlighter {
|
||||
[string, vscode.TextEditorDecorationType]
|
||||
> = [
|
||||
['background', decor('#3F3F3F')],
|
||||
[
|
||||
'error',
|
||||
vscode.window.createTextEditorDecorationType({
|
||||
borderColor: 'red',
|
||||
borderStyle: 'none none dashed none'
|
||||
})
|
||||
],
|
||||
['comment', decor('#7F9F7F')],
|
||||
['string', decor('#CC9393')],
|
||||
['keyword', decor('#F0DFAF')],
|
||||
|
Loading…
x
Reference in New Issue
Block a user