Skip to content

Commit 3625061

Browse files
committed
styling, menus
1 parent bf9130e commit 3625061

3 files changed

Lines changed: 36 additions & 17 deletions

File tree

extensions/git/src/repository.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -729,10 +729,10 @@ export class Repository implements Disposable {
729729
this.updateInputBoxPlaceholder();
730730
this.disposables.push(this.onDidRunGitStatus(() => this.updateInputBoxPlaceholder()));
731731

732-
this._mergeGroup = this._sourceControl.createResourceGroup('merge', localize('merge changes', "MERGE CHANGES"));
733-
this._indexGroup = this._sourceControl.createResourceGroup('index', localize('staged changes', "STAGED CHANGES"));
734-
this._workingTreeGroup = this._sourceControl.createResourceGroup('workingTree', localize('changes', "CHANGES"));
735-
this._untrackedGroup = this._sourceControl.createResourceGroup('untracked', localize('untracked changes', "UNTRACKED CHANGES"));
732+
this._mergeGroup = this._sourceControl.createResourceGroup('merge', localize('merge changes', "Merge Changes"));
733+
this._indexGroup = this._sourceControl.createResourceGroup('index', localize('staged changes', "Staged Changes"));
734+
this._workingTreeGroup = this._sourceControl.createResourceGroup('workingTree', localize('changes', "Changes"));
735+
this._untrackedGroup = this._sourceControl.createResourceGroup('untracked', localize('untracked changes', "Untracked Changes"));
736736

737737
const updateIndexGroupVisibility = () => {
738738
const config = workspace.getConfiguration('git', root);

src/vs/workbench/contrib/scm/browser/media/scm.css

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,25 @@
6161
.scm-viewlet .scm-provider > .status {
6262
flex: 1;
6363
display: flex;
64-
padding-right: 10px;
64+
padding: 0 10px;
6565
justify-content: flex-end;
6666
overflow: hidden;
6767
}
6868

69+
.scm-viewlet .scm-provider > .status > .monaco-action-bar {
70+
display: flex;
71+
align-items: center;
72+
}
73+
74+
.scm-viewlet .scm-provider > .status > .monaco-action-bar > .actions-container {
75+
box-sizing: border-box;
76+
border-width: 1px;
77+
border-style: solid;
78+
height: calc(100% - 4px);
79+
border-radius: 10px;
80+
padding: 0 4px;
81+
}
82+
6983
.scm-viewlet .scm-provider > .status > .monaco-action-bar .action-item {
7084
margin-left: 4px;
7185
text-overflow: ellipsis;
@@ -106,8 +120,6 @@
106120

107121
.scm-viewlet .monaco-list-row .resource-group > .name {
108122
flex: 1;
109-
font-size: 11px;
110-
font-weight: bold;
111123
overflow: hidden;
112124
text-overflow: ellipsis;
113125
}

src/vs/workbench/contrib/scm/browser/scmViewPane.ts

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ import { compareFileNames, comparePaths } from 'vs/base/common/comparers';
4343
import { FuzzyScore, createMatches, IMatch } from 'vs/base/common/filters';
4444
import { IViewDescriptorService } from 'vs/workbench/common/views';
4545
import { localize } from 'vs/nls';
46-
import { flatten, find } from 'vs/base/common/arrays';
46+
import { flatten } from 'vs/base/common/arrays';
4747
import { memoize } from 'vs/base/common/decorators';
4848
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
4949
import { toResource, SideBySideEditor } from 'vs/workbench/common/editor';
50-
import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme';
50+
import { SIDE_BAR_BACKGROUND, SIDE_BAR_BORDER } from 'vs/workbench/common/theme';
5151
import { CodeEditorWidget, ICodeEditorWidgetOptions } from 'vs/editor/browser/widget/codeEditorWidget';
5252
import { ITextModel } from 'vs/editor/common/model';
5353
import { IEditorConstructionOptions } from 'vs/editor/common/config/editorOptions';
@@ -989,7 +989,7 @@ class ViewModel {
989989
const groupItem = item.groupItems[j];
990990
const resource = this.mode === ViewModelMode.Tree
991991
? groupItem.tree.getNode(uri)?.element
992-
: find(groupItem.resources, r => isEqual(r.sourceUri, uri));
992+
: groupItem.resources.find(r => isEqual(r.sourceUri, uri));
993993

994994
if (resource) {
995995
this.tree.reveal(resource);
@@ -1002,22 +1002,22 @@ class ViewModel {
10021002
}
10031003

10041004
getViewActions(): IAction[] {
1005-
if (this.items.length !== 1) {
1005+
if (this.repositories.elements.length !== 1) {
10061006
return [];
10071007
}
10081008

1009-
const menus = this.menus.getRepositoryMenus(this.items[0].element.provider);
1009+
const menus = this.menus.getRepositoryMenus(this.repositories.elements[0].provider);
10101010
return menus.getTitleActions();
10111011
}
10121012

10131013
getViewSecondaryActions(): IAction[] {
10141014
const viewAction = new SCMViewSubMenuAction(this);
10151015

1016-
if (this.items.length !== 1) {
1017-
return [viewAction];
1016+
if (this.repositories.elements.length !== 1) {
1017+
return viewAction.entries;
10181018
}
10191019

1020-
const menus = this.menus.getRepositoryMenus(this.items[0].element.provider);
1020+
const menus = this.menus.getRepositoryMenus(this.repositories.elements[0].provider);
10211021
const secondaryActions = menus.getTitleSecondaryActions();
10221022

10231023
if (secondaryActions.length === 0) {
@@ -1028,11 +1028,11 @@ class ViewModel {
10281028
}
10291029

10301030
getViewActionsContext(): any {
1031-
if (this.items.length !== 1) {
1031+
if (this.repositories.elements.length !== 1) {
10321032
return undefined;
10331033
}
10341034

1035-
return this.items[0].element.provider;
1035+
return this.repositories.elements[0].provider;
10361036
}
10371037

10381038
dispose(): void {
@@ -1452,6 +1452,8 @@ export class SCMViewPane extends ViewPane {
14521452
this.menus = this.instantiationService.createInstance(SCMMenus, repositories);
14531453
this._register(this.menus);
14541454

1455+
this._register(repositories.onDidSplice(() => this.updateActions()));
1456+
14551457
const delegate = new ProviderListDelegate();
14561458

14571459
const actionViewItemProvider = (action: IAction) => this.getActionViewItem(action);
@@ -1759,4 +1761,9 @@ registerThemingParticipant((theme, collector) => {
17591761
if (inputValidationErrorForegroundColor) {
17601762
collector.addRule(`.scm-viewlet .scm-editor-validation.validation-error { color: ${inputValidationErrorForegroundColor}; }`);
17611763
}
1764+
1765+
const repositoryStatusActionsBorderColor = theme.getColor(SIDE_BAR_BORDER);
1766+
if (repositoryStatusActionsBorderColor) {
1767+
collector.addRule(`.scm-viewlet .scm-provider > .status > .monaco-action-bar > .actions-container { border-color: ${repositoryStatusActionsBorderColor}; }`);
1768+
}
17621769
});

0 commit comments

Comments
 (0)