diff options
| author | arsdragonfly <arsdragonfly@gmail.com> | 2019-09-27 16:17:02 -0400 |
|---|---|---|
| committer | arsdragonfly <arsdragonfly@gmail.com> | 2019-09-27 16:17:02 -0400 |
| commit | d1988a17f4ceb90bcdaed79072c4b7f647c86854 (patch) | |
| tree | a23272cc4a284ffe974af3f58ae274ac65e1805c /editors/code/src/utils | |
| parent | fc218ec0d04577e33db509e956a044293c12ea67 (diff) | |
| download | rust-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.ts | 21 |
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 { |
