From fbcf27ada2ec770b3a3760f620352861bc055489 Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Tue, 24 Jun 2025 16:04:40 -0700 Subject: [PATCH] extend tab and esc to accept or reject when nextEditWindowActive is true --- extensions/vscode/package-lock.json | 4 +-- extensions/vscode/package.json | 8 ++--- .../src/activation/NextEditWindowManager.ts | 32 +++++++++++++------ 3 files changed, 28 insertions(+), 16 deletions(-) diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index 023117fdd..ae23ee64a 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "1.1.49", + "version": "1.1.50", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "1.1.49", + "version": "1.1.50", "license": "Apache-2.0", "dependencies": { "@continuedev/config-types": "^1.0.14", diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 10842ee88..33accea3b 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -437,13 +437,13 @@ }, { "command": "nextEditWindow.hideTooltips", - "key": "ctrl+space escape", - "when": "editorTextFocus" + "key": "escape", + "when": "editorTextFocus && nextEditWindowActive" }, { "command": "nextEditWindow.acceptNextEdit", - "key": "ctrl+space tab", - "when": "editorTextFocus" + "key": "tab", + "when": "editorTextFocus && nextEditWindowActive" } ], "submenus": [ diff --git a/extensions/vscode/src/activation/NextEditWindowManager.ts b/extensions/vscode/src/activation/NextEditWindowManager.ts index aee7eb6ec..d0a254884 100644 --- a/extensions/vscode/src/activation/NextEditWindowManager.ts +++ b/extensions/vscode/src/activation/NextEditWindowManager.ts @@ -141,8 +141,8 @@ export class NextEditWindowManager { // Register the command to hide tooltips const hideTooltipsCommand = vscode.commands.registerCommand( HIDE_TOOLTIP_COMMAND, - () => { - this.hideAllTooltips(); + async () => { + await this.hideAllTooltips(); }, ); context.subscriptions.push(hideTooltipsCommand); @@ -175,7 +175,7 @@ export class NextEditWindowManager { } // Clear any existing decorations first (very important to prevent overlapping) - this.hideAllTooltips(); + await this.hideAllTooltips(); // this.dispose(); // Store the current tooltip text for accepting later @@ -208,12 +208,17 @@ export class NextEditWindowManager { // Create and apply decoration with the text await this.renderTooltip(editor, position, diff.renderableDiff); + await vscode.commands.executeCommand( + "setContext", + "nextEditWindowActive", + true, + ); } /** * Hide all tooltips in all editors */ - public hideAllTooltips() { + public async hideAllTooltips() { console.log("hideAllTooltips"); if (this.currentDecoration) { // Remove decoration from all editors to be extra safe @@ -237,6 +242,13 @@ export class NextEditWindowManager { // Clear the current tooltip text this.currentTooltipText = null; } + + await vscode.commands.executeCommand( + "setContext", + "nextEditWindowActive", + false, + ); + // this.dispose(); } @@ -285,7 +297,7 @@ export class NextEditWindowManager { this.finalCursorPos, ); } - this.hideAllTooltips(); + await this.hideAllTooltips(); } } @@ -321,13 +333,13 @@ export class NextEditWindowManager { // Listen for editor changes to clean up decorations when editor closes const editorCloseListener = vscode.window.onDidChangeVisibleTextEditors( - () => { + async () => { // If our active editor is no longer visible, clear decorations if ( this.activeEditor && !vscode.window.visibleTextEditors.includes(this.activeEditor) ) { - this.hideAllTooltips(); + await this.hideAllTooltips(); } }, ); @@ -335,10 +347,10 @@ export class NextEditWindowManager { // Listen for selection changes to hide tooltip when cursor moves const selectionListener = vscode.window.onDidChangeTextEditorSelection( - (e) => { + async (e) => { // If the selection changed in our active editor, hide the tooltip if (this.activeEditor && e.textEditor === this.activeEditor) { - this.hideAllTooltips(); + await this.hideAllTooltips(); } }, ); @@ -591,7 +603,7 @@ export class NextEditWindowManager { } // Store the decoration and editor - this.hideAllTooltips(); + await this.hideAllTooltips(); this.currentDecoration = decoration; this.activeEditor = editor;