Support the new deprecated tag
This commit is contained in:
parent
fc218ec0d0
commit
d1988a17f4
@ -111,6 +111,19 @@ function isUnusedOrUnnecessary(rd: RustDiagnostic): boolean {
|
||||
].includes(rd.code.code);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if diagnostic is related to deprecated code
|
||||
*/
|
||||
function isDeprecated(rd: RustDiagnostic): boolean {
|
||||
if (!rd.code) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return [
|
||||
'deprecated',
|
||||
].includes(rd.code.code);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a Rust child diagnostic to a VsCode related information
|
||||
*
|
||||
@ -233,8 +246,14 @@ export function mapRustDiagnosticToVsCode(
|
||||
vd.message += `\n${primarySpanLabel}`;
|
||||
}
|
||||
|
||||
vd.tags = []
|
||||
|
||||
if (isUnusedOrUnnecessary(rd)) {
|
||||
vd.tags = [vscode.DiagnosticTag.Unnecessary];
|
||||
vd.tags.push(vscode.DiagnosticTag.Unnecessary);
|
||||
}
|
||||
|
||||
if (isDeprecated(rd)) {
|
||||
vd.tags.push(vscode.DiagnosticTag.Deprecated);
|
||||
}
|
||||
|
||||
return {
|
||||
|
Loading…
x
Reference in New Issue
Block a user