This message was deleted.
# kotlin-dsl
s
This message was deleted.
j
Try changing the IntelliJ JDK
I think
id(“java”)
is the same as
java
in KTS but I haven't tried personally the first one as I always use the second one
t
Thanks Javi, but changing it to just “`java`” makes no difference.
id("java")
is generated by the new project wizard.
j
And changing the JDK inside IntelliJ IDEA?
t
I tried 8, 11 and 17, makes no difference.
j
I ended up adding
idea
to my plugin blocks and it resolved a lot of this for me.
t
Thanks for the idea John, but alas, it makes no difference in my case.
v
All suggestions here actually cannot help. If they helped, it was only the side effect of causing a reimport. Just try to reimport from the Gradle tool window. If it didn't help, remove the Gradle project from the tool window and reimport it. If it still didn't help, close the project, remove the IntelliJ related files and open the project again. If it still didn't help, try the almighty "Invalidate and Restart". Or a combination of the above. That those lines are red while the project is building fine just means that IntelliJ did not get the correct class path for that script and you have to make it get the right one.
t
Hi Björn, thanks for answering! I am a bit confused that this happens with a brand new out-of-the-box IDEA project… From the feedback I get I indeed gather that the classpath of the Kotlin editor/environment does not know about the plugins, basic gradle references work just fine. I tried your action list: • reimport… nope • remove from gradle window (- button) and than add it again… nope • close project, remove files, open again…nope • the almighty… nope … I hope that Jetbrains will have some insights in YouTrack…
v
Yeah, it's sometimes strange when it happens and why. Never was able to reproduce once it worked again. Maybe also have a look at IntelliJ log and Gradle daemon log whether you find anything suspicious.
t
Yeah, indeed I had it before multiple times and then it vanished after lots of rattling... and we are definitely not the only ones… For me this is a reason not to, sort of, trust the gradle/kotlin marriage, although this is an emotional thing because gradle runs great with kotlin. So we should really make this reliable. It is such a shame when good tech gets a bad taste for stupid problems. Since I experience it now with even a brand new project I though maybe it is time to dig into it to find the real cause. I would love it to go away, but I would hate it to go away without me knowing why! …it will then be looming in dark and attack me again sooner or later. But… then I lack the knowledge of kotlin and how it is all configured here.
I found the problem! also see https://youtrack.jetbrains.com/issue/KTIJ-22769/new-template-project-contains-errors-in-[…]ect-contains-errors-in-buildgradlekts-file-out-of-the-box When I removed the
.gradle
entry from the
Ignored Files and Folders
list from the
Editor/File Types
preference the problem vanished. I have no idea what put the entry in this list though. I hope this can help others….
v
Yeah, I totally feel you, I also often dig deeper I should or should need to, to find out things that work unexpected, we are like-minded in this regard. :-) Great that you found the problem in your settings. As the type-safe accessors are generated into a subfolder of
.gradle
, it sounds consistent that they are not found in IJ if the folder is ignored.
t
Haha, yeah, maybe not the smartest thing to keep on going against all odds, but it is a nice feeling to know you cracked it. You’ll probably recognise that Björn. Glad you can give it a logical explanation 😉. I am curious if the JetBrains guys come up with something to fix or flag this or that they file it under mis-configuration. I hope others with the same issue will find the YouTrack issue. For now we’ll close this Slack-thread.
👌 1
g
Now that you found the cause I remember I saw recommendation by someone to add .gradle to idea ignore list and when I tried it I got the aforementioned issue
t
For what was that recommendation supposed to be a fix? It might be valuable for jetbrains…
g
It was some android-related blog post, about increasing IDEA import performance. Likely for groovy build scripts where's no generated dsl accessors but I don't quite recall if it was somehow mentioned that it could work fine only for groovy but not kotlin. IDEA poisoned a lot of people against Gradle, especially Kotlin DSL. When autocompletion takes more than second for configuration name in dependencies on i7-10875H, 32G RAM and NVMe it irritates more than a little bit. Reminds me their old Scala completion a lot xD
t
Hmmm, optimization efforts sometimes result in losing functionality used only by ‘others’. Specially when frustration kicks in. I am not an android dev and I have the luck to use an M1 ultra so I am quite happy now. Although from the endless autocomplete lists I deduce that kotlin is a bitch to calc autocomplete for 🤣. There is just too much you can write at any place in the code. Anyways, I prefer Java for my regular dev work.
g
Yeah, true. As for kotlin/scala autocompletion extension functions, operator overload, implicits etc raise resource consumption in order of magnitude at the very least. While they are quite handy to write concise and readable code, implementing DSLs etc that could be harder to write in the contemporary IDE. Another thing is that features like go to definition could be bitch to implement from UX standpoint: when I hit ^B and cursor is before an opening bracket in
configurations["api"]
depending on the context I might want either where configurations is defined or its
get
method
t
You are right on kotlin versatility! Haha, I knew we would be capable of keeping those ever faster machines busy! Hungry forever! Btw if you ever want to go extreme in ‘concise’ try APL. 😝 …but we are really off-topic now!
😁 1
g
Hey, the first rule of the APL club, you do not talk about APL/J/K 🤣
😶 1