From 0c8d064c9060c521d1665bdb08ed4ed86f87e42d Mon Sep 17 00:00:00 2001 From: Gayan Perera Date: Sat, 7 Sep 2024 17:55:39 +0200 Subject: [PATCH] apply code review suggestions - move scope switching to java status. - move the setting to code navigation category. Signed-off-by: Gayan Perera --- src/extension.ts | 6 ++--- src/searchScopeStatusBarProvider.ts | 41 ----------------------------- 2 files changed, 2 insertions(+), 45 deletions(-) delete mode 100644 src/searchScopeStatusBarProvider.ts diff --git a/src/extension.ts b/src/extension.ts index 7f5d70d984..72b94ccb7d 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -40,7 +40,6 @@ import { loadSupportedJreNames } from './jdkUtils'; import { BuildFileSelector, PICKED_BUILD_FILES, cleanupWorkspaceState } from './buildFilesSelector'; import { pasteFile } from './pasteAction'; import { ServerStatusKind } from './serverStatus'; -import { searchScopeBarProvider } from './searchScopeStatusBarProvider'; const syntaxClient: SyntaxLanguageClient = new SyntaxLanguageClient(); const standardClient: StandardLanguageClient = new StandardLanguageClient(); @@ -549,13 +548,12 @@ export async function activate(context: ExtensionContext): Promise context.subscriptions.push(commands.registerCommand(Commands.CHANGE_JAVA_SEARCH_SCOPE, async () => { const selection = await window.showQuickPick(["all", "main"], { canPickMany: false, - placeHolder: "Choose a Java Search Scope", + placeHolder: `Current: ${workspace.getConfiguration().get("java.search.scope")}`, }); if(selection) { - workspace.getConfiguration().update("java.search.scope", selection, false).then(() => searchScopeBarProvider.update()); + workspace.getConfiguration().update("java.search.scope", selection, false); } })); - context.subscriptions.push(searchScopeBarProvider); context.subscriptions.push(snippetCompletionProvider.initialize()); context.subscriptions.push(serverStatusBarProvider); diff --git a/src/searchScopeStatusBarProvider.ts b/src/searchScopeStatusBarProvider.ts deleted file mode 100644 index 2499ef91e0..0000000000 --- a/src/searchScopeStatusBarProvider.ts +++ /dev/null @@ -1,41 +0,0 @@ -'use strict'; - -import { StatusBarAlignment, StatusBarItem, window, workspace } from "vscode"; -import { Disposable } from "vscode-languageclient"; -import { Commands } from "./commands"; - -class SearchScopeStatusBarProvider implements Disposable { - private statusBarItem: StatusBarItem; - - constructor() { - this.statusBarItem = window.createStatusBarItem("java.searchScope", StatusBarAlignment.Right); - this.statusBarItem.show(); - this.statusBarItem.command = { - title: "%java.change.searchScope%", - command: Commands.CHANGE_JAVA_SEARCH_SCOPE, - }; - this.update(); - } - - public dispose(): void { - this.statusBarItem?.dispose(); - } - - public update() { - const value = workspace.getConfiguration().get("java.search.scope"); - switch(value) { - case "main": { - this.statusBarItem.text = `\$(search) Java: Main`; - this.statusBarItem.tooltip = "Current java search scope : Search only on main classpath entries"; - break; - } - default: { - this.statusBarItem.text = `\$(search) Java: All`; - this.statusBarItem.tooltip = "Current java search scope : Search only on all classpath entries"; - break; - } - } - } -} - -export const searchScopeBarProvider: SearchScopeStatusBarProvider = new SearchScopeStatusBarProvider();