Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the FixUp retry instruction text #1615

Merged
merged 9 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from 5 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
1 change: 1 addition & 0 deletions vscode/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Starting from `0.2.0`, Cody is using `major.EVEN_NUMBER.patch` for release versi
### Fixed

- Chat: Fixed an issue where multiple action buttons were appended to each Code Block per chat message. [pull/1617](https://github.com/sourcegraph/cody/pull/1617)
- Fixup: Updated the fixup create task to just use the previous command text. [pull/1615](https://github.com/sourcegraph/cody/pull/1615)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still showing up in the old version 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed it now. My bad 😅


### Changed

Expand Down
5 changes: 3 additions & 2 deletions vscode/src/non-stop/FixupController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ export class FixupController
source?: ChatEventSource
): FixupTask {
const fixupFile = this.files.forUri(documentUri)
const task = new FixupTask(fixupFile, instruction, selectionRange, insertMode, source)
const fixupInstruction = instruction.replace(/^\/edit/, '').trim()
const task = new FixupTask(fixupFile, fixupInstruction, selectionRange, insertMode, source)
Copy link
Contributor

@umpox umpox Nov 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@deepak2431 Can we do this in the FixupTask constructor instead? Just so we don't accidentally miss this in future

    constructor(
        public readonly fixupFile: FixupFile,
        public readonly instruction: string,
        public selectionRange: vscode.Range,
        // insert mode means insert replacement at selection, otherwise replace selection contents with replacement
        public insertMode?: boolean,
        // the source of the instruction, e.g. 'code-action', 'doc', etc
        public source?: ChatEventSource
    ) {
        this.id = Date.now().toString(36).replaceAll(/\d+/g, '')
        this.instruction = instruction.replace(/^\/edit/, '').trim()
    }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@umpox Yeah, that will be even better. Let me make those changes.

this.tasks.set(task.id, task)
this.setTaskState(task, CodyTaskState.working)
return task
Expand Down Expand Up @@ -881,7 +882,7 @@ export class FixupController
const document = await vscode.workspace.openTextDocument(task.fixupFile.uri)

// Prompt the user for a new instruction, and create a new fixup
const instruction = (await this.typingUI.getInstructionFromQuickPick({ value: previousInstruction })).trim()
const instruction = await this.typingUI.getInstructionFromQuickPick({ value: previousInstruction })

// Revert and remove the previous task
await this.undoTask(task)
Expand Down