redhat-developer / intellij-quarkus

IntelliJ Quarkus Tools
Eclipse Public License 2.0
119 stars 47 forks source link

Suggest missing extensions based on code #61

Open sdaschner opened 4 years ago

sdaschner commented 4 years ago

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...

angelozerr commented 1 year ago

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

@fbricon have you some idea?

fbricon commented 1 year ago

@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

angelozerr commented 1 year ago

quickfix would just call that command on the client side

Yes sure, but how to implement this command?

fbricon commented 1 year ago

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

angelozerr commented 1 year ago

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