diff --git a/client/src/commands/dead_code_analysis.ts b/client/src/commands/dead_code_analysis.ts index 4171aed47..346aef42e 100644 --- a/client/src/commands/dead_code_analysis.ts +++ b/client/src/commands/dead_code_analysis.ts @@ -132,15 +132,21 @@ let dceTextToDiagnostics = ( } let issueLocationRange = new Range(startPos, endPos); + let diagnosticText = text.trim(); let diagnostic = new Diagnostic( issueLocationRange, - text.trim(), + diagnosticText, DiagnosticSeverity.Warning ); - // This will render the part of the code as unused - diagnostic.tags = [DiagnosticTag.Unnecessary]; + // Everything reanalyze reports is about dead code, except for redundant + // optional arguments. This will ensure that everything but reduntant + // optional arguments is highlighted as unecessary/unused code in the + // editor. + if (!diagnosticText.toLowerCase().startsWith("optional argument")) { + diagnostic.tags = [DiagnosticTag.Unnecessary]; + } if (diagnosticsMap.has(processedFileInfo.filePath)) { diagnosticsMap.get(processedFileInfo.filePath).push(diagnostic); diff --git a/package.json b/package.json index 5c636a639..637b453b1 100644 --- a/package.json +++ b/package.json @@ -48,6 +48,10 @@ { "command": "rescript-vscode.start_dead_code_analysis", "title": "ReScript: Start dead code analysis." + }, + { + "command": "rescript-vscode.stop_dead_code_analysis", + "title": "ReScript: Stop dead code analysis." } ], "menus": {