feat: feat

This commit is contained in:
Jacob Kim 2025-07-18 13:32:33 -07:00
parent c7b182f5f3
commit 4c15e87b86
3 changed files with 51 additions and 6 deletions

View file

@ -32,7 +32,10 @@ export class JumpManager {
this._disposables = [];
}
public async suggestJump(nextJumpLocation: vscode.Position) {
public async suggestJump(
nextJumpLocation: vscode.Position,
nextEditData?: any,
) {
const editor = vscode.window.activeTextEditor;
if (editor) {
@ -75,6 +78,35 @@ export class JumpManager {
);
}
}
if (nextEditData) {
this.pendingNextEditData = nextEditData;
const disposable = vscode.window.onDidChangeTextEditorSelection((e) => {
const editor = vscode.window.activeTextEditor;
if (editor && e.textEditor === editor) {
const currentPosition = editor.selection.active;
if (Math.abs(currentPosition.line - nextJumpLocation.line) <= 1) {
disposable.dispose();
vscode.commands.executeCommand("continue.showNextEditAfterJump", {
...this.pendingNextEditData,
currentPosition,
});
this.pendingNextEditData = undefined;
}
}
});
setTimeout(() => {
if (this.pendingNextEditData) {
disposable.dispose();
this.pendingNextEditData = undefined;
}
}, 10000);
}
}
private async renderTabToJumpDecoration(

View file

@ -400,12 +400,16 @@ export class ContinueCompletionProvider
if (this.isNextEditActive) {
if (!this.nextEditProvider.isStartOfChain()) {
await this.jumpManager.suggestJump(
new vscode.Position(
(outcome as NextEditOutcome).editableRegionStartLine,
0,
),
const jumpPosition = new vscode.Position(
(outcome as NextEditOutcome).editableRegionStartLine,
0,
);
await this.jumpManager.suggestJump(jumpPosition, {
completionId: input.completionId,
outcome: outcome as NextEditOutcome,
});
return undefined;
}
const editor = vscode.window.activeTextEditor;
if (!editor) {

View file

@ -805,6 +805,15 @@ const getCommandsMap: (
"editor.action.inlineSuggest.trigger",
);
},
"continue.showNextEditAfterJump": async (data) => {
const { completionId, outcome, currCursorPos } = data;
const editor = vscode.window.activeTextEditor;
if (!editor) return;
// This would be the same logic as in the renderNextEditSuggestion method
// from my first suggestion
// ...
},
};
};