From d5887943048cc773e09307a5f09117ec5e421fdc Mon Sep 17 00:00:00 2001 From: Sheng Chen Date: Thu, 28 Mar 2024 09:22:04 +0800 Subject: [PATCH] Fix the focus issue of the java shortcuts Signed-off-by: Sheng Chen --- src/extension.ts | 7 ++----- src/serverTaskPresenter.ts | 4 ++-- src/standardLanguageClient.ts | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/extension.ts b/src/extension.ts index 42ceff634..a41222feb 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -361,7 +361,7 @@ export async function activate(context: ExtensionContext): Promise if (status === ServerStatusKind.error || status === ServerStatusKind.warning) { commands.executeCommand("workbench.panel.markers.view.focus"); } else { - commands.executeCommand(Commands.SHOW_SERVER_TASK_STATUS); + commands.executeCommand(Commands.SHOW_SERVER_TASK_STATUS, true); } items.push({ @@ -376,10 +376,7 @@ export async function activate(context: ExtensionContext): Promise command: Commands.CLEAN_WORKSPACE }); - const choice = await window.showQuickPick(items, { - ignoreFocusOut: true, - placeHolder: "Press 'ESC' to close." - }); + const choice = await window.showQuickPick(items); if (!choice) { return; } diff --git a/src/serverTaskPresenter.ts b/src/serverTaskPresenter.ts index 94e95343e..1dcaa28b7 100644 --- a/src/serverTaskPresenter.ts +++ b/src/serverTaskPresenter.ts @@ -8,12 +8,12 @@ import { getJavaConfiguration } from "./utils"; const JAVA_SERVER_TASK_PRESENTER_TASK_NAME = "Java Build Status"; export namespace serverTaskPresenter { - export async function presentServerTaskView() { + export async function presentServerTaskView(preserveFocus?: boolean) { const execution = await getPresenterTaskExecution(); const terminals = window.terminals; const presenterTerminals = terminals.filter(terminal => terminal.name.indexOf(execution.task.name) >= 0); if (presenterTerminals.length > 0) { - presenterTerminals[0].show(); + presenterTerminals[0].show(preserveFocus); } activationProgressNotification.hide(); } diff --git a/src/standardLanguageClient.ts b/src/standardLanguageClient.ts index 162c61625..51ba595fc 100644 --- a/src/standardLanguageClient.ts +++ b/src/standardLanguageClient.ts @@ -698,7 +698,7 @@ export class StandardLanguageClient { })); context.subscriptions.push(commands.registerCommand(Commands.OPEN_OUTPUT, () => this.languageClient.outputChannel.show(ViewColumn.Three))); - context.subscriptions.push(commands.registerCommand(Commands.SHOW_SERVER_TASK_STATUS, () => serverTaskPresenter.presentServerTaskView())); + context.subscriptions.push(commands.registerCommand(Commands.SHOW_SERVER_TASK_STATUS, (preserveFocus?: boolean) => serverTaskPresenter.presentServerTaskView(preserveFocus))); } public start(): Promise {