grails-core icon indicating copy to clipboard operation
grails-core copied to clipboard

IntelliJ - Better IDE Support

Open jdaugherty opened this issue 1 year ago • 8 comments

Issue description

Placeholder ticket to discuss issues with current IntelliJ integration and how we can help provide better IDE support. Please consider voting for these issues on JetBrain's tracker to help us get better IDE support.

Known IntelliJ Bugs

BLOCKER

  1. IDE Lockups for Grails-core if Grails plugin enabled IDEA-366647

High Priority

  1. Attach Sources Issues - 'Attach Roots' dialog after downloading library sources in a Gradle-based project - IDEA-363773
  2. Tag Libs - cannot go to declaration unless sources are downloaded - IDEA-364650
  3. Ambiguous Method Calls IDEA-354989 - render is reported as an ambiguous method call in IntelliJ because render(obj) and render(Map map) exist. IntelliJ does not complain about this if these methods types are added in your project, but when referencing the grails render() method, it complains. This issue has popped up several times: ~~IDEA-216095~~, ~~IDEA-218748~~
  4. ✅ Completed - Update IntelliJ Grails plugin for Apache Changes: https://youtrack.jetbrains.com/issue/IDEA-372363/Update-Grails-Plugin-to-support-Apache-Grails-changes & https://youtrack.jetbrains.com/issue/IDEA-373638/Support-recognization-of-Grails-7-when-importing-from-Gradle, resolved in 2025.2 EAP+ with plugin version 252.19874.12+

Lower Priority

  1. Tag Libs - attribute go to support - IDEA-199021
  2. Better decompile support for java 17 & groovy - IDEA-365803

Groovy Specific Issues (no specific priority)

  1. Alignment for Map Constructors IDEA-347599
  2. static property exceeds access rights IDEA-331870
  3. AST Browser IDEA-178233

Work Around Available

  1. Intellij Does not resolve gradle API classes - wrong gradle distribution selected (use all instead of bin if using gradle via wrapper OR use a local gradle distribution with the sources)

jdaugherty avatar Dec 05 '24 15:12 jdaugherty

Tag Libs - go to declaration

Reached out to intellij's support because tag libs inside of a project seem to support go to declaration, while tag libs outside of the project don't always resolve (for example the asset plugin or the spring security core plugin tags)

Open ticket IDEA-199021

jdaugherty avatar Dec 05 '24 15:12 jdaugherty

Tested in Grails 6.2.2

Fields plugin tags do not autocomplete and show up red. asset:image,asset:link,asset:stylesheet... asset pipeline tags to not autocomplete and show up in red

Seems like base tags are back to clicking into source again. I was previously ending up in an xml file. g:form clicks into FormTagLib.groovy as expected g:if clicks into GroovyIfTag as expected g:message clicks into ValidationTagLib as expected g:link works.

Do we have an example of any Plugin that has working autocomplete tags? @jdaugherty have you tried Grails 5.x? Perhaps something else was removed that broke everything similar to how shell removal in 6.2.x broke the IntelliJ plugin

codeconsole avatar Dec 06 '24 02:12 codeconsole

Intellij Does not resolve gradle API classes

If the project is setup with a gradle distribution of 'bin' instead of 'all' in the wrapper properties: image

Intellij won't find the gradle source files. We should consider either specifying 'all' for our projects, adding a gradle wrapper task, or as part of .sdkmanrc add gradle. The downside of using 'all' is it's a 200mb download. Maybe this is a reason to use .sdkmanrc gradle define?

jdaugherty avatar Dec 08 '24 22:12 jdaugherty

I've updated the ticket description for more IDEA tickets to document the problems found by go to research on the tag libs.

jdaugherty avatar Dec 12 '24 15:12 jdaugherty

I added https://youtrack.jetbrains.com/issue/IDEA-342753 to the list of issues since it seems to be persistent under some circumstances. It may actually be fixed in environments that are setup from scratch.

jdaugherty avatar Dec 16 '24 15:12 jdaugherty

I noticed that IntelliJ is not decompiling certain code that was transformed by an AST. Grails makes heavy use of this so I opened https://youtrack.jetbrains.com/issue/IDEA-365803/Better-Decompile-Support-for-Groovy-Classes-that-had-AST-Transformations

jdaugherty avatar Jan 28 '25 20:01 jdaugherty

Reorganized the initial ticket description since we're starting to collect quite a few of these. I also organized them into high priority / low priority / work around available.

jdaugherty avatar Jan 28 '25 22:01 jdaugherty

Seems like debugging Groovy in IntelliJ is now a nightmare. In one method call, there is literally 28 useless submethods in a stack trace.

Image

codeconsole avatar Mar 26 '25 19:03 codeconsole