feat: feat
This commit is contained in:
parent
c7b182f5f3
commit
4c15e87b86
3 changed files with 51 additions and 6 deletions
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
// ...
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue