redhat-developer / quarkus-ls

Language server for Quarkus tooling
Eclipse Public License 2.0
44 stars 15 forks source link

`TemplateExtension.java` class generated in `src/main/resources` #831

Closed datho7561 closed 1 year ago

datho7561 commented 1 year ago
  1. Create a template in Quarkus project with qute:
{@java.lang.String identifier}

{identifier.sandw|ich}
  1. Apply the quick fix to resolve the error at the |: "Create template extension sandwich() in new template extensions class"

Expected: a new file TemplateExtensions.java is generated in src/main/java (the default package)

Actual: the file is generated in src/main/resources

datho7561 commented 1 year ago

I've only tested this with a Maven project. I guess it would be incorrect in a different way for a Gradle project.

datho7561 commented 1 year ago

@fbricon @angelozerr This isn't a regression, it's just very difficult to locate the folder that the project's code is in using the JDT APIs, since resource folders are hard to distinguish from Java source folders, and it's hard to tell if a Java source folder is for generated sources.

What are your thoughts about disabling this quick fix until we have some sort of UI to specify the name and location of the class file when creating it?

fbricon commented 1 year ago

for now, I'd check if there's a src/main/java source folder in the project classpath. Then exclude all source folders where the test attribute (IClasspathManager.TEST_ATTRIBUTE) is set to "true"