diff options
Diffstat (limited to 'editors/code/src/utils/diagnostics/rust.ts')
-rw-r--r-- | editors/code/src/utils/diagnostics/rust.ts | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/editors/code/src/utils/diagnostics/rust.ts b/editors/code/src/utils/diagnostics/rust.ts index d16576eb1..c07be4559 100644 --- a/editors/code/src/utils/diagnostics/rust.ts +++ b/editors/code/src/utils/diagnostics/rust.ts | |||
@@ -182,6 +182,7 @@ export function mapRustDiagnosticToVsCode( | |||
182 | const secondarySpans = rd.spans.filter(s => !s.is_primary); | 182 | const secondarySpans = rd.spans.filter(s => !s.is_primary); |
183 | 183 | ||
184 | const severity = mapLevelToSeverity(rd.level); | 184 | const severity = mapLevelToSeverity(rd.level); |
185 | let primarySpanLabel = primarySpan.label; | ||
185 | 186 | ||
186 | const vd = new vscode.Diagnostic(location.range, rd.message, severity); | 187 | const vd = new vscode.Diagnostic(location.range, rd.message, severity); |
187 | 188 | ||
@@ -220,9 +221,17 @@ export function mapRustDiagnosticToVsCode( | |||
220 | } | 221 | } |
221 | if (messageLine) { | 222 | if (messageLine) { |
222 | vd.message += `\n${messageLine}`; | 223 | vd.message += `\n${messageLine}`; |
224 | |||
225 | // These secondary messages usually duplicate the content of the | ||
226 | // primary span label. | ||
227 | primarySpanLabel = undefined; | ||
223 | } | 228 | } |
224 | } | 229 | } |
225 | 230 | ||
231 | if (primarySpanLabel) { | ||
232 | vd.message += `\n${primarySpanLabel}`; | ||
233 | } | ||
234 | |||
226 | if (isUnusedOrUnnecessary(rd)) { | 235 | if (isUnusedOrUnnecessary(rd)) { |
227 | vd.tags = [vscode.DiagnosticTag.Unnecessary]; | 236 | vd.tags = [vscode.DiagnosticTag.Unnecessary]; |
228 | } | 237 | } |