Browse Source

switch typescript lsp to be one per package to ensure it loads when typescript is not installed at root

Dax Raad 11 tháng trước cách đây
mục cha
commit
e8db95be16
1 tập tin đã thay đổi với 2 bổ sung và 5 xóa
  1. 2 5
      packages/opencode/src/lsp/server.ts

+ 2 - 5
packages/opencode/src/lsp/server.ts

@@ -82,13 +82,10 @@ export namespace LSPServer {
 
   export const Typescript: Info = {
     id: "typescript",
-    root: NearestRoot(
-      ["package-lock.json", "bun.lockb", "bun.lock", "pnpm-lock.yaml", "yarn.lock"],
-      ["deno.json", "deno.jsonc"],
-    ),
+    root: NearestRoot(["tsconfig.json", "package.json", "jsconfig.json", ".git"], ["deno.json", "deno.jsonc"]),
     extensions: [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".mts", ".cts"],
     async spawn(root) {
-      const tsserver = await Bun.resolve("typescript/lib/tsserver.js", Instance.directory).catch(() => {})
+      const tsserver = await Bun.resolve("typescript/lib/tsserver.js", root).catch(() => {})
       if (!tsserver) return
       const proc = spawn(BunProc.which(), ["x", "typescript-language-server", "--stdio"], {
         cwd: root,