Просмотр исходного кода

do not wait for LSP to be fully ready

Dax Raad 7 месяцев назад
Родитель
Сommit
0ee3b1ede2

+ 1 - 3
packages/opencode/src/lsp/client.ts

@@ -184,9 +184,7 @@ export namespace LSPClient {
       },
     }
 
-    if (input.server.onInitialized) {
-      await input.server.onInitialized(result)
-    }
+    if (input.server.onInitialized) input.server.onInitialized(result)
     l.info("initialized")
 
     return result

+ 2 - 7
packages/opencode/src/session/mode.ts

@@ -14,13 +14,7 @@ export namespace Mode {
         })
         .optional(),
       prompt: z.string().optional(),
-      tools: z
-        .object({
-          write: z.boolean().optional(),
-          edit: z.boolean().optional(),
-          patch: z.boolean().optional(),
-        })
-        .optional(),
+      tools: z.record(z.boolean()),
     })
     .openapi({
       ref: "Mode",
@@ -61,6 +55,7 @@ export namespace Mode {
       if (value.prompt) item.prompt = await Bun.file(value.prompt).text()
       if (value.tools) item.tools = value.tools
     }
+
     return result
   })
 

+ 1 - 1
packages/opencode/src/tool/read.ts

@@ -71,7 +71,7 @@ export const ReadTool = Tool.define({
     output += "\n</file>"
 
     // just warms the lsp client
-    await LSP.touchFile(filePath, false)
+    LSP.touchFile(filePath, false)
     FileTime.read(ctx.sessionID, filePath)
 
     return {