r/androiddev • u/dmytrodanylyk Atlassian • Nov 29 '17
Don't forget to inject Android Room SQL language for syntax highlight and autocomplete!
3
u/deinlandel Nov 29 '17
Does it also handle actual database column names etc? I've never figured out how to hook up device database explorer to Android Studio
2
1
u/benol Android Studio Team Nov 29 '17
Completion inside @Query is currently based on the "Room schema" as defined by entity classes. We don't maintain a connection to the device.
18
u/leonce18 Nov 29 '17
I actually have never used Room, but this screenshot itself is enough to get me on it :)
8
u/benol Android Studio Team Nov 29 '17
You also get go-to-definition (ctrl-click) from columns and tables to classes and fields. Renaming the class rewrites SQL, you can also right click a table name to rename the class etc. (there are some limitations).
This feature is a lot smarter in 3.1 canaries if you're curious.
1
5
3
2
u/Plazmaz1 Nov 29 '17
I read 'SQL' and 'Inject' in the same sentence and those this was /r/netsec for a second there...
1
u/CodeToDeath Nov 29 '17
What does the AndroidDataBinding option do? (I'm using data binding. So curious to know about this option and how to use it)
2
u/benol Android Studio Team Nov 29 '17
It's the language injected into XML attributes when using data binding. You should have no need to ever inject it manually.
1
Nov 29 '17
Woah, neat! I remember wondered about such feature. Didn't know that it already existed. Thanks!
-1
u/ZakTaccardi Android Developer Nov 29 '17
1
18
Nov 29 '17
[removed] — view removed comment
5
u/dmytrodanylyk Atlassian Nov 29 '17
Yes
9
u/benol Android Studio Team Nov 29 '17
It's https://youtrack.jetbrains.com/issue/KT-13636. We're trying to fix it in upstream Kotlin.
1
5
u/la__bruja Nov 29 '17
What color scheme is it? Also great tip, never thought it's possible