Hi folks! I have plenty of scripts written with Ko...
# scripting
v
Hi folks! I have plenty of scripts written with Kotlin. Used to run them with KScript, but now want to migrate to the
main.kts
host. I’m Android developer, so my main IDE is Android Studio. I want my scripts appear as another entry in the project tree, when “android” view is enabled. I started with creating a new gradle module and including it into project, through the
settings.gradle.kts
. I converted a couple of scripts to the
.main.kts
ones, fixed imports and annotations. I put them in the root folder of the newly created module. Worth mentioning, that I converted 4 script files, 3 of which are just utilities, while the 4th one imports and uses them. I’m able to execute the 4th script file from the IDE and it works fine. However, the code navigation and highlightins are completely broken. In particular I see the following problems: • On top of each file there’s a warning saying
Multiple script definitions are applicable to this script. MainKtsScript is used.
• In the “Problems” section of every file, which imports another file, there’s a problem saying
Imported script file {path_to_another_file} is not loaded. Check your script imports
I’m particularly interested in the latter. Is there any way to “re-load” scripts? Any other suggestions on what I’m doing wrong are welcomed 🙂
BTW, if I want scripts project to show up in the main project layout, is it better to
include
it or
includeBuild
it?
Regarding the first issue - I cleaned caches as was suggested in this channel before. It didn’t help. In the settings menu I see two entries
MainKtsScript
definitions and can’t disable any of them.
🤔 1
I observe the same issue, when I import Kotlin script sample project into IntelliJ IDEA. So I suspect something is wrong with my installation.
i
Maybe it's a good idea to create an issue about it, and include some part of intellij log file that is relevant to the misbehavior.
👍 1