Skip to content

Commit

Permalink
fix(lsp): Convert opening file path for WSL2
Browse files Browse the repository at this point in the history
  • Loading branch information
siketyan committed Nov 22, 2024
1 parent c110c37 commit 383d2b1
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ class TypeSpecLspServerDescriptor(
project: Project,
root: VirtualFile,
version: String,
private val interpreter: NodeJsInterpreter,
interpreter: NodeJsInterpreter,
private val tspServerFile: VirtualFile
) : LspServerDescriptor(project, "TypeSpec $version", root) {
private val commandLineConfigurator = NodeCommandLineConfigurator.find(interpreter)

override val lspSemanticTokensSupport = object : LspSemanticTokensSupport() {
override fun getTextAttributesKey(tokenType: String, modifiers: List<String>) =
when (tokenType) {
Expand All @@ -43,9 +45,12 @@ class TypeSpecLspServerDescriptor(

override fun createCommandLine() = GeneralCommandLine().also {
it.addParameters(tspServerFile.path, "--stdio")
NodeCommandLineConfigurator.find(interpreter).configure(it)
commandLineConfigurator.configure(it)
}

override fun getFilePath(file: VirtualFile): String =
commandLineConfigurator.convertLocalPathToRemote(file.path)

companion object {
fun isSupportedFile(file: VirtualFile) =
TypeSpecFileType.isMyFile(file) ||
Expand Down

0 comments on commit 383d2b1

Please sign in to comment.