Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/main/kotlin/com/emberjs/glint/GlintLspSupportProvider.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down
6 changes: 6 additions & 0 deletions src/main/kotlin/com/emberjs/utils/ListExt.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.emberjs.utils


fun <T> List<T>.slice(start: Int) = this.subList(start, this.size)
fun <T> List<T>.slice(start: Int, end: Int) = this.subList(start, (end < 0).ifTrue { size + end } ?: end)

Loading