pi-lens 3.1.2 → 3.2.0

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.
Files changed (154) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/README.md +16 -12
  3. package/clients/ast-grep-client.js +8 -1
  4. package/clients/ast-grep-client.ts +9 -1
  5. package/clients/biome-client.js +51 -38
  6. package/clients/biome-client.ts +60 -58
  7. package/clients/dependency-checker.js +30 -1
  8. package/clients/dependency-checker.ts +35 -1
  9. package/clients/dispatch/__tests__/runner-registration.test.ts +286 -282
  10. package/clients/dispatch/bus-dispatcher.js +15 -14
  11. package/clients/dispatch/bus-dispatcher.ts +32 -25
  12. package/clients/dispatch/dispatcher.js +18 -25
  13. package/clients/dispatch/dispatcher.test.ts +2 -1
  14. package/clients/dispatch/dispatcher.ts +17 -28
  15. package/clients/dispatch/plan.js +77 -32
  16. package/clients/dispatch/plan.ts +78 -32
  17. package/clients/dispatch/runners/ast-grep-napi.js +36 -376
  18. package/clients/dispatch/runners/ast-grep-napi.ts +60 -433
  19. package/clients/dispatch/runners/index.js +8 -4
  20. package/clients/dispatch/runners/index.ts +8 -4
  21. package/clients/dispatch/runners/lsp.js +65 -0
  22. package/clients/dispatch/runners/lsp.ts +125 -0
  23. package/clients/dispatch/runners/oxlint.js +2 -2
  24. package/clients/dispatch/runners/oxlint.ts +2 -2
  25. package/clients/dispatch/runners/pyright.js +24 -8
  26. package/clients/dispatch/runners/pyright.ts +28 -14
  27. package/clients/dispatch/runners/rust-clippy.js +2 -2
  28. package/clients/dispatch/runners/rust-clippy.ts +2 -4
  29. package/clients/dispatch/runners/tree-sitter.js +14 -2
  30. package/clients/dispatch/runners/tree-sitter.ts +15 -2
  31. package/clients/dispatch/runners/ts-lsp.js +3 -3
  32. package/clients/dispatch/runners/ts-lsp.ts +8 -5
  33. package/clients/dispatch/runners/yaml-rule-parser.js +292 -0
  34. package/clients/dispatch/runners/yaml-rule-parser.ts +338 -0
  35. package/clients/dispatch/types.js +3 -0
  36. package/clients/dispatch/types.ts +3 -0
  37. package/clients/formatters.js +67 -14
  38. package/clients/formatters.ts +68 -15
  39. package/clients/installer/index.js +78 -10
  40. package/clients/installer/index.ts +519 -426
  41. package/clients/jscpd-client.js +28 -0
  42. package/clients/jscpd-client.ts +41 -3
  43. package/clients/knip-client.js +30 -1
  44. package/clients/knip-client.ts +34 -2
  45. package/clients/lsp/__tests__/client.test.ts +64 -41
  46. package/clients/lsp/__tests__/config.test.ts +25 -17
  47. package/clients/lsp/__tests__/launch.test.ts +108 -43
  48. package/clients/lsp/__tests__/service.test.ts +76 -48
  49. package/clients/lsp/client.js +87 -2
  50. package/clients/lsp/client.ts +150 -6
  51. package/clients/lsp/config.js +8 -11
  52. package/clients/lsp/config.ts +24 -21
  53. package/clients/lsp/index.js +69 -0
  54. package/clients/lsp/index.ts +82 -0
  55. package/clients/lsp/interactive-install.js +19 -8
  56. package/clients/lsp/interactive-install.ts +52 -27
  57. package/clients/lsp/launch.js +182 -32
  58. package/clients/lsp/launch.ts +241 -38
  59. package/clients/lsp/path-utils.js +3 -46
  60. package/clients/lsp/path-utils.ts +11 -51
  61. package/clients/lsp/server.js +93 -71
  62. package/clients/lsp/server.ts +173 -131
  63. package/clients/path-utils.js +142 -0
  64. package/clients/path-utils.ts +153 -0
  65. package/clients/ruff-client.js +33 -4
  66. package/clients/ruff-client.ts +44 -13
  67. package/clients/safe-spawn.js +3 -1
  68. package/clients/safe-spawn.ts +3 -1
  69. package/clients/services/effect-integration.js +11 -7
  70. package/clients/services/effect-integration.ts +34 -26
  71. package/clients/sg-runner.js +51 -9
  72. package/clients/sg-runner.ts +58 -15
  73. package/clients/tree-sitter-client.js +12 -0
  74. package/clients/tree-sitter-client.ts +12 -0
  75. package/clients/typescript-client.js +6 -2
  76. package/clients/typescript-client.ts +9 -2
  77. package/commands/booboo.js +2 -4
  78. package/commands/booboo.ts +2 -4
  79. package/index.ts +377 -93
  80. package/package.json +2 -1
  81. package/rules/tree-sitter-queries/tsx/no-nested-links.yml +45 -0
  82. package/rules/tree-sitter-queries/typescript/constructor-super.yml +55 -0
  83. package/rules/tree-sitter-queries/typescript/debugger.yml +1 -1
  84. package/rules/tree-sitter-queries/typescript/no-dupe-class-members.yml +47 -0
  85. package/tsconfig.json +1 -1
  86. package/clients/__tests__/file-time.test.js +0 -216
  87. package/clients/__tests__/format-service.test.js +0 -245
  88. package/clients/__tests__/formatters.test.js +0 -271
  89. package/clients/agent-behavior-client.test.js +0 -94
  90. package/clients/ast-grep-client.test.js +0 -129
  91. package/clients/ast-grep-client.test.ts +0 -155
  92. package/clients/biome-client.test.js +0 -144
  93. package/clients/cache-manager.test.js +0 -197
  94. package/clients/complexity-client.test.js +0 -234
  95. package/clients/dependency-checker.test.js +0 -60
  96. package/clients/dispatch/__tests__/autofix-integration.test.js +0 -245
  97. package/clients/dispatch/__tests__/runner-registration.test.js +0 -236
  98. package/clients/dispatch/dispatcher.edge.test.js +0 -82
  99. package/clients/dispatch/dispatcher.format.test.js +0 -46
  100. package/clients/dispatch/dispatcher.inline.test.js +0 -74
  101. package/clients/dispatch/dispatcher.test.js +0 -115
  102. package/clients/dispatch/runners/architect.test.js +0 -138
  103. package/clients/dispatch/runners/ast-grep-napi.test.js +0 -106
  104. package/clients/dispatch/runners/oxlint.test.js +0 -230
  105. package/clients/dispatch/runners/pyright.test.js +0 -98
  106. package/clients/dispatch/runners/python-slop.test.js +0 -203
  107. package/clients/dispatch/runners/scan_codebase.test.js +0 -89
  108. package/clients/dispatch/runners/shellcheck.test.js +0 -98
  109. package/clients/dispatch/runners/spellcheck.test.js +0 -158
  110. package/clients/dispatch/runners/ts-slop.test.js +0 -180
  111. package/clients/dispatch/runners/ts-slop.test.ts +0 -230
  112. package/clients/dogfood.test.js +0 -201
  113. package/clients/file-kinds.test.js +0 -169
  114. package/clients/go-client.test.js +0 -127
  115. package/clients/jscpd-client.test.js +0 -127
  116. package/clients/knip-client.test.js +0 -112
  117. package/clients/lsp/__tests__/client.test.js +0 -325
  118. package/clients/lsp/__tests__/config.test.js +0 -166
  119. package/clients/lsp/__tests__/error-recovery.test.js +0 -213
  120. package/clients/lsp/__tests__/integration.test.js +0 -127
  121. package/clients/lsp/__tests__/launch.test.js +0 -260
  122. package/clients/lsp/__tests__/server.test.js +0 -259
  123. package/clients/lsp/__tests__/service.test.js +0 -417
  124. package/clients/metrics-client.test.js +0 -141
  125. package/clients/ruff-client.test.js +0 -132
  126. package/clients/rust-client.test.js +0 -108
  127. package/clients/sanitize.test.js +0 -177
  128. package/clients/secrets-scanner.test.js +0 -100
  129. package/clients/services/__tests__/effect-integration.test.js +0 -86
  130. package/clients/test-runner-client.test.js +0 -192
  131. package/clients/todo-scanner.test.js +0 -301
  132. package/clients/type-coverage-client.test.js +0 -105
  133. package/clients/typescript-client.codefix.test.js +0 -157
  134. package/clients/typescript-client.test.js +0 -105
  135. package/commands/clients/ast-grep-client.js +0 -250
  136. package/commands/clients/ast-grep-parser.js +0 -86
  137. package/commands/clients/ast-grep-rule-manager.js +0 -91
  138. package/commands/clients/ast-grep-types.js +0 -9
  139. package/commands/clients/biome-client.js +0 -380
  140. package/commands/clients/complexity-client.js +0 -667
  141. package/commands/clients/file-kinds.js +0 -177
  142. package/commands/clients/file-utils.js +0 -40
  143. package/commands/clients/jscpd-client.js +0 -169
  144. package/commands/clients/knip-client.js +0 -211
  145. package/commands/clients/ruff-client.js +0 -297
  146. package/commands/clients/safe-spawn.js +0 -88
  147. package/commands/clients/scan-utils.js +0 -83
  148. package/commands/clients/sg-runner.js +0 -190
  149. package/commands/clients/types.js +0 -11
  150. package/commands/clients/typescript-client.js +0 -505
  151. package/commands/rate.test.js +0 -119
  152. package/rules/ast-grep-rules/rules/no-dangerously-set-inner-html.yml +0 -13
  153. package/rules/ast-grep-rules/rules/no-debugger.yml +0 -12
  154. package/rules/ast-grep-rules/rules/no-eval.yml +0 -13
