Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as InstanceState from "@/effect/instance-state"
import { File } from "@/file"
import { Ripgrep } from "@/file/ripgrep"
import { LSP } from "@/lsp/lsp"
import { Effect } from "effect"
import { HttpApiBuilder } from "effect/unstable/httpapi"
import { InstanceHttpApi } from "../api"
Expand All @@ -9,6 +10,7 @@ export const fileHandlers = HttpApiBuilder.group(InstanceHttpApi, "file", (handl
Effect.gen(function* () {
const svc = yield* File.Service
const ripgrep = yield* Ripgrep.Service
const lsp = yield* LSP.Service

const findText = Effect.fn("FileHttpApi.findText")(function* (ctx: { query: { pattern: string } }) {
return (yield* ripgrep
Expand All @@ -27,8 +29,8 @@ export const fileHandlers = HttpApiBuilder.group(InstanceHttpApi, "file", (handl
})
})

const findSymbol = Effect.fn("FileHttpApi.findSymbol")(function* () {
return []
const findSymbol = Effect.fn("FileHttpApi.findSymbol")(function* (ctx: { query: { query: string } }) {
return yield* lsp.workspaceSymbol(ctx.query.query)
})

const list = Effect.fn("FileHttpApi.list")(function* (ctx: { query: { path: string } }) {
Expand Down
4 changes: 3 additions & 1 deletion packages/opencode/test/server/httpapi-file.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ describe("file HttpApi", () => {
expect(await files.json()).toContain("hello.txt")

expect(symbols.status).toBe(200)
expect(await symbols.json()).toEqual([])
// No LSP server is active in the test environment, so the result is an empty array.
// The endpoint delegates to LSP.workspaceSymbol — it no longer returns a hardcoded stub.
expect(await symbols.json()).toBeArray()
})
})
Loading