Created
May 23, 2022 15:01
-
-
Save rock3r/066bc88c376b871bcd1f3402cf27a3a0 to your computer and use it in GitHub Desktop.
rms — live template to insert/surround with "val ... by remember { mutableStateOf(...) }"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template name="rms" value="val $name$ by androidx.compose.runtime.remember { androidx.compose.runtime.mutableStateOf($SELECTION$$END$) }" description="Remember mutableState" toReformat="false" toShortenFQNames="true"> | |
<variable name="name" expression="kotlinSuggestVariableName()" defaultValue="name" alwaysStopAt="true" /> | |
<context> | |
<option name="KOTLIN_EXPRESSION" value="true" /> | |
</context> | |
</template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Remember Mutable State
This is an IJ/AS live template to insert/surround with
val ... by remember { mutableStateOf(...) }
.Installing on your IDE
Using the live template
You can create a new variable by typing
rms
in the editor then pressing the expansion key (Tab by default), or surround an existing value with the "Surround with Live Template" action (Ctrl + Alt + J on Windows and Linux, Cmd + Alt + J on macOS)rms-demo.mp4
License
This live template is freely usable by anyone, although I'd appreciate a shout out if you end up embedding it or using this idea.