summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--packages/opencode/src/lsp/index.ts26
1 files changed, 25 insertions, 1 deletions
diff --git a/packages/opencode/src/lsp/index.ts b/packages/opencode/src/lsp/index.ts
index e4280bf2f..2c73feb81 100644
--- a/packages/opencode/src/lsp/index.ts
+++ b/packages/opencode/src/lsp/index.ts
@@ -4,10 +4,34 @@ import { LSPClient } from "./client"
import path from "path"
import { LSPServer } from "./server"
import { Ripgrep } from "../file/ripgrep"
+import { z } from "zod"
export namespace LSP {
const log = Log.create({ service: "lsp" })
+ export const Symbol = z
+ .object({
+ name: z.string(),
+ kind: z.number(),
+ location: z.object({
+ uri: z.string(),
+ range: z.object({
+ start: z.object({
+ line: z.number(),
+ character: z.number(),
+ }),
+ end: z.object({
+ line: z.number(),
+ character: z.number(),
+ }),
+ }),
+ }),
+ })
+ .openapi({
+ ref: "LSP.Symbol",
+ })
+ export type Symbol = z.infer<typeof Symbol>
+
const state = App.state(
"lsp",
async (app) => {
@@ -96,7 +120,7 @@ export namespace LSP {
client.connection.sendRequest("workspace/symbol", {
query,
}),
- )
+ ).then((result) => result.flat() as LSP.Symbol[])
}
async function run<T>(