Skip to content

Commit b7d2e14

Browse files
committed
fix glint on wsl
1 parent 2957512 commit b7d2e14

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/main/kotlin/com/emberjs/glint/GlintLspSupportProvider.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package com.emberjs.glint
33
import com.dmarcotte.handlebars.file.HbFileType
44
import com.emberjs.gts.GtsFileType
55
import com.emberjs.utils.parentModule
6+
import com.emberjs.utils.slice
67
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer
78
import com.intellij.execution.configurations.GeneralCommandLine
89
import com.intellij.execution.process.OSProcessHandler
@@ -64,10 +65,10 @@ class GlintLspServerDescriptor(private val myProject: Project) : LspServerDescri
6465
isWsl = true
6566
}
6667
if (isWsl) {
67-
val path = "./node_modules/@glint/core/bin/glint-language-server.js"
68+
val wslWorkdir = "/" + workingDir.path.split("/").slice(4).joinToString("/")
69+
val path = "$wslWorkdir/node_modules/@glint/core/bin/glint-language-server.js"
6870
val builder = ProcessBuilder()
69-
.directory(File(workingDir.path))
70-
.command("wsl", "--", "test", "-f", "\"$path\"", "||", "echo", "\"true\"")
71+
.command("wsl", "--", "test", "-f", "\"$path\"", "&&", "echo", "\"true\"")
7172
val p = builder.start()
7273
p.waitFor()
7374
val out = p.inputStream.reader().readText().trim()
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package com.emberjs.utils
2+
3+
4+
fun <T> List<T>.slice(start: Int) = this.subList(start, this.size)
5+
fun <T> List<T>.slice(start: Int, end: Int) = this.subList(start, (end < 0).ifTrue { size + end } ?: end)
6+

0 commit comments

Comments
 (0)