Merge #4721
4721: Hide squiggly for unused and unnecessary diagnostics r=matklad a=GabbeV Fixes #4229 When working with JavaScript or TypeScript in VSCode unused valiables are faded but don't have a squiggle. This PR makes rust-analyzer work similarly by setting the severity to hint when applying the unnecessary tag. VSCode usually shows a squiggle for error, warning and information and shows three dots for hint. When the unnecessary tag is present the squiggles will still show up but the three dots will not. This is my first contribution to open source. Please tell me if i need to do anything more to get this PR considered. Co-authored-by: Gabriel Valfridsson <gabriel.valfridsson@gmail.com>
This commit is contained in:
commit
6d38351db4
2 changed files with 3 additions and 2 deletions
|
|
@ -29,7 +29,7 @@ expression: diag
|
|||
},
|
||||
},
|
||||
severity: Some(
|
||||
Warning,
|
||||
Hint,
|
||||
),
|
||||
code: Some(
|
||||
String(
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@ pub(crate) fn map_rust_diagnostic_to_lsp(
|
|||
return Vec::new();
|
||||
}
|
||||
|
||||
let severity = map_level_to_severity(rd.level);
|
||||
let mut severity = map_level_to_severity(rd.level);
|
||||
|
||||
let mut source = String::from("rustc");
|
||||
let mut code = rd.code.as_ref().map(|c| c.code.clone());
|
||||
|
|
@ -225,6 +225,7 @@ pub(crate) fn map_rust_diagnostic_to_lsp(
|
|||
}
|
||||
|
||||
if is_unused_or_unnecessary(rd) {
|
||||
severity = Some(DiagnosticSeverity::Hint);
|
||||
tags.push(DiagnosticTag::Unnecessary);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue