diff options
| author | Dax Raad <[email protected]> | 2025-07-02 11:35:25 -0400 |
|---|---|---|
| committer | Dax Raad <[email protected]> | 2025-07-02 11:35:25 -0400 |
| commit | c810b6d206842cf04d79073414f5eedf671f51da (patch) | |
| tree | b25a177cf65660e8a3127ee6ee6c6a7908486a8a /packages | |
| parent | fa35407572f5018180bc8f5354b80c2978e20bfb (diff) | |
| download | opencode-c810b6d206842cf04d79073414f5eedf671f51da.tar.gz opencode-c810b6d206842cf04d79073414f5eedf671f51da.zip | |
wip: symbols for lsp
Diffstat (limited to 'packages')
| -rw-r--r-- | packages/opencode/src/lsp/index.ts | 26 |
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>( |
