reopen quick accept / reject quick pick when diff exists
This commit is contained in:
parent
2f5c3a27ce
commit
fa4d523807
2 changed files with 26 additions and 8 deletions
|
|
@ -446,4 +446,9 @@ export class VerticalDiffHandler implements vscode.Disposable {
|
|||
//update code lens
|
||||
this.shiftCodeLensObjects(startLine, lineDelta);
|
||||
}
|
||||
|
||||
public hasDiffForCurrentFile(): boolean {
|
||||
const diffBlocks = this.editorToVerticalDiffCodeLens.get(this.filepath);
|
||||
return diffBlocks !== undefined && diffBlocks.length > 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -134,7 +134,6 @@ export class QuickEdit {
|
|||
*/
|
||||
async show(args?: QuickEditShowParams) {
|
||||
// Clean up state from previous quick picks, e.g. if a user pressed `esc`
|
||||
this.clear();
|
||||
|
||||
const editor = vscode.window.activeTextEditor;
|
||||
|
||||
|
|
@ -143,6 +142,17 @@ export class QuickEdit {
|
|||
return;
|
||||
}
|
||||
|
||||
const hasChanges = await this.verticalDiffManager.getHandlerForFile(
|
||||
editor.document.uri.fsPath,
|
||||
);
|
||||
|
||||
if (!hasChanges) {
|
||||
this.clear();
|
||||
} else {
|
||||
this.openAcceptRejectMenu("", editor.document.uri.fsPath);
|
||||
return;
|
||||
}
|
||||
|
||||
// Set state that is unique to each quick pick instance
|
||||
this.setActiveEditorAndPrevInput(editor);
|
||||
|
||||
|
|
@ -224,13 +234,7 @@ export class QuickEdit {
|
|||
}
|
||||
}
|
||||
|
||||
private handleUserPrompt = async (
|
||||
prompt: string,
|
||||
path: string | undefined,
|
||||
) => {
|
||||
const modelTitle = await this.getCurModelTitle();
|
||||
await this._streamEditWithInputAndContext(prompt, modelTitle);
|
||||
|
||||
private openAcceptRejectMenu(prompt: string, path: string | undefined) {
|
||||
const quickPick = vscode.window.createQuickPick();
|
||||
quickPick.placeholder = "Type your acceptance decision";
|
||||
|
||||
|
|
@ -270,6 +274,15 @@ export class QuickEdit {
|
|||
|
||||
quickPick.dispose();
|
||||
});
|
||||
}
|
||||
|
||||
private handleUserPrompt = async (
|
||||
prompt: string,
|
||||
path: string | undefined,
|
||||
) => {
|
||||
const modelTitle = await this.getCurModelTitle();
|
||||
await this._streamEditWithInputAndContext(prompt, modelTitle);
|
||||
this.openAcceptRejectMenu(prompt, path);
|
||||
};
|
||||
|
||||
private async initializeFileSearchState() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue