Skip to content

Commit 2089555

Browse files
committed
Add settings to hide the icons in the status bar
1 parent 51cf543 commit 2089555

File tree

2 files changed

+36
-11
lines changed

2 files changed

+36
-11
lines changed

package.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,25 @@
1313
],
1414
"main": "./out/extension",
1515
"contributes": {
16+
"configuration": [
17+
{
18+
"title": "GitExtensions configuration",
19+
"properties": {
20+
"gitExtensions.statusbar.browse": {
21+
"type": "boolean",
22+
"default": true,
23+
"description": "Display the 'Browse in GitExtensions' icon in the status bar",
24+
"scope": "window"
25+
},
26+
"gitExtensions.statusbar.filehistory": {
27+
"type": "boolean",
28+
"default": true,
29+
"description": "Display the 'View file history in GitExtensions' icon in the status bar",
30+
"scope": "window"
31+
}
32+
}
33+
}
34+
],
1635
"commands": [
1736
{
1837
"command": "extension.gitextensions.blame",

src/extension.ts

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,23 @@ export function activate(context: vscode.ExtensionContext) {
5050
// This line of code will only be executed once when your extension is activated
5151
console.log('Activing "vscode-gitextensions" extension.');
5252

53-
const statusHistory = window.createStatusBarItem(vscode.StatusBarAlignment.Right, 500);
54-
statusHistory.command = 'extension.gitextensions.filehistory';
55-
statusHistory.text = '$(history)';
56-
statusHistory.tooltip = 'See current file history in GitExtensions';
57-
statusHistory.show();
58-
59-
const statusBrowse = window.createStatusBarItem(vscode.StatusBarAlignment.Right, 500);
60-
statusBrowse.command = 'extension.gitextensions.browse';
61-
statusBrowse.text = '$(git-branch)';
62-
statusBrowse.tooltip = 'Browse repository in GitExtensions';
63-
statusBrowse.show();
53+
const shouldDisplayFileHistoryIcon = vscode.workspace.getConfiguration().get('gitExtensions.statusbar.filehistory');
54+
if(shouldDisplayFileHistoryIcon) {
55+
const statusHistory = window.createStatusBarItem(vscode.StatusBarAlignment.Right, 500);
56+
statusHistory.command = 'extension.gitextensions.filehistory';
57+
statusHistory.text = '$(history)';
58+
statusHistory.tooltip = 'See current file history in GitExtensions';
59+
statusHistory.show();
60+
}
61+
62+
const shouldDisplayBrowseIcon = vscode.workspace.getConfiguration().get('gitExtensions.statusbar.browse');
63+
if(shouldDisplayBrowseIcon) {
64+
const statusBrowse = window.createStatusBarItem(vscode.StatusBarAlignment.Right, 500);
65+
statusBrowse.command = 'extension.gitextensions.browse';
66+
statusBrowse.text = '$(git-branch)';
67+
statusBrowse.tooltip = 'Browse repository in GitExtensions';
68+
statusBrowse.show();
69+
}
6470

6571
// The command has been defined in the package.json file
6672
// Now provide the implementation of the command with registerCommand

0 commit comments

Comments
 (0)