aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/utils/rust_diagnostics.ts
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code/src/utils/rust_diagnostics.ts')
-rw-r--r--editors/code/src/utils/rust_diagnostics.ts14
1 files changed, 12 insertions, 2 deletions
diff --git a/editors/code/src/utils/rust_diagnostics.ts b/editors/code/src/utils/rust_diagnostics.ts
index ed049c95e..3c524cb37 100644
--- a/editors/code/src/utils/rust_diagnostics.ts
+++ b/editors/code/src/utils/rust_diagnostics.ts
@@ -187,8 +187,18 @@ export function mapRustDiagnosticToVsCode(
187 187
188 const vd = new vscode.Diagnostic(location.range, rd.message, severity); 188 const vd = new vscode.Diagnostic(location.range, rd.message, severity);
189 189
190 vd.source = 'rustc'; 190 let source = 'rustc';
191 vd.code = rd.code ? rd.code.code : undefined; 191 let code = rd.code && rd.code.code;
192 if (code) {
193 // See if this is an RFC #2103 scoped lint (e.g. from Clippy)
194 const scopedCode = code.split('::');
195 if (scopedCode.length === 2) {
196 [source, code] = scopedCode;
197 }
198 }
199
200 vd.source = source;
201 vd.code = code;
192 vd.relatedInformation = []; 202 vd.relatedInformation = [];
193 203
194 for (const secondarySpan of secondarySpans) { 204 for (const secondarySpan of secondarySpans) {