For some reason, code completion in IntelliJ compl...
# intellij
s
For some reason, code completion in IntelliJ completely broke for me recently, on all projects (in Kotlin at least, haven't tried anything else) Unsure what's the reason, or what did I do, aside from the fact that I updated to 2024.3.3 (unsure if it happened before or after the update). Looking online, some people said it's power saving mode, but I never enabled that. Funnily enough, enabling power saving mode actually fixes it, but I have to press Ctrl+Space before getting any completions, and isn't a full substitute. Attached a video showcasing this. No suggestions while typing, nor after pressing Ctrl+Space to manually trigger them. It also shows power saving mode's effect here.
1
Note that I tried the "Repair IDE" stuff, all the way down to invalidating caches, with no avail.
b
sorry, this is (probably) unrelated to your question but I've never seen these inline errors and warnings before ... is that a plugin or a new setting I'm not aware of?
👀 2
a
Could you please share idea.log (
Help | Show log
). Thanks
s
@bod That's actually a plugin called Inspection Lens: https://plugins.jetbrains.com/plugin/19678-inspection-lens It's a must-have!
b
very cool! I'll check it out, thanks
s
@Anna Kozlova the file seems to contain some sensitive info, should I upload this in a YT issue?
a
yes, please
s
Found this issue already open on YouTrack: https://youtrack.jetbrains.com/issue/IDEA-367520/code-completion-not-working Commented there with idea.log as well.
So this only really started happening these days, I'll try reverting the IDE version and see
a
Copy code
Caused by: org.gradle.api.InvalidUserDataException: Invalid catalog definition:
  - Problem: In version catalog libs, version reference 'vite.kotlin' doesn't exist.
    
    Reason: Plugin 'dev.opensavvy.vite.kotlin' references version 'vite.kotlin' which doesn't exist.
    
    Possible solutions:
      1. Declare 'vite.kotlin' in the catalog.
      2. Use one of the following existing versions: 'admob', 'agp', 'android.compileSdk', 'android.desugaring', 'android.minSdk', 'android.targetSdk', 'androidx.activityCompose', 'androidx.appcompat', 'androidx.lifecycle', 'androidx.material', 'billing.play', 'circuit', 'compose.hot.reload', 'compose.plugin', 'haze', 'kotlin', 'kotlinx.coroutines', 'kotlinx.datetime', 'ktor', 'logback', 'sqldelight', or 'vite'.
and then
Copy code
2025-02-12 20:55:13,238 [86456280] SEVERE - #o.j.k.i.g.configuration - [Kotlin Facet]: cannot create facet for module 'XXX.main' due to unknown compiler version. Some functionality might become unavailable!
java.lang.Throwable: [Kotlin Facet]: cannot create facet for module 'XXX.main' due to unknown compiler version. Some functionality might become unavailable!
	at com.intellij.openapi.diagnostic.Logger.error(Logger.java:376)
Can be the cause of a problem?
s
hmm, i did try adding that, but then i removed it completely and in the video, i tried this again on another brand new kotlin/native project, with the same issue
and have restarted the IDE and my computer, with no avail
the weird thing is that the auto-complete works perfectly with power saving on blob thinking fast
a
I would bet that it's a plugin which prevents completion but of cause I am not 100% sure. Have you installed smth new lately?
s
Didn't install anything new... I don't use many plugins, and aside from "Inspection Lens", I think none of them have to do with the editor.
Reverting to 2024.3.2.2 seems to fix it!
Updated again to see if it was a spurious issue, but nope, this persists. One other interesting thing is that during indexing, I get some basic code completion. Once indexing is done, boom, nothing works. I'll try it out with Rust to see if it's limited to Kotlin files.
Same issue with Rust. Seems like it can show autocomplete for language keywords here though, but nothing for any actual symbols.
And again, solved by enabling power save mode:
Seems like an issue with indexing or something. Will revert back to 2024.3.2.2 for now, but if you need more info I can test it again.
e
Does it recognize
println
if you type it yourself? And does it have navigation to target?
If it does, and so completion items are the only thing missing, what I'd do to diagnose what's going on is cloning IJ community and checking out the tag that correspond to the version that doesn't work, and I'd try to remote debug by stepping through what happens in `CompletionContributor`s (e.g.
KotlinFirCompletionContributor
for K2 I believe)
s
Yes, everything else still works (you can see warnings, I can show quick docs, etc..) The only thing that's broken is the auto-complete items.
@Edoardo Luppi that's a ton of work I don't afford to do now 😅 If anything, it happened between IJ 2024.3.2.2 and 2024.3.3. Hope JetBrains figures out a fix soon!
e
Yeah it's definitely not an immediate thing to do, however it can be fun to debug it. Have you tried removing all third party IDE plugins? As it was mentioned above, a "faulty" plugin might be calling
CompletionResultSet.stopHere
because it's looking at a PSI structure that's been changed in newer versions of IDEA, or because it has more priority compared to other contributors
Seems like an issue with indexing
Without indexing working you would have no navigation to target btw
s
@Edoardo Luppi Aha, will try disabling IDE plugins and re-enabling them one by one, and see if that indicates anything. Thanks for the guidance!
✔️ 1