Reputation: 15309
I opened a folder in Android Studio which contains a Kotlin script file (.kts
). I configured a JDK as SDK in Project Structure (but I added no gradle files), and running the file as Kotlin script works fine. However the syntax highlighting is only PARTIALLY working, see below example (Linux Mint 19.3 and AS 4.1.3):
Some of the stuff missing:
val unused
).forEach
/.to
/.map
/.toInt
/...) should be yellow and italicWhat's even going on here? Is this some sort of "fallback" mode?
Any way to use the "full" syntax highlighting from normal Android projects, so I can spot mistakes earlier?
For reference, this is what it "should" look like (pasted into a random Android project):
Upvotes: 5
Views: 2411
Reputation: 402
Newer IDE versions have a Repair IDE (File->Repair IDE
) option that did the trick for me. It takes you through a set of steps - reindexing, reopening the project, invalidate cache restart etc and tries to repair the IDE.
Upvotes: 3
Reputation: 15309
Renaming the file to end in *.main.kts
(scriptname.main.kts
) enabled full highlighting for me!
Upvotes: 9
Reputation: 10300
I get this type of issues from time to time with IntelliJ IDEA. I haven't found the reason why it happens, neither do I know the 100% working solution. But here are the options that usually help me solve it:
.idea
folder and the project.iml
file and try to import the project again.I hope some of these options will help.
Upvotes: 1