mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-09-19 10:02:04 +08:00
fix(vscode): capture pending sandbox draft edits
This commit is contained in:
@@ -37,6 +37,19 @@ describe("PromptInput sandbox toggle", () => {
|
||||
expect(toggle).not.toContain('type: "updateConfig"')
|
||||
})
|
||||
|
||||
it("captures edits made while sandbox session creation is pending", () => {
|
||||
const start = src.indexOf('if (message.type === "sessionCreated")')
|
||||
const end = src.indexOf('if (message.type === "action"', start)
|
||||
const created = src.slice(start, end)
|
||||
const save = created.indexOf("if (source === draftKey()) saveDraft(source, text(), reviewComments(), imageAttach.images())")
|
||||
const move = created.indexOf("movePromptDraft(")
|
||||
|
||||
expect(start).toBeGreaterThan(-1)
|
||||
expect(end).toBeGreaterThan(start)
|
||||
expect(save).toBeGreaterThan(-1)
|
||||
expect(move).toBeGreaterThan(save)
|
||||
})
|
||||
|
||||
it("keeps success feedback out of the webview toast region", () => {
|
||||
const start = src.indexOf("const handleSandboxMessage =")
|
||||
const end = src.indexOf("const unsubscribe =", start)
|
||||
|
||||
@@ -568,15 +568,8 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
|
||||
if (raw) {
|
||||
const source = scopeDraftKey(boxKey(), raw)
|
||||
const target = scopeDraftKey(boxKey(), sessionDraftKey(message.session.id))
|
||||
const draft = movePromptDraft({ text: drafts, comments: reviewDrafts, images: imageDrafts }, source, target)
|
||||
if (
|
||||
draft.text === undefined &&
|
||||
draft.comments === undefined &&
|
||||
draft.images === undefined &&
|
||||
source === draftKey()
|
||||
) {
|
||||
saveDraft(target, text(), reviewComments(), imageAttach.images())
|
||||
}
|
||||
if (source === draftKey()) saveDraft(source, text(), reviewComments(), imageAttach.images())
|
||||
movePromptDraft({ text: drafts, comments: reviewDrafts, images: imageDrafts }, source, target)
|
||||
}
|
||||
if (
|
||||
message.draftID &&
|
||||
|
||||
Reference in New Issue
Block a user