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.ts9
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 5e2d6b6ff..bfb494a3a 100644
--- a/editors/code/src/utils/diagnostics/rust.ts
+++ b/editors/code/src/utils/diagnostics/rust.ts
@@ -183,6 +183,7 @@ export function mapRustDiagnosticToVsCode(
183 const secondarySpans = rd.spans.filter(s => !s.is_primary); 183 const secondarySpans = rd.spans.filter(s => !s.is_primary);
184 184
185 const severity = mapLevelToSeverity(rd.level); 185 const severity = mapLevelToSeverity(rd.level);
186 let primarySpanLabel = primarySpan.label;
186 187
187 const vd = new vscode.Diagnostic(location.range, rd.message, severity); 188 const vd = new vscode.Diagnostic(location.range, rd.message, severity);
188 189
@@ -221,9 +222,17 @@ export function mapRustDiagnosticToVsCode(
221 } 222 }
222 if (messageLine) { 223 if (messageLine) {
223 vd.message += `\n${messageLine}`; 224 vd.message += `\n${messageLine}`;
225
226 // These secondary messages usually duplicate the content of the
227 // primary span label.
228 primarySpanLabel = undefined;
224 } 229 }
225 } 230 }
226 231
232 if (primarySpanLabel) {
233 vd.message += `\n${primarySpanLabel}`;
234 }
235
227 if (isUnusedOrUnnecessary(rd)) { 236 if (isUnusedOrUnnecessary(rd)) {
228 vd.tags = [vscode.DiagnosticTag.Unnecessary]; 237 vd.tags = [vscode.DiagnosticTag.Unnecessary];
229 } 238 }