eclipse-jdt / eclipse.jdt.ui

Eclipse Public License 2.0
36 stars 86 forks source link

Support Convert to Text Block quickfix in annotations #1500

Closed vrozkovec closed 2 months ago

vrozkovec commented 2 months ago

Currently, it is not possible to convert easily text in annotations to text block. image

This would come handy when using libraries such as JDBI which let you define your SQL in annotated methods.

jjohnstn commented 2 months ago

@vrozkovec What version of Eclipse are you using? This works fine for me using 2024-03. For example:

package tests;

import static java.lang.annotation.ElementType.TYPE;

import java.lang.annotation.Target;

@Target(TYPE)
public @interface SomeAnnotation {

    String value();

}
package tests;

@SomeAnnotation("abc\n"
+ "def"
+ "ghi" +
"jkl")
public class TryAnnotation {

}

When I use Ctrl+1 in the abc... string, it offers to convert to text block.

vrozkovec commented 2 months ago

@jjohnstn my bad, indeed, in newer version it works, sorry for the noise.