mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-08-30 17:14:40 +08:00
fix(vscode): skip posting toggleChatSearch when target webview is not ready
This commit is contained in:
@@ -111,7 +111,7 @@ export function registerCodeActions(
|
||||
// webview closes the search bar itself if it's already open.
|
||||
vscode.commands.registerCommand("kilo-code.new.toggleChatSearch", async () => {
|
||||
const view = target()
|
||||
await revealTarget(view)
|
||||
if (!(await revealTarget(view))) return
|
||||
view.postMessage({ type: "action", action: "focusSearch" })
|
||||
}),
|
||||
)
|
||||
|
||||
@@ -127,4 +127,22 @@ describe("registerCodeActions", () => {
|
||||
expect(state.events).toEqual(["wait"])
|
||||
expect(state.posts).toEqual([])
|
||||
})
|
||||
|
||||
it("toggles chat search on the active Agent Manager once it is ready", async () => {
|
||||
const state = setup(true)
|
||||
|
||||
await state.commands.get("kilo-code.new.toggleChatSearch")?.()
|
||||
|
||||
expect(state.events).toEqual(["wait", "post"])
|
||||
expect(state.posts).toEqual([{ type: "action", action: "focusSearch" }])
|
||||
})
|
||||
|
||||
it("does not toggle chat search when Agent Manager readiness is cancelled", async () => {
|
||||
const state = setup(true, false)
|
||||
|
||||
await state.commands.get("kilo-code.new.toggleChatSearch")?.()
|
||||
|
||||
expect(state.events).toEqual(["wait"])
|
||||
expect(state.posts).toEqual([])
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user