Skip to content

Commit 1f1954b

Browse files
committed
added icons to source control view
1 parent 6a8a351 commit 1f1954b

File tree

6 files changed

+69
-8
lines changed

6 files changed

+69
-8
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
**v0.3.0**
2+
=============================================
3+
4+
## What's New
5+
- Added Icons to Source control view.
6+
- Changed Source control group to 'Changes' from 'Modified'
7+
18
**v0.2.0**
29
=============================================
310

extension.js

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,45 @@ const updateResourceGroup = (data, type) => {
7171
return matches;
7272
}
7373

74+
const updateChangesResourceGroup = (data) => {
75+
const changes = ['added', 'modified', 'deletion', 'deleted'];
76+
let matches = [];
77+
const iconsRootPath = path.join(__dirname, 'icons');
78+
79+
data.forEach(item => {
80+
if (changes.indexOf(item['wc-status'].$.item) != -1) {
81+
matches.push({
82+
resourceUri: createResourceUri(item.$.path),
83+
decorations: {
84+
iconPath: vscode.Uri.file(path.join(iconsRootPath, `${item['wc-status'].$.item}.svg`)),
85+
tooltip: item['wc-status'].$.item,
86+
},
87+
});
88+
}
89+
});
90+
91+
return matches;
92+
}
93+
94+
const updateNotTrackedResourceGroup = (data) => {
95+
let matches = [];
96+
const iconsRootPath = path.join(__dirname, 'icons');
97+
98+
data.forEach(item => {
99+
if (item['wc-status'].$.item == 'unversioned') {
100+
matches.push({
101+
resourceUri: createResourceUri(item.$.path),
102+
decorations: {
103+
iconPath: vscode.Uri.file(path.join(iconsRootPath, `unversioned.svg`)),
104+
tooltip: item['wc-status'].$.item,
105+
},
106+
});
107+
}
108+
});
109+
110+
return matches;
111+
}
112+
74113
function activate(context) {
75114
console.log('svn-scm is now active!');
76115

@@ -86,20 +125,17 @@ function activate(context) {
86125
const sourceControl = svnSCM.init();
87126
svnContentProvider.init();
88127

89-
const modified = sourceControl.createResourceGroup('modified', 'Modified');
90-
const removed = sourceControl.createResourceGroup('removed', 'Removed');
128+
const changes = sourceControl.createResourceGroup('changes', 'Changes');
91129
const notTracked = sourceControl.createResourceGroup('unversioned', 'Not Tracked');
92130

93-
modified.hideWhenEmpty = true;
94-
removed.hideWhenEmpty = true;
131+
changes.hideWhenEmpty = true;
95132
notTracked.hideWhenEmpty = true;
96133

97134
const main = () => {
98135
return checkAllFiles(client, statusBar)
99136
.then((data) => {
100-
modified.resourceStates = updateResourceGroup(data, 'modified');
101-
removed.resourceStates = updateResourceGroup(data, 'removed');
102-
notTracked.resourceStates = updateResourceGroup(data, 'unversioned');
137+
changes.resourceStates = updateChangesResourceGroup(data);
138+
notTracked.resourceStates = updateNotTrackedResourceGroup(data);
103139
})
104140
.catch((err) => vscode.window.showErrorMessage(err));
105141
};

icons/added.svg

Lines changed: 6 additions & 0 deletions
Loading

icons/deleted.svg

Lines changed: 6 additions & 0 deletions
Loading

icons/unversioned.svg

Lines changed: 6 additions & 0 deletions
Loading

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "svn-scm",
33
"displayName": "svn-scm",
44
"description": "",
5-
"version": "0.2.0",
5+
"version": "0.3.0",
66
"publisher": "johnstoncode",
77
"engines": {
88
"vscode": "^1.16.0"

0 commit comments

Comments
 (0)