aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code/src/utils')
-rw-r--r--editors/code/src/utils/diagnostics/rust.ts21
1 files changed, 20 insertions, 1 deletions
diff --git a/editors/code/src/utils/diagnostics/rust.ts b/editors/code/src/utils/diagnostics/rust.ts
index 1fb1f7b6d..a66b52313 100644
--- a/editors/code/src/utils/diagnostics/rust.ts
+++ b/editors/code/src/utils/diagnostics/rust.ts
@@ -112,6 +112,19 @@ function isUnusedOrUnnecessary(rd: RustDiagnostic): boolean {
112} 112}
113 113
114/** 114/**
115 * Determines if diagnostic is related to deprecated code
116 */
117function isDeprecated(rd: RustDiagnostic): boolean {
118 if (!rd.code) {
119 return false;
120 }
121
122 return [
123 'deprecated',
124 ].includes(rd.code.code);
125}
126
127/**
115 * Converts a Rust child diagnostic to a VsCode related information 128 * Converts a Rust child diagnostic to a VsCode related information
116 * 129 *
117 * This can have three outcomes: 130 * This can have three outcomes:
@@ -233,8 +246,14 @@ export function mapRustDiagnosticToVsCode(
233 vd.message += `\n${primarySpanLabel}`; 246 vd.message += `\n${primarySpanLabel}`;
234 } 247 }
235 248
249 vd.tags = []
250
236 if (isUnusedOrUnnecessary(rd)) { 251 if (isUnusedOrUnnecessary(rd)) {
237 vd.tags = [vscode.DiagnosticTag.Unnecessary]; 252 vd.tags.push(vscode.DiagnosticTag.Unnecessary);
253 }
254
255 if (isDeprecated(rd)) {
256 vd.tags.push(vscode.DiagnosticTag.Deprecated);
238 } 257 }
239 258
240 return { 259 return {