mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 04:49:35 +00:00
💄
This commit is contained in:
parent
273cca4ac8
commit
6af97c8756
|
@ -1185,10 +1185,11 @@
|
|||
"default": true,
|
||||
"description": "%config.decorations.enabled%"
|
||||
},
|
||||
"git.statusBarSync.enabled": {
|
||||
"git.enableStatusBarSync": {
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
"description": "%config.statusBarSync.enabled%"
|
||||
"description": "%config.enableStatusBarSync%",
|
||||
"scope": "resource"
|
||||
},
|
||||
"git.promptToSaveFilesBeforeCommit": {
|
||||
"type": "string",
|
||||
|
|
|
@ -96,7 +96,7 @@
|
|||
"config.enableCommitSigning": "Enables commit signing with GPG.",
|
||||
"config.discardAllScope": "Controls what changes are discarded by the `Discard all changes` command. `all` discards all changes. `tracked` discards only tracked files. `prompt` shows a prompt dialog every time the action is run.",
|
||||
"config.decorations.enabled": "Controls whether Git contributes colors and badges to the explorer and the open editors view.",
|
||||
"config.statusBarSync.enabled": "Controls whether Git sync appears in the status bar.",
|
||||
"config.enableStatusBarSync": "Controls whether the Git Sync command appears in the status bar.",
|
||||
"config.promptToSaveFilesBeforeCommit": "Controls whether Git should check for unsaved files before committing.",
|
||||
"config.promptToSaveFilesBeforeCommit.always": "Check for any unsaved files.",
|
||||
"config.promptToSaveFilesBeforeCommit.staged": "Check only for unsaved staged files.",
|
||||
|
|
|
@ -39,7 +39,7 @@ class CheckoutStatusBar {
|
|||
}
|
||||
|
||||
interface SyncStatusBarState {
|
||||
isEnabled: boolean;
|
||||
enabled: boolean;
|
||||
isSyncRunning: boolean;
|
||||
hasRemotes: boolean;
|
||||
HEAD: Branch | undefined;
|
||||
|
@ -48,7 +48,7 @@ interface SyncStatusBarState {
|
|||
class SyncStatusBar {
|
||||
|
||||
private static StartState: SyncStatusBarState = {
|
||||
isEnabled: true,
|
||||
enabled: true,
|
||||
isSyncRunning: false,
|
||||
hasRemotes: false,
|
||||
HEAD: undefined
|
||||
|
@ -69,20 +69,17 @@ class SyncStatusBar {
|
|||
repository.onDidRunGitStatus(this.onModelChange, this, this.disposables);
|
||||
repository.onDidChangeOperations(this.onOperationsChange, this, this.disposables);
|
||||
|
||||
const onEnablementChange = filterEvent(workspace.onDidChangeConfiguration, e => e.affectsConfiguration('git.statusBarSync.enabled'));
|
||||
const onEnablementChange = filterEvent(workspace.onDidChangeConfiguration, e => e.affectsConfiguration('git.enableStatusBarSync'));
|
||||
onEnablementChange(this.updateEnablement, this, this.disposables);
|
||||
|
||||
this._onDidChange.fire();
|
||||
}
|
||||
|
||||
private updateEnablement(): void {
|
||||
const isEnabled = workspace.getConfiguration('git').get('statusBarSync.enabled');
|
||||
const config = workspace.getConfiguration('git', Uri.file(this.repository.root));
|
||||
const enabled = config.get<boolean>('enableStatusBarSync', true);
|
||||
|
||||
if (isEnabled) {
|
||||
this.state = { ... this.state, isEnabled: true };
|
||||
} else {
|
||||
this.state = { ... this.state, isEnabled: false };
|
||||
}
|
||||
this.state = { ... this.state, enabled };
|
||||
}
|
||||
|
||||
private onOperationsChange(): void {
|
||||
|
@ -102,7 +99,7 @@ class SyncStatusBar {
|
|||
}
|
||||
|
||||
get command(): Command | undefined {
|
||||
if (!this.state.isEnabled || !this.state.hasRemotes) {
|
||||
if (!this.state.enabled || !this.state.hasRemotes) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue