fwcd / kotlin-language-server

Kotlin code completion, diagnostics and more for any editor/IDE using the Language Server Protocol
MIT License
1.65k stars 207 forks source link

No script runtime was found in the classpath: class 'kotlin.script.templates.standard.ScriptTemplateWithArgs' not found. Please add kotlin-script-runtime.jar to the module dependencies.kotlin(MISSING_SCRIPT_STANDARD_TEMPLATE) #178

Open cebaa opened 4 years ago

cebaa commented 4 years ago

Describe the bug All lines in build.gradle.kts have this error:

No script runtime was found in the classpath: class 'kotlin.script.templates.standard.ScriptTemplateWithArgs' not found. Please add kotlin-script-runtime.jar to the module dependencies.kotlin(MISSING_SCRIPT_STANDARD_TEMPLATE)

Extension version 0.2.11

Additional context gradle 0.6.1 kotlin jvm plugin 1.3.61 Used through Remote SSH on a remote Linux server gradle run from the command line on the server runs the app fine

Let me know what additional info I should provide to help troubleshooting.

cebaa commented 4 years ago

Just noticed that this was reported before as https://github.com/fwcd/kotlin-language-server/issues/159 - I guess the exception was not in textual form, but a screenshot instead, so I could not find it.

I'm not sure if these are duplicates since the current title of the #159 is "Ensure that Kotlin Script Runtime is on classpath in non-Gradle/Kotlin DSL projects", but if it is or if you want to track in one or another, might be good to either merge or close one or the other.

tobia commented 4 years ago

So how does one solve this problem?

neilabdev commented 4 years ago

+1

idiotleon commented 4 years ago

+1

Repo is here, which used to work before I re-installed my VSCode. Now I cannot run any test.

Somehow, after I installed this extension, everything works fine on my VSCode.

aripiprazole commented 4 years ago

I had this same issue in build.gradle.kts file, i am using coc.nvim

ploth commented 4 years ago

@LorenzooG, same here

ploth commented 4 years ago

This must be a bug since kotlin-language-server:83 sets the classpath to

CLASSPATH=...:$APP_HOME/lib/kotlin-script-runtime-1.3.50.jar:...

($APP_HOME confirmed to be correct) kotlin-script-runtime-1.3.50.jar contains the necessary class file. image

Test.kts: image

BluceKing commented 4 years ago

HelloWorldKotlin.iml file have a senctance about "";just turn on forText is OK;

eiva commented 3 years ago

Anybody found solution?

sigmasoldi3r commented 3 years ago

Where we can start looking for contributing? Would be nice to have .kts file support.

sigmasoldi3r commented 3 years ago

+1

Repo is here, which used to work before I re-installed my VSCode. Now I cannot run any test.

Somehow, after I installed this extension, everything works fine on my VSCode.

For me it does not solve the problem, the extension just stops working (And thus no errors are shown). Maybe it has more priority one extension than another?

tekumara commented 3 years ago

This error vanished for me when I restarted vscode.

jlengrand commented 3 years ago

I can confirm the same happening as well after installing the extension for gradle.kts files. All Kotlin (.kt) files get detected correctly however. Restarting VSCode did not solve the issue.

eiiot commented 2 years ago

Same issue here, present after restarting.

gimbling-away commented 2 years ago

+1

devmike01 commented 2 years ago

I'm having this same issue.

tekumara commented 2 years ago

This can happen when your project's classpath doesn't contain the kotlin-script-runtime jar.

In my case, my project's pom.xml was incorrect and it didn't resolve and so the jar was missing from the dependency tree.

Once I fixed pom.xml it became visible in the Maven window:

Screen Shot 2022-03-18 at 3 46 09 pm

I then went to Command Palette - Kotlin: Restart the Language Server to resolve the issue.

Chasson1992 commented 1 year ago

This can happen when your project's classpath doesn't contain the kotlin-script-runtime jar.

In my case, my project's pom.xml was incorrect and it didn't resolve and so the jar was missing from the dependency tree.

Once I fixed pom.xml it became visible in the Maven window:

Screen Shot 2022-03-18 at 3 46 09 pm

I then went to Command Palette - Kotlin: Restart the Language Server to resolve the issue.

I'm transitioning from using groovy Gradle scripts to Kotlin and installed this extensions and had the issue listed in this ticket. Going to Command Palette and executing Kotlin: Restart the Language Server resolved the issue for me as well. Also running VS Code with the Remote SSH extension.

VS Code: 1.73.1 Gradle: 7.5.1 Kotlin Extensions: v0.2.26

A couple things: