Colton Idle

    Colton Idle

    1 year ago
    What's the keyboard shortcut to wrap a composable in a Col or Row quickly? I highlighted a Text("adsf") and wanted to "surround with" with a Column. I thought there was a way to do this out of the box? I searched slack but only result was regarding a plugin, but I thought this came out of the box?
    k

    knthmn

    1 year ago
    Intellij already has the feature called Live Tempalteshttps://www.jetbrains.com/help/idea/using-live-templates.html The template for
    Column
    is already defined, you can see it in settings
    Editor > Live Templates > AndroidCompose
    . Press
    Ctrl + Alt + T
    to wrap the code with a template
    Colton Idle

    Colton Idle

    1 year ago
    Am I looking in the right spot? I don't see AndroidCompose? And is that keyboard shortcut for macOS or windows?
    k

    knthmn

    1 year ago
    You can add your own live templates for whatever tasks you want. There are presets that come with the installation, the compose ones probably didn't exist when you installed Android Studio. The "surround with column" looks like this
    $WIDGET$ {
     $SELECTION$$END$ 
     }
    where
    $WIDGET$
    is a defined variable with expression
    "androidx.compose.foundation.layout.Column"
    You can also look at examples in AndroidLogKotlin to see how live template works