@@ -6,6 +6,7 @@
6
6
  * - Auto-installation strategies
7
7
  * - Platform-specific handling
8
8
  */
9
+ import { stat } from "node:fs/promises";
9
10
  import path from "node:path";
10
11
  import { ensureTool, getToolEnvironment } from "../installer/index.js";
11
12
  import { promptForInstall, supportsInteractiveInstall, } from "./interactive-install.js";
@@ -24,7 +25,7 @@ const __dirname = dirname(__filename);
24
25
  */
25
26
  async function spawnWithInteractiveInstall(language, _command, _args, options, spawnFn) {
26
27
  try {
27
- return spawnFn();
28
+ return await spawnFn();
28
29
  }
29
30
  catch (error) {
30
31
  // Check if this is a "command not found" error
@@ -37,7 +38,7 @@ async function spawnWithInteractiveInstall(language, _command, _args, options, s
37
38
  const shouldInstall = await promptForInstall(language, options.cwd);
38
39
  if (shouldInstall) {
39
40
  // Try again after install
40
- return spawnFn();
41
+ return await spawnFn();
41
42
  }
42
43
  // User declined, return undefined to skip this LSP
43
44
  return undefined;
@@ -47,34 +48,51 @@ async function spawnWithInteractiveInstall(language, _command, _args, options, s
47
48
  }
48
49
  }
49
50
  /**
50
- * Walk up the tree looking for project root markers
51
+ * Walk up the directory tree looking for project root markers.
52
+ *
53
+ * NearestRoot(includePatterns, excludePatterns?) → RootFunction
54
+ *
55
+ * - includePatterns: file/dir names that signal the project root (e.g. ["package.json"])
56
+ * - excludePatterns: if any of these exist in a directory, skip it (e.g. ["node_modules"])
57
+ * - stopDir: walk stops here (defaults to filesystem root; set to project cwd for safety)
58
+ *
59
+ * Equivalent to createRootDetector; exported under both names for clarity.
51
60
  */
52
- export function createRootDetector(includePatterns, excludePatterns) {
61
+ export function NearestRoot(includePatterns, excludePatterns, stopDir) {
53
62
  return async (file) => {
54
63
  let currentDir = path.dirname(file);
55
- const root = path.parse(currentDir).root;
56
- while (currentDir !== root) {
57
- // Check exclude patterns first
64
+ const fsRoot = path.parse(currentDir).root;
65
+ const stop = stopDir ?? fsRoot;
66
+ while (currentDir !== fsRoot) {
67
+ // Bail out if we've reached the stop boundary
68
+ if (currentDir === stop ||
69
+ (currentDir.startsWith(stop + path.sep) === false &&
70
+ currentDir === stop)) {
71
+ break;
72
+ }
73
+ // Check exclude patterns — skip this dir (but keep walking up)
58
74
  if (excludePatterns) {
75
+ let excluded = false;
59
76
  for (const pattern of excludePatterns) {
60
- const checkPath = path.join(currentDir, pattern);
61
77
  try {
62
- const stat = await import("node:fs/promises").then((fs) => fs.stat(checkPath));
63
- if (stat)
64
- return undefined; // Excluded
78
+ await stat(path.join(currentDir, pattern));
79
+ excluded = true;
80
+ break;
65
81
  }
66
82
  catch {
67
83
  /* not found */
68
84
  }
69
85
  }
86
+ if (excluded) {
87
+ currentDir = path.dirname(currentDir);
88
+ continue;
89
+ }
70
90
  }
71
91
  // Check include patterns
72
92
  for (const pattern of includePatterns) {
73
- const checkPath = path.join(currentDir, pattern);
74
93
  try {
75
- const stat = await import("node:fs/promises").then((fs) => fs.stat(checkPath));
76
- if (stat)
77
- return currentDir;
94
+ await stat(path.join(currentDir, pattern));
95
+ return currentDir;
78
96
  }
79
97
  catch {
80
98
  /* not found */
@@ -85,6 +103,8 @@ export function createRootDetector(includePatterns, excludePatterns) {
85
103
  return undefined;
86
104
  };
87
105
  }
106
+ /** Alias kept for backward compatibility */
107
+ export const createRootDetector = NearestRoot;
88
108
  // --- Server Definitions ---
89
109
  export const TypeScriptServer = {
90
110
  id: "typescript",
@@ -97,7 +117,7 @@ export const TypeScriptServer = {
97
117
  "pnpm-lock.yaml",
98
118
  "yarn.lock",
99
119
  "package.json",
100
- ], [".pi-lens"]),
120
+ ]),
101
121
  async spawn(root) {
102
122
  const path = await import("node:path");
103
123
  const fs = await import("node:fs/promises");
@@ -147,7 +167,7 @@ export const TypeScriptServer = {
147
167
  }
148
168
  // Use absolute path and proper environment
149
169
  const env = await getToolEnvironment();
150
- const proc = launchLSP(lspPath, ["--stdio"], {
170
+ const proc = await launchLSP(lspPath, ["--stdio"], {
151
171
  cwd: root,
152
172
  env: {
153
173
  ...env,
@@ -173,10 +193,10 @@ export const PythonServer = {
173
193
  "requirements.txt",
174
194
  "Pipfile",
175
195
  "poetry.lock",
176
- ], [".pi-lens"]),
196
+ ]),
177
197
  async spawn(root) {
178
198
  const env = await getToolEnvironment();
179
- const proc = launchViaPackageManager("pyright-langserver", ["--stdio"], {
199
+ const proc = await launchViaPackageManager("pyright-langserver", ["--stdio"], {
180
200
  cwd: root,
181
201
  env,
182
202
  });
@@ -210,9 +230,9 @@ export const GoServer = {
210
230
  id: "go",
211
231
  name: "gopls",
212
232
  extensions: [".go"],
213
- root: createRootDetector(["go.mod", "go.sum"], [".pi-lens"]),
233
+ root: createRootDetector(["go.mod", "go.sum"]),
214
234
  async spawn(root) {
215
- const proc = await spawnWithInteractiveInstall("go", "gopls", [], { cwd: root }, () => launchLSP("gopls", [], { cwd: root }));
235
+ const proc = await spawnWithInteractiveInstall("go", "gopls", [], { cwd: root }, async () => await launchLSP("gopls", [], { cwd: root }));
216
236
  return proc ? { process: proc } : undefined;
217
237
  },
218
238
  };
@@ -220,9 +240,9 @@ export const RustServer = {
220
240
  id: "rust",
221
241
  name: "rust-analyzer",
222
242
  extensions: [".rs"],
223
- root: createRootDetector(["Cargo.toml", "Cargo.lock"], [".pi-lens"]),
243
+ root: createRootDetector(["Cargo.toml", "Cargo.lock"]),
224
244
  async spawn(root) {
225
- const proc = await spawnWithInteractiveInstall("rust", "rust-analyzer", [], { cwd: root }, () => launchLSP("rust-analyzer", [], { cwd: root }));
245
+ const proc = await spawnWithInteractiveInstall("rust", "rust-analyzer", [], { cwd: root }, async () => await launchLSP("rust-analyzer", [], { cwd: root }));
226
246
  return proc ? { process: proc } : undefined;
227
247
  },
228
248
  };
@@ -230,15 +250,15 @@ export const RubyServer = {
230
250
  id: "ruby",
231
251
  name: "Ruby LSP",
232
252
  extensions: [".rb", ".rake", ".gemspec", ".ru"],
233
- root: createRootDetector(["Gemfile", ".ruby-version"], [".pi-lens"]),
253
+ root: createRootDetector(["Gemfile", ".ruby-version"]),
234
254
  async spawn(root) {
235
255
  // Try ruby-lsp first, fall back to solargraph
236
256
  try {
237
- const proc = launchLSP("ruby-lsp", [], { cwd: root });
257
+ const proc = await launchLSP("ruby-lsp", [], { cwd: root });
238
258
  return { process: proc };
239
259
  }
240
260
  catch {
241
- const proc = launchViaPackageManager("solargraph", ["stdio"], {
261
+ const proc = await launchViaPackageManager("solargraph", ["stdio"], {
242
262
  cwd: root,
243
263
  });
244
264
  return { process: proc };
@@ -249,9 +269,9 @@ export const PHPServer = {
249
269
  id: "php",
250
270
  name: "Intelephense",
251
271
  extensions: [".php"],
252
- root: createRootDetector(["composer.json", "composer.lock"], [".pi-lens"]),
272
+ root: createRootDetector(["composer.json", "composer.lock"]),
253
273
  async spawn(root) {
254
- const proc = launchViaPackageManager("intelephense", ["--stdio"], {
274
+ const proc = await launchViaPackageManager("intelephense", ["--stdio"], {
255
275
  cwd: root,
256
276
  });
257
277
  return {
@@ -264,9 +284,9 @@ export const CSharpServer = {
264
284
  id: "csharp",
265
285
  name: "csharp-ls",
266
286
  extensions: [".cs"],
267
- root: createRootDetector([".sln", ".csproj", ".slnx"], [".pi-lens"]),
287
+ root: createRootDetector([".sln", ".csproj", ".slnx"]),
268
288
  async spawn(root) {
269
- const proc = launchLSP("csharp-ls", [], { cwd: root });
289
+ const proc = await launchLSP("csharp-ls", [], { cwd: root });
270
290
  return { process: proc };
271
291
  },
272
292
  };
@@ -274,9 +294,9 @@ export const FSharpServer = {
274
294
  id: "fsharp",
275
295
  name: "FSAutocomplete",
276
296
  extensions: [".fs", ".fsi", ".fsx"],
277
- root: createRootDetector([".sln", ".fsproj"], [".pi-lens"]),
297
+ root: createRootDetector([".sln", ".fsproj"]),
278
298
  async spawn(root) {
279
- const proc = launchLSP("fsautocomplete", [], { cwd: root });
299
+ const proc = await launchLSP("fsautocomplete", [], { cwd: root });
280
300
  return { process: proc };
281
301
  },
282
302
  };
@@ -284,11 +304,11 @@ export const JavaServer = {
284
304
  id: "java",
285
305
  name: "JDT Language Server",
286
306
  extensions: [".java"],
287
- root: createRootDetector(["pom.xml", "build.gradle", ".classpath"], [".pi-lens"]),
307
+ root: createRootDetector(["pom.xml", "build.gradle", ".classpath"]),
288
308
  async spawn(root) {
289
309
  // JDTLS requires special handling - paths to launcher jar
290
310
  const jdtlsPath = process.env.JDTLS_PATH || "jdtls";
291
- const proc = launchLSP(jdtlsPath, [], { cwd: root });
311
+ const proc = await launchLSP(jdtlsPath, [], { cwd: root });
292
312
  return { process: proc };
293
313
  },
294
314
  };
@@ -296,9 +316,9 @@ export const KotlinServer = {
296
316
  id: "kotlin",
297
317
  name: "Kotlin Language Server",
298
318
  extensions: [".kt", ".kts"],
299
- root: createRootDetector(["build.gradle.kts", "build.gradle", "pom.xml"], [".pi-lens"]),
319
+ root: createRootDetector(["build.gradle.kts", "build.gradle", "pom.xml"]),
300
320
  async spawn(root) {
301
- const proc = launchLSP("kotlin-language-server", [], { cwd: root });
321
+ const proc = await launchLSP("kotlin-language-server", [], { cwd: root });
302
322
  return { process: proc };
303
323
  },
304
324
  };
@@ -306,9 +326,9 @@ export const SwiftServer = {
306
326
  id: "swift",
307
327
  name: "SourceKit-LSP",
308
328
  extensions: [".swift"],
309
- root: createRootDetector(["Package.swift"], [".pi-lens"]),
329
+ root: createRootDetector(["Package.swift"]),
310
330
  async spawn(root) {
311
- const proc = launchLSP("sourcekit-lsp", [], { cwd: root });
331
+ const proc = await launchLSP("sourcekit-lsp", [], { cwd: root });
312
332
  return { process: proc };
313
333
  },
314
334
  };
@@ -316,9 +336,9 @@ export const DartServer = {
316
336
  id: "dart",
317
337
  name: "Dart Analysis Server",
318
338
  extensions: [".dart"],
319
- root: createRootDetector(["pubspec.yaml"], [".pi-lens"]),
339
+ root: createRootDetector(["pubspec.yaml"]),
320
340
  async spawn(root) {
321
- const proc = launchLSP("dart", ["language-server", "--protocol=lsp"], {
341
+ const proc = await launchLSP("dart", ["language-server", "--protocol=lsp"], {
322
342
  cwd: root,
323
343
  });
324
344
  return { process: proc };
@@ -328,9 +348,9 @@ export const LuaServer = {
328
348
  id: "lua",
329
349
  name: "Lua Language Server",
330
350
  extensions: [".lua"],
331
- root: createRootDetector([".luarc.json", ".luacheckrc"], [".pi-lens"]),
351
+ root: createRootDetector([".luarc.json", ".luacheckrc"]),
332
352
  async spawn(root) {
333
- const proc = launchLSP("lua-language-server", [], { cwd: root });
353
+ const proc = await launchLSP("lua-language-server", [], { cwd: root });
334
354
  return { process: proc };
335
355
  },
336
356
  };
@@ -345,7 +365,9 @@ export const CppServer = {
345
365
  "Makefile",
346
366
  ]),
347
367
  async spawn(root) {
348
- const proc = launchLSP("clangd", ["--background-index"], { cwd: root });
368
+ const proc = await launchLSP("clangd", ["--background-index"], {
369
+ cwd: root,
370
+ });
349
371
  return { process: proc };
350
372
  },
351
373
  };
@@ -353,9 +375,9 @@ export const ZigServer = {
353
375
  id: "zig",
354
376
  name: "ZLS",
355
377
  extensions: [".zig", ".zon"],
356
- root: createRootDetector(["build.zig"], [".pi-lens"]),
378
+ root: createRootDetector(["build.zig"]),
357
379
  async spawn(root) {
358
- const proc = launchLSP("zls", [], { cwd: root });
380
+ const proc = await launchLSP("zls", [], { cwd: root });
359
381
  return { process: proc };
360
382
  },
361
383
  };
@@ -363,9 +385,9 @@ export const HaskellServer = {
363
385
  id: "haskell",
364
386
  name: "Haskell Language Server",
365
387
  extensions: [".hs", ".lhs"],
366
- root: createRootDetector(["stack.yaml", "cabal.project", "*.cabal"], [".pi-lens"]),
388
+ root: createRootDetector(["stack.yaml", "cabal.project", "*.cabal"]),
367
389
  async spawn(root) {
368
- const proc = launchLSP("haskell-language-server-wrapper", ["--lsp"], {
390
+ const proc = await launchLSP("haskell-language-server-wrapper", ["--lsp"], {
369
391
  cwd: root,
370
392
  });
371
393
  return { process: proc };
@@ -375,9 +397,9 @@ export const ElixirServer = {
375
397
  id: "elixir",
376
398
  name: "ElixirLS",
377
399
  extensions: [".ex", ".exs"],
378
- root: createRootDetector(["mix.exs"], [".pi-lens"]),
400
+ root: createRootDetector(["mix.exs"]),
379
401
  async spawn(root) {
380
- const proc = launchLSP("elixir-ls", [], { cwd: root });
402
+ const proc = await launchLSP("elixir-ls", [], { cwd: root });
381
403
  return { process: proc };
382
404
  },
383
405
  };
@@ -385,9 +407,9 @@ export const GleamServer = {
385
407
  id: "gleam",
386
408
  name: "Gleam LSP",
387
409
  extensions: [".gleam"],
388
- root: createRootDetector(["gleam.toml"], [".pi-lens"]),
410
+ root: createRootDetector(["gleam.toml"]),
389
411
  async spawn(root) {
390
- const proc = launchLSP("gleam", ["lsp"], { cwd: root });
412
+ const proc = await launchLSP("gleam", ["lsp"], { cwd: root });
391
413
  return { process: proc };
392
414
  },
393
415
  };
@@ -395,9 +417,9 @@ export const OCamlServer = {
395
417
  id: "ocaml",
396
418
  name: "ocamllsp",
397
419
  extensions: [".ml", ".mli"],
398
- root: createRootDetector(["dune-project", "opam"], [".pi-lens"]),
420
+ root: createRootDetector(["dune-project", "opam"]),
399
421
  async spawn(root) {
400
- const proc = launchLSP("ocamllsp", [], { cwd: root });
422
+ const proc = await launchLSP("ocamllsp", [], { cwd: root });
401
423
  return { process: proc };
402
424
  },
403
425
  };
@@ -405,9 +427,9 @@ export const ClojureServer = {
405
427
  id: "clojure",
406
428
  name: "Clojure LSP",
407
429
  extensions: [".clj", ".cljs", ".cljc", ".edn"],
408
- root: createRootDetector(["deps.edn", "project.clj"], [".pi-lens"]),
430
+ root: createRootDetector(["deps.edn", "project.clj"]),
409
431
  async spawn(root) {
410
- const proc = launchLSP("clojure-lsp", [], { cwd: root });
432
+ const proc = await launchLSP("clojure-lsp", [], { cwd: root });
411
433
  return { process: proc };
412
434
  },
413
435
  };
@@ -415,9 +437,9 @@ export const TerraformServer = {
415
437
  id: "terraform",
416
438
  name: "Terraform LSP",
417
439
  extensions: [".tf", ".tfvars"],
418
- root: createRootDetector([".terraform.lock.hcl"], [".pi-lens"]),
440
+ root: createRootDetector([".terraform.lock.hcl"]),
419
441
  async spawn(root) {
420
- const proc = launchLSP("terraform-ls", ["serve"], { cwd: root });
442
+ const proc = await launchLSP("terraform-ls", ["serve"], { cwd: root });
421
443
  return { process: proc };
422
444
  },
423
445
  };
@@ -425,9 +447,9 @@ export const NixServer = {
425
447
  id: "nix",
426
448
  name: "nixd",
427
449
  extensions: [".nix"],
428
- root: createRootDetector(["flake.nix"], [".pi-lens"]),
450
+ root: createRootDetector(["flake.nix"]),
429
451
  async spawn(root) {
430
- const proc = launchLSP("nixd", [], { cwd: root });
452
+ const proc = await launchLSP("nixd", [], { cwd: root });
431
453
  return { process: proc };
432
454
  },
433
455
  };
@@ -438,7 +460,7 @@ export const BashServer = {
438
460
  root: async () => process.cwd(),
439
461
  async spawn() {
440
462
  const cwd = process.cwd();
441
- const proc = await spawnWithInteractiveInstall("bash", "bash-language-server", ["start"], { cwd }, () => launchLSP("bash-language-server", ["start"], {}));
463
+ const proc = await spawnWithInteractiveInstall("bash", "bash-language-server", ["start"], { cwd }, async () => await launchLSP("bash-language-server", ["start"], {}));
442
464
  return proc ? { process: proc } : undefined;
443
465
  },
444
466
  };
@@ -449,7 +471,7 @@ export const DockerServer = {
449
471
  root: async () => process.cwd(),
450
472
  async spawn() {
451
473
  // Use npx since it's not auto-installed
452
- const proc = launchViaPackageManager("dockerfile-language-server-nodejs", ["--stdio"], {});
474
+ const proc = await launchViaPackageManager("dockerfile-language-server-nodejs", ["--stdio"], {});
453
475
  return { process: proc };
454
476
  },
455
477
  };
@@ -460,7 +482,7 @@ export const YamlServer = {
460
482
  root: async () => process.cwd(),
461
483
  async spawn() {
462
484
  const cwd = process.cwd();
463
- const proc = await spawnWithInteractiveInstall("yaml", "yaml-language-server", ["--stdio"], { cwd }, () => launchLSP("yaml-language-server", ["--stdio"], {}));
485
+ const proc = await spawnWithInteractiveInstall("yaml", "yaml-language-server", ["--stdio"], { cwd }, async () => await launchLSP("yaml-language-server", ["--stdio"], {}));
464
486
  return proc ? { process: proc } : undefined;
465
487
  },
466
488
  };
@@ -471,7 +493,7 @@ export const JsonServer = {
471
493
  root: async () => process.cwd(),
472
494
  async spawn() {
473
495
  const cwd = process.cwd();
474
- const proc = await spawnWithInteractiveInstall("json", "vscode-json-languageserver", ["--stdio"], { cwd }, () => launchLSP("vscode-json-languageserver", ["--stdio"], {}));
496
+ const proc = await spawnWithInteractiveInstall("json", "vscode-json-language-server", ["--stdio"], { cwd }, async () => await launchLSP("vscode-json-language-server", ["--stdio"], {}));
475
497
  return proc ? { process: proc } : undefined;
476
498
  },
477
499
  };
@@ -479,10 +501,10 @@ export const PrismaServer = {
479
501
  id: "prisma",
480
502
  name: "Prisma Language Server",
481
503
  extensions: [".prisma"],
482
- root: createRootDetector(["prisma/schema.prisma"], [".pi-lens"]),
504
+ root: createRootDetector(["prisma/schema.prisma"]),
483
505
  async spawn(root) {
484
506
  // Use npx since it's not auto-installed
485
- const proc = launchViaPackageManager("@prisma/language-server", ["--stdio"], { cwd: root });
507
+ const proc = await launchViaPackageManager("@prisma/language-server", ["--stdio"], { cwd: root });
486
508
  return { process: proc };
487
509
  },
488
510
  };
@@ -497,10 +519,10 @@ export const VueServer = {
497
519
  "bun.lock",
498
520
  "pnpm-lock.yaml",
499
521
  "yarn.lock",
500
- ], [".pi-lens"]),
522
+ ]),
501
523
  async spawn(root) {
502
524
  // Use npx since it's not auto-installed
503
- const proc = launchViaPackageManager("@vue/language-server", ["--stdio"], {
525
+ const proc = await launchViaPackageManager("@vue/language-server", ["--stdio"], {
504
526
  cwd: root,
505
527
  });
506
528
  return { process: proc };
@@ -516,10 +538,10 @@ export const SvelteServer = {
516
538
  "bun.lock",
517
539
  "pnpm-lock.yaml",
518
540
  "yarn.lock",
519
- ], [".pi-lens"]),
541
+ ]),
520
542
  async spawn(root) {
521
543
  // Use npx since it's not auto-installed
522
- const proc = launchViaPackageManager("svelte-language-server", ["--stdio"], { cwd: root });
544
+ const proc = await launchViaPackageManager("svelte-language-server", ["--stdio"], { cwd: root });
523
545
  return { process: proc };
524
546
  },
525
547
  };
@@ -538,7 +560,7 @@ export const ESLintServer = {
538
560
  async spawn(root) {
539
561
  // Try via package manager (npx) since it's not auto-installed
540
562
  try {
541
- const proc = launchViaPackageManager("vscode-eslint-language-server", ["--stdio"], { cwd: root });
563
+ const proc = await launchViaPackageManager("vscode-eslint-language-server", ["--stdio"], { cwd: root });
542
564
  return { process: proc };
543
565
  }
544
566
  catch {
@@ -555,7 +577,7 @@ export const CssServer = {
555
577
  root: async () => process.cwd(),
556
578
  async spawn() {
557
579
  // Use npx since it's not auto-installed
558
- const proc = launchViaPackageManager("vscode-css-languageserver", ["--stdio"], {});
580
+ const proc = await launchViaPackageManager("vscode-css-languageserver", ["--stdio"], {});
559
581
  return { process: proc };
560
582
  },
561
583
  };