diff --git a/src/main/kotlin/com/emberjs/glint/GlintLspSupportProvider.kt b/src/main/kotlin/com/emberjs/glint/GlintLspSupportProvider.kt index bd197ed6..71524064 100644 --- a/src/main/kotlin/com/emberjs/glint/GlintLspSupportProvider.kt +++ b/src/main/kotlin/com/emberjs/glint/GlintLspSupportProvider.kt @@ -3,6 +3,7 @@ package com.emberjs.glint import com.dmarcotte.handlebars.file.HbFileType import com.emberjs.gts.GtsFileType import com.emberjs.utils.parentModule +import com.emberjs.utils.slice import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer import com.intellij.execution.configurations.GeneralCommandLine import com.intellij.execution.process.OSProcessHandler @@ -64,10 +65,10 @@ class GlintLspServerDescriptor(private val myProject: Project) : LspServerDescri isWsl = true } if (isWsl) { - val path = "./node_modules/@glint/core/bin/glint-language-server.js" + val wslWorkdir = "/" + workingDir.path.split("/").slice(4).joinToString("/") + val path = "$wslWorkdir/node_modules/@glint/core/bin/glint-language-server.js" val builder = ProcessBuilder() - .directory(File(workingDir.path)) - .command("wsl", "--", "test", "-f", "\"$path\"", "||", "echo", "\"true\"") + .command("wsl", "--", "test", "-f", "\"$path\"", "&&", "echo", "\"true\"") val p = builder.start() p.waitFor() val out = p.inputStream.reader().readText().trim() diff --git a/src/main/kotlin/com/emberjs/utils/ListExt.kt b/src/main/kotlin/com/emberjs/utils/ListExt.kt new file mode 100644 index 00000000..d7266510 --- /dev/null +++ b/src/main/kotlin/com/emberjs/utils/ListExt.kt @@ -0,0 +1,6 @@ +package com.emberjs.utils + + +fun List.slice(start: Int) = this.subList(start, this.size) +fun List.slice(start: Int, end: Int) = this.subList(start, (end < 0).ifTrue { size + end } ?: end) +