Tmpod
03/10/2020, 4:15 PMide { acceptedLocations(ScriptAcceptedLocation.Everywhere) }
in the compilation settingsTmpod
03/11/2020, 12:08 PMdev
branch, more specifically https://gitlab.com/Tmpod/Korius/tree/dev/src/main/kotlin/dev/tmpod/korius/framework/scripting/ModuleScriptCompiler.ktilya.chernikov
03/12/2020, 3:54 PMTmpod
03/12/2020, 4:25 PMTmpod
03/24/2020, 1:09 AMRoman Golyshev
03/24/2020, 1:59 PMTmpod
03/24/2020, 2:05 PMilya.chernikov
03/24/2020, 2:31 PMilya.chernikov
03/24/2020, 2:33 PMilya.chernikov
03/24/2020, 2:35 PMilya.chernikov
03/24/2020, 2:37 PMKotlinScript
annotation.Tmpod
03/24/2020, 7:57 PMTmpod
03/24/2020, 7:57 PMTmpod
03/24/2020, 7:57 PMTmpod
03/24/2020, 7:58 PMTmpod
03/24/2020, 9:30 PMTmpod
03/24/2020, 9:31 PMKotlinScript
annotation and IntelliJ still can't properly highlight my scriptsilya.chernikov
03/25/2020, 8:13 AMScriptCompilationConfiguration
(see SimpleMainKtsScriptDefinition
in the example) and put a class literal reference to this class to the @KotlinScript
annotation. (The reason is that the IDE cannot know which configuration you're passing to the eval
call, so it only checks the one accessible via the annotation.)
- dependenciesFromCurrentContext
could be tricky in IntelliJ, in your case it will take the classpath from IntelliJ itself, which is probably not what you want. In the IDE setting you probably want to find your jars via some other mechanism and put it to dependencies e.g. using updateClasspath
helper.
- make sure that the updated definition is loaded by the IntelliJ. The reloading mechanisms could be unreliable, so try to restart IDE after compiling the new jar.
- the implicit receivers are not addressable via this
, use it's member without qualifier.
That's the main failure points I can think of for a moment, please check them.
You can also try to browse the IntelliJ log file (check the Help
menu) for the lines containing [kts]
and check whether there are any errors there.Tmpod
03/25/2020, 3:41 PMilya.chernikov
03/26/2020, 10:03 AMTmpod
03/26/2020, 10:49 AMilya.chernikov
03/26/2020, 11:08 AMjvm {
dependenciesFromCurrentContext(wholeClasspath = true)
}
It means that on the creating this configuration (eagerly) the dependenciesFromCurrentContext
helper will try to extract the whole classpath from the current context (via system properties or thread context classloader) and put all the extracted classpath as script compilation and evaluation dependencies, using dependencies
configuration key.
In your runtime environment it works as expected, because you creating the configuration in the correct runtime environment. But if the same configuration is created in the IntelliJ, it will take classpath of the IDE itself, so if your jar with the definition requires external dependencies, (in particular for the implicit receiver), then it will not be found, that may lead to the red code.ilya.chernikov
03/26/2020, 11:11 AMTmpod
04/05/2020, 4:26 PMupdateClasspath
?
thanks a lot for your support so far ๐ilya.chernikov
04/08/2020, 1:03 PM