@@ -8,6 +8,8 @@ import com.intellij.javascript.nodejs.interpreter.NodeJsInterpreterRef
88import com.intellij.javascript.nodejs.reference.NodeModuleManager
99import com.intellij.lsp.*
1010import com.intellij.openapi.Disposable
11+ import com.intellij.openapi.application.Application
12+ import com.intellij.openapi.application.ApplicationManager
1113import com.intellij.openapi.components.Service
1214import com.intellij.openapi.project.Project
1315import com.intellij.openapi.project.guessProjectDir
@@ -59,14 +61,17 @@ class GlintLspServerDescriptor(private val myProject: Project) : LspServerDescri
5961 .withParentEnvironmentType(GeneralCommandLine .ParentEnvironmentType .CONSOLE )
6062 .withWorkDirectory(workDirectory)
6163
62- val glintPkg = NodeModuleManager .getInstance(project).collectVisibleNodeModules(workingDir).find { it.name == " @glint/core" }?.virtualFile
63- ? : throw RuntimeException (" glint is not installed" )
64- val file = glintPkg.findFileByRelativePath(" bin/glint-language-server.js" )
65- ? : throw RuntimeException (" glint lsp was not found" )
66- // commandLine.addParameter("--inspect")
67- commandLine.addParameter(file.path)
68- commandLine.addParameter(" --stdio" )
69- commandLine.addParameter(" --clientProcessId=" + OSProcessUtil .getCurrentProcessId().toString())
64+ ApplicationManager .getApplication().runReadAction {
65+ val glintPkg = NodeModuleManager .getInstance(project).collectVisibleNodeModules(workingDir).find { it.name == " @glint/core" }?.virtualFile
66+ ? : throw RuntimeException (" glint is not installed" )
67+ val file = glintPkg.findFileByRelativePath(" bin/glint-language-server.js" )
68+ ? : throw RuntimeException (" glint lsp was not found" )
69+ // commandLine.addParameter("--inspect")
70+ commandLine.addParameter(file.path)
71+ commandLine.addParameter(" --stdio" )
72+ commandLine.addParameter(" --clientProcessId=" + OSProcessUtil .getCurrentProcessId().toString())
73+ }
74+
7075
7176 NodeCommandLineConfigurator
7277 .find(NodeJsInterpreterRef .createProjectRef().resolve(project)!! )
0 commit comments