Hi everyone. Are you guys all using intelij or is ...
# questions
u
Hi everyone. Are you guys all using intelij or is there someone using vs code for grails developemnt? I looked for this questions here in the channel, no one asked about this.. Is there any way to have a good grails experience with grails in vs code? In my last job I used intelij, but for now, I wouldn't like to pay for intelij. Thanks
j
Intellij seems to have the best support. I know that @giangio had done some research in this area and I seem to recall he may have generated a visual studio plugin using AI too. Longer term, we want to integrate gdsl's into the Grails code base so that IntelliJ has better autocompletion.
👍 1
u
Oh, thank you.. Yes, I thought about it also... now with AI autocomplete any text editor could work... thank you, I will give a try.
g
Hi @User we are using IntelliJ IDEA CE (the free version) writing Grails applications with some "hints" to make them auto-complete with the standard Groovy support. For example we define domain classes like this:
Copy code
class TCompany implements GormEntity, MultiTenant<TCompany> {
    Long id
    LocalDateTime dateCreated

    String name
    Boolean isOwned
    Boolean isSupplier
    Boolean isClient
}
And controllers like this:
Copy code
class CompanyController implements Controller {
This will help with any IDE supporting the Groovy language. I have no recent experiences with Eclipse or VSCode but it's a starting point and the boilerplate code is not much of a problem.
GSPs are not supported but you can set the HTML styling to the
.gsp
files
Also we do this for
belongsTo
associations:
Copy code
TActivity activity
static belongsTo = [
        activity: TActivity,
]
And this for
hasMany
associations:
Copy code
Set<TActivityProfile> profiles
static hasMany = [
        profiles: TActivityProfile,
]
This way you have autocomplete for associations as well
u
I see, interesting.. Thank you @giangio
👍 1
j
FYI: There's also
@SelfType(MyType)
for hints
where MyType = controller if a controller, etc
the traits are injected as part of the groovy transforms, i think they still execute all of their code either way though. I can't remember if the ast skips certain classes if theyr'e already marked or not