intellij-quarkus icon indicating copy to clipboard operation
intellij-quarkus copied to clipboard

Suggest missing extensions based on code

Open sdaschner opened this issue 5 years ago • 5 comments

A big hurdle to cross when coming from an Enterprise Java background is to add the correct extension dependencies to the pom.xml, especially when features changes.

E.g. when using Bean Validation in JAX-RS methods, Quarkus will silently ignore the validation, unless quarkus-hibernate-validator is added. This especially emerges, when using annotations that already ship with some other (transitive) dependency, but is not actually implemented due to a missing extension (e.g. BV annotations with JAX-RS)

Improvement: The plugin could suggest something along "you're using @Valid but you should add the quarkus-hibernate-validator for that."

Examples: Bean Validation annotations (quarkus-hibernate-validator), JAX-RS with JSON-B (quarkus-resteasy-jsonb), etc...

sdaschner avatar Feb 28 '20 11:02 sdaschner

I love this idea, but I have no idea how to implement this feature?

@fbricon have you some idea?

angelozerr avatar Apr 12 '23 08:04 angelozerr

@angelozerr you can see that as a custom validation. You can then define a custom client capability, (sending "add quarkus extension" command name), and a quickfix would just call that command on the client side

fbricon avatar Apr 12 '23 09:04 fbricon

quickfix would just call that command on the client side

Yes sure, but how to implement this command?

angelozerr avatar Apr 12 '23 09:04 angelozerr

something like https://github.com/redhat-developer/vscode-quarkus/blob/master/src/wizards/addExtensions/addExtensionsWizard.ts#L54-L70

you call the quarkus:add-extensions, using Maven or Gradle. As for programmatically running a command in a terminal, in IJ, I'll defer to @adietish

fbricon avatar Apr 12 '23 10:04 fbricon

Thanks so much @fbricon for your explanation. It will require to manage this code action on MP LS side in order to vscode-quarkus benefit with this feature too

angelozerr avatar Apr 12 '23 10:04 angelozerr