https://kotlinlang.org logo
Join Slack
Powered by
# intellij
  • j

    Ji-Hoon Kim

    05/23/2025, 12:50 AM
    Hello, everyone! I have a question about creating Kotlin test code. When I create a Kotlin test, both a TestClass.java file and a Kotlin JUnit5 Test Class.kt file are generated. However, when I disable K2 mode, only the TestClass.kt file is created. Is there any solution to prevent the TestClass.java file from being generated, or to ensure only the Kotlin test file is created regardless of the K2 mode?
    • 1
    • 1
  • r

    Rok Oblak

    05/23/2025, 7:34 AM
    What is the reasoning behind this? I don't think it makes it clearer. If i have a nullable boolean, then
    ?: false
    implies "default to false". I find this more readable than
    == ...
    .
    ➕ 4
    k
    r
    +3
    • 6
    • 13
  • r

    Rob Elliot

    05/23/2025, 9:54 AM
    In IntelliJ my
    .main.kts
    scripts don't know about the Java stdlib - lots of: Cannot access 'Object' which is a supertype of 'ObjectMapper'. Check your module classpath for missing or conflicting dependencies. Cannot access 'Serializable' which is a supertype of 'ObjectMapper'. Check your module classpath for missing or conflicting dependencies. I can't work out how to tell the script about them?
  • d

    drewhannay

    05/23/2025, 10:57 PM
    is there a way to write live templates that reference the FQN of Kotlin extension functions? So that they will be auto-imported
  • c

    Chris Lee

    05/24/2025, 12:44 AM
    Oops. Someone @ JB forgot to renew a certificate…
    s
    • 2
    • 4
  • w

    wasyl

    05/28/2025, 9:08 AM
    Are there any issues filed already for
    switcher
    and
    recent files
    behavior on IJ 2025.2 EAP? EAP 1 was completely broken, EAP 2 is broken as well but a bit less • EAP 1 would seemingly populate
    recent files
    dialog with indexed files? It would show tons of generated files that were never open. In EAP 2 I still get unopened files, but only sometimes and it's just one file • in EAP 2 the
    switcher
    (ctrl + tab on mac) doesn't show recently opened file anymore, and when invoked doesn't return the cursor to the place it was previously. In 2025.1.x, pressing
    ctrl + tab
    repeatedly will toggle between two files, in 2025.2 the
    switcher
    files don't match recent files at all if not I'll file some later, just curious if there's some new setting or something that I'm missing
  • r

    robstoll

    05/28/2025, 3:45 PM
    I like how I am able to jump to a method when using JUnit's MethodSource, is there a way to define the same behaviour for a custom annotation, also requiring a method name?
    not kotlin but kotlin colored 1
    e
    e
    • 3
    • 10
  • k

    Kirill Grouchnikov

    05/28/2025, 9:37 PM
    At first I was confused because we just had Java 24 release a couple months ago
    🚀 1
    🎂 2
    😂 11
    same 1
  • g

    Grigory Panko

    05/29/2025, 3:06 PM
    Is there a way to make declarations which are only used in tests be highlighted as unused? We're actively adding unit tests in our large project and I'm afraid this will result in a lot of unused code in the long term
    e
    • 2
    • 3
  • k

    Karlo Lozovina

    05/29/2025, 11:04 PM
    Is there a way for Intellij to warn when commiting only specific TODOs? For example, I don't want it to complain on TODO and FIXME, but would like to stop the commit on NOCOMMIT tokens in the code? As far as I can see, either it checks for any possible TODO or none at all...
    a
    e
    • 3
    • 2
  • a

    Artyom Gornostayev

    06/01/2025, 4:01 PM
    Hey guys. After installation of the Kotlin Multiplatform Plugin to IntelliJ IDEA 2025.1.1.1 cannot find option
    Compact Middle Packages
    in Project tab. Does anybody have this problem?
    😱 1
    • 1
    • 2
  • h

    holgerbrandl

    06/01/2025, 8:31 PM
    Is this a known (k2) bug?
    Copy code
    data class Foo(val id: String) {
        override fun toString(): String = id
    }
    
     class Bar(val id: String)
    
    class Test
    class Test2
    
    fun main() {
    
        val foo = Foo("1")
        val bar = Bar("2")
    
        // why is not flagged as well?
        if(foo != bar) println("not equal")
    
        if(Test() != Test2()) println("not equal")
    }
    The first condition is not flagged. The issues seems to affect only cases where the left-hand side argument of != is a data class.
    c
    • 2
    • 2
  • a

    Austin

    06/03/2025, 4:29 PM
    Does K2 mode support postfix templates? No matter what I do none seem to work until I revert back to K1 on 2025.2 EAP 3
    w
    a
    • 3
    • 5
  • k

    krzysztof

    06/04/2025, 5:48 PM
    Is there a way to debug CMP app on ios side? I can run the app from intelij (2025.1.1 CE), but the debug button is greyed out. I enabled Experimental multiplatform IDE features, but still doesn’t work
  • r

    Rob Elliot

    06/05/2025, 11:46 AM
    Well this confused the crap out of me: https://youtrack.jetbrains.com/issue/IDEA-374036/In-K2-mode-compile-errors-are-not-shown-in-very-specific-circumstances
    k
    • 2
    • 2
  • v

    voohbar

    06/06/2025, 5:48 PM
    Hello, is this a known bug? Renaming a Kotlin field is not executed correctly in Java. It drops the
    get
    prefix. Are there any known workarounds? Version: IntelliJ IDEA 2025.1.2 (Ultimate Edition) Build: #IU-251.26094.121, built on June 2, 2025 Kotlin Compiler: K2
    Screen Recording 2025-06-06 at 10.40.28 AM.mov
    h
    l
    a
    • 4
    • 6
  • e

    Edoardo Luppi

    06/17/2025, 7:44 AM
    K1 IDE broken in the latest EAP? Anyone can reproduce?
    Copy code
    com.intellij.diagnostic.PluginException: Class org.jetbrains.kotlin.idea.core.script.k1.modules.ScriptDependenciesInfo$ForProject must not be requested from main classloader of org.jetbrains.kotlin plugin. Matches content module (packagePrefix=org.jetbrains.kotlin.idea.core.script.k1., moduleName=kotlin.base.scripting.k1). [Plugin: org.jetbrains.kotlin]
    	at com.intellij.ide.plugins.cl.PluginClassLoader.tryLoadingClass(PluginClassLoader.kt:185)
    	at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.kt:154)
    	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
    w
    a
    • 3
    • 25
  • i

    Isaac Udy

    06/18/2025, 6:07 AM
    Feeling quite frustrated at the moment; I'm using IntelliJ 2025.1.2 and I can't get the
    .idea
    folder to show up in the project files view. I can see it in Android Studio, if I open that instead, and even if I add a custom scope to the project it still won't show up in that custom scope. Does anyone know how to set this up? The new Kotlin Multiplatform plugin requires some .idea configuration to allow xcode run configurations to become visible, and it's very annoying needing to open the files externally to edit them.
    b
    c
    f
    • 4
    • 8
  • p

    PHondogo

    06/19/2025, 10:11 AM
    Copy code
    do {
        // some code here
        TODO()
    } while (true) // warning for unreachable code with suggestion to replace with 'while()'. It is unreachable but in this case i think it should be ok
    p
    m
    • 3
    • 3
  • e

    Edoardo Luppi

    06/19/2025, 10:19 AM
    https://blog.jetbrains.com/platform/2025/06/testing-a-fresh-look-for-jetbrains-ides/
    👍 4
    👍🏽 1
    b
    c
    +2
    • 5
    • 29
  • l

    loke

    06/20/2025, 2:25 PM
    I have a positive message. I'm happy to see that type-aware completion (i.e. the feature that is bound to control-shift-space by default) has finally been implemented in the latest EAP. Now, I have a question for everybody: During the time when it wasn't available, I was quite frustrated and stayed on K1 for quite a while because of it. When talking to JB about it, I learned that they implemented features based on their statistics, and implemented features that was used a lot first. That makes sense, but it seems weird to me that type-aware-completion was only used by a single-digit-percent of users. If people are not using it, then what do they use?
    👀 1
    b
    w
    c
    • 4
    • 21
  • h

    hho

    06/23/2025, 4:17 PM
    It seems I can't debug a
    .main.kts
    script in IntelliJ IDEA ... it runs, but no breakpoints ever trigger anything. Is that a known limitation? (2025.2 EAP with K2)
    v
    • 2
    • 2
  • b

    bod

    06/24/2025, 12:16 PM
    Anyone knows if there's a way to monitor arbitrary logs in IJ? I know this exists, but I'm outside the context of a running configuration.
    l
    c
    • 3
    • 33
  • d

    darkmoon_uk

    06/26/2025, 1:39 AM
    Getting these sorts of erroneous type errors all over a mixed Java/Kotlin module. (required type: T provided: T 🙃) Compiles fine however. Build #IU-251.26927.53 - ❗*Only occurs when K2 is enabled* ❗- known issue?
    a
    s
    • 3
    • 16
  • a

    Alexander Weickmann

    06/26/2025, 8:11 AM
    I have a kotlin js project that builds fine using gradlew clean build. But in IntelliJ, the dependencies are not resolved, so I get for example "Unresolved reference: react" Can anybody give a hint what might be wrong? Tried already invalidate cache and restart, unlink / relink project, refresh gradle dependencies, delete .gradle and .idea folders Does not happen with IntelliJ 2024. Maybe our KotlinJS project is too old and no longer compatible with new intellij versions :(
  • m

    mbonnin

    06/26/2025, 2:17 PM
    What's the status with
    main.kts
    and K2? I just had to disable K2 again to get autocomplete 🤔 on
    IntelliJ IDEA 2025.2 EAP
    . Am I missing something? Can you do
    main.kts
    with K2?
    • 1
    • 1
  • k

    Kirill Grouchnikov

    06/26/2025, 5:11 PM
    Under the last two 2025.2 EAP builds, if you get this error message trying to debug a Java app (see in the thread for the fix)
    a
    • 2
    • 3
  • d

    darkmoon_uk

    06/29/2025, 7:08 AM
    I really enjoy being able to write
    .kts
    scripts instead of `.sh`; keeping more complex scripts in a powerful, familiar language. Unfortunately the usefulness of
    kts
    is unduly limited by IntelliJ IDE's failure to resolve symbols across
    @file:Import
    dependencies - meanwhile the scripts still run fine. This problem has only become more impactful with junie Junie; as the agent sees 'unresolved' false positives and erroneously act upon them, struggling for a fix that never comes. kodee sad This limitation is very sad, given it's been hanging for over 2 years... KTIJ-16352 Scripts / IDE: unresolved reference when trying to import file in main.kts scripts with @Import annotation Any insights into this issue in or outside of JB? Is scripting just abandoned beyond what's needed for Gradle? Such a shame, it's a killer feature in my book. Slack Conversation
  • s

    Sargun Vohra

    07/01/2025, 1:48 AM
    Is context-sensitive resolution supported by the IDE yet? I added
    -Xcontext-sensitive-resolution
    to my compiler args but the IDE still highlights code red where I use it
    a
    • 2
    • 10
  • h

    hfhbd

    07/01/2025, 9:15 AM
    Is there any table which Kotlin version is used by the Kotlin IntelliJ plugin? I want to use kotlin.k2.only.bundled.compiler.plugins.enabled=false but I needed to migrate to the 2.2.0 FIR api (using context parameters in the FIR checkers), but IntelliJ does not use the new api yet, so my checker does not work.
    a
    • 2
    • 7