about summary refs log tree commit diff
path: root/editors/code/src/utils
diff options
context:
space:
mode:
authorarsdragonfly <arsdragonfly@gmail.com>2019-09-27 16:17:02 -0400
committerarsdragonfly <arsdragonfly@gmail.com>2019-09-27 16:17:02 -0400
commitd1988a17f4ceb90bcdaed79072c4b7f647c86854 (patch)
treea23272cc4a284ffe974af3f58ae274ac65e1805c /editors/code/src/utils
parentfc218ec0d04577e33db509e956a044293c12ea67 (diff)
downloadrust-d1988a17f4ceb90bcdaed79072c4b7f647c86854.tar.gz
rust-d1988a17f4ceb90bcdaed79072c4b7f647c86854.zip
Support the new deprecated tag
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 1fb1f7b6dc8..a66b52313e9 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 {
 }
 
 /**
+ * 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
  *
  * This can have three outcomes:
@@ -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 {