GitHub Action пре 2 месеци
родитељ
комит
67cfd7f06b
2 измењених фајлова са 15 додато и 7 уклоњено
  1. 2 2
      packages/opencode/src/lsp/index.ts
  2. 13 5
      packages/opencode/src/lsp/server.ts

+ 2 - 2
packages/opencode/src/lsp/index.ts

@@ -64,13 +64,13 @@ export namespace LSP {
   const filterExperimentalServers = (servers: Record<string, LSPServer.Info>) => {
     if (Flag.OPENCODE_EXPERIMENTAL_LSP_TY) {
       // If experimental flag is enabled, disable pyright
-      if(servers["pyright"]) {
+      if (servers["pyright"]) {
         log.info("LSP server pyright is disabled because OPENCODE_EXPERIMENTAL_LSP_TY is enabled")
         delete servers["pyright"]
       }
     } else {
       // If experimental flag is disabled, disable ty
-      if(servers["ty"]) {
+      if (servers["ty"]) {
         delete servers["ty"]
       }
     }

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

@@ -364,9 +364,17 @@ export namespace LSPServer {
   export const Ty: Info = {
     id: "ty",
     extensions: [".py", ".pyi"],
-    root: NearestRoot(["pyproject.toml", "ty.toml", "setup.py", "setup.cfg", "requirements.txt", "Pipfile", "pyrightconfig.json"]),
+    root: NearestRoot([
+      "pyproject.toml",
+      "ty.toml",
+      "setup.py",
+      "setup.cfg",
+      "requirements.txt",
+      "Pipfile",
+      "pyrightconfig.json",
+    ]),
     async spawn(root) {
-      if(!Flag.OPENCODE_EXPERIMENTAL_LSP_TY) {
+      if (!Flag.OPENCODE_EXPERIMENTAL_LSP_TY) {
         return undefined
       }
 
@@ -388,7 +396,7 @@ export namespace LSPServer {
         }
       }
 
-      if(!binary) {
+      if (!binary) {
         for (const venvPath of potentialVenvPaths) {
           const isWindows = process.platform === "win32"
           const potentialTyPath = isWindows
@@ -401,7 +409,7 @@ export namespace LSPServer {
         }
       }
 
-      if(!binary) {
+      if (!binary) {
         log.error("ty not found, please install ty first")
         return
       }
@@ -409,7 +417,7 @@ export namespace LSPServer {
       const proc = spawn(binary, ["server"], {
         cwd: root,
       })
-      
+
       return {
         process: proc,
         initialization,