eclipse-jdt / eclipse.jdt.ui

Eclipse Public License 2.0
36 stars 88 forks source link

[Enhancement] Add quickfix option to rename unused patterns to _ #1701

Open nlisker opened 1 day ago

nlisker commented 1 day ago

From: https://github.com/eclipse-jdt/eclipse.jdt.core/issues/3051

JDT core added a warning for unused patterns. It would be helpful to add a "rename unused variable to _" option on hover or on ctrl+1. This will help with batch renaming to transition old code to new code.

srikanth-sankaran commented 1 day ago

Please note: https://github.com/eclipse-jdt/eclipse.jdt.core/pull/3055 also introduces an API option to control whether unused lambda parameters should be complained against.

The option string is declared as:

public static final String OPTION_ReportUnusedLambdaParameter = "org.eclipse.jdt.core.compiler.problem.unusedLambdaParameter";

Please include UI support for configuring this option too as a part of this ticket.

Note: This option has an effect only on JDK22 and upwards. For 21 and below, the compiler does not emit the unused lambda parameter warning - since these are not actionable.