diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-09-28 16:59:28 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2019-09-28 16:59:28 +0100 |
commit | dbdf0e24d51ce425c0066a76a0efc723e41e5071 (patch) | |
tree | 2b91ba59edc252a7961f044caad94b192d49ce78 /editors/code/src/utils | |
parent | 12f617e661c288cfc51727012da8114f77f7e55b (diff) | |
parent | 17d1405a8b4eddedaf3665fc41ff4fa17a1409a7 (diff) |
Merge #1931
1931: Support the new deprecated tag r=matklad a=arsdragonfly
Which is rendered as a strike-through line. Fixes #1671 .
![深度截图_选择区域_20190927162008](https://user-images.githubusercontent.com/4067473/65799714-ccb4c180-e142-11e9-8e45-ab18964605f3.png)
Co-authored-by: arsdragonfly <[email protected]>
Diffstat (limited to 'editors/code/src/utils')
-rw-r--r-- | editors/code/src/utils/diagnostics/rust.ts | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/editors/code/src/utils/diagnostics/rust.ts b/editors/code/src/utils/diagnostics/rust.ts index 1fb1f7b6d..0550d0372 100644 --- a/editors/code/src/utils/diagnostics/rust.ts +++ b/editors/code/src/utils/diagnostics/rust.ts | |||
@@ -112,6 +112,17 @@ function isUnusedOrUnnecessary(rd: RustDiagnostic): boolean { | |||
112 | } | 112 | } |
113 | 113 | ||
114 | /** | 114 | /** |
115 | * Determines if diagnostic is related to deprecated code | ||
116 | */ | ||
117 | function isDeprecated(rd: RustDiagnostic): boolean { | ||
118 | if (!rd.code) { | ||
119 | return false; | ||
120 | } | ||
121 | |||
122 | return ['deprecated'].includes(rd.code.code); | ||
123 | } | ||
124 | |||
125 | /** | ||
115 | * Converts a Rust child diagnostic to a VsCode related information | 126 | * Converts a Rust child diagnostic to a VsCode related information |
116 | * | 127 | * |
117 | * This can have three outcomes: | 128 | * This can have three outcomes: |
@@ -200,6 +211,7 @@ export function mapRustDiagnosticToVsCode( | |||
200 | vd.source = source; | 211 | vd.source = source; |
201 | vd.code = code; | 212 | vd.code = code; |
202 | vd.relatedInformation = []; | 213 | vd.relatedInformation = []; |
214 | vd.tags = []; | ||
203 | 215 | ||
204 | for (const secondarySpan of secondarySpans) { | 216 | for (const secondarySpan of secondarySpans) { |
205 | const related = mapSecondarySpanToRelated(secondarySpan); | 217 | const related = mapSecondarySpanToRelated(secondarySpan); |
@@ -234,7 +246,11 @@ export function mapRustDiagnosticToVsCode( | |||
234 | } | 246 | } |
235 | 247 | ||
236 | if (isUnusedOrUnnecessary(rd)) { | 248 | if (isUnusedOrUnnecessary(rd)) { |
237 | vd.tags = [vscode.DiagnosticTag.Unnecessary]; | 249 | vd.tags.push(vscode.DiagnosticTag.Unnecessary); |
250 | } | ||
251 | |||
252 | if (isDeprecated(rd)) { | ||
253 | vd.tags.push(vscode.DiagnosticTag.Deprecated); | ||
238 | } | 254 | } |
239 | 255 | ||
240 | return { | 256 | return { |