pi-lsp-adapter 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-lsp-adapter",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Pi extension that gives coding agents Language Server Protocol tools for diagnostics, hover, definitions, references, and symbol search",
5
5
  "author": "Nikmmd",
6
6
  "license": "MIT",
@@ -364,12 +364,29 @@ async function resolveExecutable(command: string, env: Record<string, string>, s
364
364
  return absolute;
365
365
  }
366
366
 
367
- const pathEntries = (env.PATH ?? "").split(process.platform === "win32" ? ";" : ":").filter(Boolean);
367
+ const rawPath = env.PATH ?? "";
368
+
369
+ let pathEntries: string[];
370
+ if (process.platform === "win32" && (rawPath.includes("/c/") || rawPath.includes("/usr/"))) {
371
+ // Git Bash / MSYS / MinGW expose a POSIX-style, ":"-separated PATH.
372
+ pathEntries = rawPath.split(":").filter(Boolean);
373
+ } else {
374
+ pathEntries = rawPath.split(process.platform === "win32" ? ";" : ":").filter(Boolean);
375
+ }
376
+
368
377
  const extensions = process.platform === "win32" ? (env.PATHEXT ?? ".EXE;.CMD;.BAT;.COM").split(";") : [""];
369
378
 
370
379
  for (const directory of pathEntries) {
371
380
  for (const extension of extensions) {
372
- const candidate = join(directory, `${command}${extension}`);
381
+ let normalized = directory;
382
+
383
+ // Convert an MSYS "/c/Users/foo" entry to "C:\Users\foo" for fs.access().
384
+ if (process.platform === "win32" && /^\/[a-zA-Z]\//.test(normalized)) {
385
+ const drive = normalized[1]!.toUpperCase();
386
+ normalized = `${drive}:\\${normalized.slice(3).replace(/\//g, "\\")}`;
387
+ }
388
+
389
+ const candidate = join(normalized, `${command}${extension}`);
373
390
  if (await isExecutable(candidate)) {
374
391
  return candidate;
375
392
  }
@@ -192,7 +192,10 @@ function replaceCommandPlaceholders(value: string, placeholders: Record<string,
192
192
  function getInstallBinDir(install: InstalledServerMetadata | undefined): string | undefined {
193
193
  if (install?.binDir) return install.binDir;
194
194
  const commandPath = install?.resolvedCommand[0];
195
- if (!commandPath || !commandPath.includes("/")) return undefined;
195
+ // A bare command name (e.g. "rust-analyzer") has no directory separator and
196
+ // yields no bin dir. Check for both "/" and "\\" so Windows-resolved system
197
+ // commands like "C:\\Users\\rockn\\go\\bin\\gopls.EXE" are handled too.
198
+ if (!commandPath || (!commandPath.includes("/") && !commandPath.includes("\\"))) return undefined;
196
199
  return dirname(commandPath);
197
200
  }
198
201
 
@@ -22,6 +22,17 @@ export function normalizeProcessEnv(env: NodeJS.ProcessEnv): Record<string, stri
22
22
  for (const [key, value] of Object.entries(env)) {
23
23
  if (typeof value === "string") {
24
24
  normalized[key] = value;
25
+ // On Windows, process.env is case-insensitive but a plain copied object is
26
+ // not: Windows stores PATH as "Path", so downstream reads of env.PATH would
27
+ // be undefined. Mirror only PATH/PATHEXT to upper-case keys — uppercasing
28
+ // every key could break case-sensitive variables spawned tools expect
29
+ // (GOBIN, GOPATH, ...).
30
+ if (process.platform === "win32") {
31
+ const upper = key.toUpperCase();
32
+ if (upper === "PATH" || upper === "PATHEXT") {
33
+ normalized[upper] = value;
34
+ }
35
+ }
25
36
  }
26
37
  }
27
38
  return normalized;