forked from redhat-developer/vscode-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix redhat-developer#2649: Add support for choosing search scope
Provide two scopes to search from for search operations such as - reference search - call hierarchy search Signed-off-by: Gayan Perera <gayanper@gmail.com>
- Loading branch information
Showing
5 changed files
with
78 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
'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(); |