Skip to content

Commit 219e5ac

Browse files
committed
fix(client): set { shell: true } in server options for "deno.{bat,cmd}"
Fixes "Deno Language Server client: couldn't create connection to server. Error: spawn EINVAL" #1257 I've debugged it locally to ensure it works on my Windows PC.
1 parent e163987 commit 219e5ac

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

client/src/commands.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ import { DenoServerInfo } from "./server_info";
3232
import * as dotenv from "dotenv";
3333
import * as vscode from "vscode";
3434
import { LanguageClient, ServerOptions } from "vscode-languageclient/node";
35-
import type { Location, Position } from "vscode-languageclient/node";
35+
import type {
36+
Executable,
37+
Location,
38+
Position,
39+
} from "vscode-languageclient/node";
3640
import { getWorkspacesEnabledInfo, isPathEnabled } from "./enable";
3741
import { denoUpgradePromptAndExecute } from "./upgrade";
3842
import * as fs from "fs";
@@ -164,19 +168,21 @@ export function startLanguageServer(
164168
env["NO_COLOR"] = "1";
165169
env["DENO_V8_FLAGS"] = getV8Flags();
166170

171+
const shell = process.platform === "win32" &&
172+
/\.([Cc][Mm][Dd]|[Bb][Aa][Tt])$/.test(command);
167173
const serverOptions: ServerOptions = {
168174
run: {
169175
command,
170176
args: ["lsp"],
171-
options: { env },
172-
},
177+
options: { env, shell },
178+
} as Executable,
173179
debug: {
174180
command,
175181
// disabled for now, as this gets super chatty during development
176182
// args: ["lsp", "-L", "debug"],
177183
args: ["lsp"],
178-
options: { env },
179-
},
184+
options: { env, shell },
185+
} as Executable,
180186
};
181187
const client = new LanguageClient(
182188
LANGUAGE_CLIENT_ID,

0 commit comments

Comments
 (0)