From c701799d1aa33343abd6c549ccc5132523265aa1 Mon Sep 17 00:00:00 2001 From: Ben Date: Fri, 6 Oct 2023 15:50:40 +0100 Subject: [PATCH] fix: add an additional follow-up command to ensure focus --- src/chat.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/chat.ts b/src/chat.ts index de9a46a7..8e51251c 100644 --- a/src/chat.ts +++ b/src/chat.ts @@ -170,7 +170,17 @@ export class ChatProvider implements vscode.WebviewViewProvider { }); } else { // Reveal the directory in the explorer - vscode.commands.executeCommand("revealInExplorer", filePath); + vscode.commands + .executeCommand("revealInExplorer", filePath) + .then(() => + // This is a little hack. + // + // There's some issue with the revealInExplorer command which means when the panel changes + // (e.g. from sourcery to the explorer) the instruction to actually focus the file path + // seems to get dropped. By calling it again (after the first command succeeds) we can + // make sure the file actually gets navigated to. + vscode.commands.executeCommand("revealInExplorer", filePath) + ); } } }