Skip to content

Commit 3ae637e

Browse files
igardevigardev
andauthored
Fix manual trigger without cache + accept always on pressing a Tab (#25)
* Ensure Ctrl+Shift+L always makes a new request to the servers. * If a suggestion is visible - pressing a Tab always accepts it. --------- Co-authored-by: igardev <[email protected]>
1 parent f3ceafb commit 3ae637e

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@
5959
}
6060
],
6161
"keybindings": [
62+
{
63+
"key": "tab",
64+
"command": "editor.action.inlineSuggest.commit",
65+
"when": "inlineSuggestionVisible"
66+
},
6267
{
6368
"command": "extension.triggerInlineCompletion",
6469
"key": "ctrl+l",

src/architect.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,10 @@ export class Architect {
205205
vscode.window.showErrorMessage('No active editor!');
206206
return;
207207
}
208+
// Hide the current suggestion to force VS Code to call the completion provider instead of using cache
209+
await vscode.commands.executeCommand('editor.action.inlineSuggest.hide');
210+
// Wait a tiny bit to ensure VS Code processes the command
211+
await new Promise(resolve => setTimeout(resolve, 50));
208212
this.isForcedNewRequest = true;
209213
vscode.commands.executeCommand('editor.action.inlineSuggest.trigger');
210214
});

0 commit comments

Comments
 (0)