Can I call JS inside my Kotlin plugin?

Answered

Hi

I saw this section in the kotlin docs

https://kotlinlang.org/docs/using-packages-from-npm.html

Can I use this in my plugin or is the jvm the only platform that is supported?

I would like to use a js sdk in my plugin, namely @inlang/sdk. It would allow me to implement intentions and hints more robustly.

If you have a solution, please tell me

Currently, I created a node script and then I call it using Runtime.getRuntime().exec(…), which is quite cumbersome.

Thank you

0
2 comments

I think I found the answer, we can't mix both jvm and js

https://slack-chats.kotlinlang.org/t/527066/how-to-resolve-the-cannot-add-extension-with-name-kotlin-as-

I think a cli or LS could be the solution for this

Cheers

0

Hi,

Regular plugins target JVM.

There are JS-supporting alternatives (Flora, LivePlugin), but I don't think they allow using external packages.

1

Please sign in to leave a comment.