Android Studio Electric Eel と Room 2.5.0 の組み合わせで @Query
に書いている SQL のハイライトがなくなり、コードジャンプも使えない現象が発生します。
この問題の回避策を書いておきます。
回避策
「Android Studio」 → 「Settings」 を開き、「Editor」 → 「Language Injections」 を開く
+ ボタンから 「Generic Kotlin」 を選択し、「Name」 には任意の名前、「ID」 には 「RoomSql」、「Places Patterns」 には以下の内容を入力する。
+ kotlinParameter().ofFunction(0, kotlinFunction().withName("Query").definedInClass("androidx.room.Query"))
+ kotlinParameter().ofFunction(0, kotlinFunction().withName("DatabaseView").definedInClass("androidx.room.DatabaseView"))
最後に追加した内容を適用すると Room の @Query
に書かれている SQL にハイライトやコードジャンプが復活する。
別の回避策として Android Studio Flamingo を使うという手もあります。
(Electric Eel に修正パッチが来るかは不明)