https://kotlinlang.org logo
Join SlackCommunities
Powered by
# intellij-tricks
  • m

    Marc Reichelt

    08/08/2019, 2:33 PM
    set the channel topic: IntelliJ Tips & Tricks for Kotlin K development
  • j

    jermainedilao

    08/08/2019, 2:34 PM
    cmd + u = Go to super class cmd + option + b = Go to class implementations
  • j

    jermainedilao

    08/08/2019, 2:35 PM
    useful when dealing with interfaces or extending classes
  • m

    Marc Reichelt

    08/08/2019, 2:35 PM
    Yep, those are all useful, also when working with Java 🙂
  • m

    Marc Reichelt

    08/08/2019, 2:38 PM
    Which ones are your favorites regarding Kotlin?
  • m

    Marc Reichelt

    08/08/2019, 2:43 PM
    Another one I find really helpful in Kotlin: You can add names to all arguments of a constructor / function by selecting ‘Add names to call arguments’:
    • 1
    • 1
  • m

    Marc Reichelt

    08/08/2019, 2:52 PM
    Another one: wondering how the syntax of something is? E.g. you want to create a new method/ extension function / operator function? You can just write that code, type
    Alt + Enter
    on that error, and let IntelliJ figure our the syntax for you:
    👍 1
    • 1
    • 1
  • a

    Alex

    08/08/2019, 3:30 PM
    I was about to post "Introduce object destructuring", but that doesn't seem to be an option for Kotlin (I've used it before but for TS)
  • m

    Marc Reichelt

    08/08/2019, 3:39 PM
    @Alex that’s actually really cool! I just tried it out by having a data class, creating a new variable for it, and if I press
    Alt + Enter
    I get the option you mentioned:
    👍 1
    a
    • 2
    • 1
  • a

    Alex

    08/08/2019, 3:40 PM
    ah, sweet! Not sure why I didn't see the option when I just quickly tried it
  • m

    Marc Reichelt

    08/08/2019, 3:40 PM
    And this results in:
  • m

    Marc Reichelt

    08/08/2019, 3:41 PM
    I love it! Thanks a lot, I didn’t know about this option 🎉
  • m

    Marc Reichelt

    08/14/2019, 10:37 PM
    @here I collected all the tricks I could find and put it up on GitHub: https://github.com/mreichelt/kotlin-talk-intellij-tricks Maybe this is helpful to some of you! 😊
  • c

    Christian Maier

    12/02/2019, 7:09 AM
    Is IntelliJ able to complete the name and type both same time? Every time I choose a name and the corresponding type I still need to specify the type manually which is annoying..
    ➕ 1
    k
    j
    l
    • 4
    • 5
  • a

    aaverin

    02/24/2020, 7:57 AM
    Hey guys. So there are these helper generators for classes like
    generate constructor
    and
    generate hashcode
    Is there any way to write a custom generator?
    • 1
    • 3
  • t

    tapchicoma

    03/26/2020, 11:01 AM
    Not sure to whom it will be interesting, but you could use IDEA diff to see diff in files between branches without loading the whole project into IDEA:
    Copy code
    git show origin/master:path/to/file > /tmp/master_file && idea diff /tmp/master_file path/to/file
    👍 2
    m
    • 2
    • 2
  • k

    Kenneth

    09/16/2020, 7:10 AM
    Is there a shortcut to extract a dependency version from a <dependency> and create it as a property in <properties>?
    m
    • 2
    • 3
  • p

    Pratik Tandel

    11/19/2020, 8:09 PM
    Is there a way when using split view to force the width of the tab to be 120 chars or 80 chars. i find it a bit annoying to have to resize the tab sizes when i change the intellij window
  • k

    Kenneth

    12/03/2020, 10:53 PM
    Anyone know how I can make intellij find classes generated by apache cxf?
  • c

    Colton Idle

    12/04/2020, 5:30 AM
    Anyone know how to not have generated files come up when searching via cmd shift f or cmd shift o in intellij?
    b
    • 2
    • 4
  • m

    Manuel Dossinger

    08/31/2021, 9:18 AM
    Say, I have a
    data class C(val x: X, val y: Y, val z: Z)
    , and I want to create an instance. When I write something like
    val c = C(
    is there a shortcut how intellij includes all members with names? Like
    val c = C( x = |, y = , z = )
    (where
    |
    is the cursor position)
    m
    w
    • 3
    • 7
  • m

    Marc Reichelt

    09/01/2021, 6:31 AM
    Hmm, that I don’t know - I’d love that, too. Maybe someone else here in this channel knows?
  • v

    Vinay Gaba

    09/29/2021, 4:00 AM
    Hey folks! Wanted to check if there's a way to provide wildcard matching in the
    codeInsightSettings.xml
    file instead of providing providing each class or package? My use case is that I want to avoid certain methods from showing up in auto complete if their names have a certain suffix. Is there a way to do that somehow?
  • m

    Manuel Dossinger

    10/27/2021, 6:51 AM
    I just wanted to start a question, and then found the answer myself.. but it is not super obvious I think, so: If you want to search for primary constructor invocations you can command-click (don't know what it is on other platforms) on the parentheses around the short notation :)
    👍 6
    👍🏻 1
    r
    • 2
    • 1
  • w

    Wishnuprathikantam

    06/20/2023, 6:56 PM
    Hey folks! https://www.jetbrains.com/help/idea/saving-project-as-template.html I think idea has a feature where you can save your existing project as template and you can create a new project out of this and looks like they have support for variables. Although the doc is not very in depth. Anyone using this feature? Or any other alternative where I can quickly create a project with some template strings out of an existing project
  • c

    czuckie

    07/01/2023, 1:37 PM
    hey y'all, is there any shortcut for switching between active editor panes? If I split my editor into 3 or 4 (maybe even vertically!) I couldn't find any way to say 'move to the editor below current' using Action finder (CMD/CTRL+SHIFT+A). Is it possible?
    👀 1
  • m

    Manasseh

    07/30/2023, 6:41 PM
    Hey folks! Please how do I highlight multiple occurrences of a text in IDEA? (Similar to VS Code's Ctrl D)
    b
    a
    • 3
    • 5
  • m

    Manuel Dossinger

    11/18/2023, 7:06 AM
    I have a method that is totally redundant to call multiple times. Think
    Copy code
    doResetWithValue(5)
    doResetWithValue(5)
    but with less obvious names. Is there a way to get an inspection warn me about this pattern? Similar to "redundant assignment" but with my method.
    r
    x
    • 3
    • 6
  • m

    Manasseh

    02/15/2024, 10:17 PM
    Hi! How can I highlight same occurrences of a text? (e.g. in vscode, I can highlight the text and press Ctrl+D to find same occurrences).
    not kotlin but kotlin colored 1
    s
    • 2
    • 2
  • s

    Soren Roth

    11/01/2024, 6:31 PM
    Is there a way to hide a kotlin public property in an API from intellisense? Possibly I should ask in #C8C4JTXR7