Skip to content

Commit

Permalink
added icons to source control view
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnstonCode committed Sep 29, 2017
1 parent 6a8a351 commit 1f1954b
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 8 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
**v0.3.0**
=============================================

## What's New
- Added Icons to Source control view.
- Changed Source control group to 'Changes' from 'Modified'

**v0.2.0**
=============================================

Expand Down
50 changes: 43 additions & 7 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,45 @@ const updateResourceGroup = (data, type) => {
return matches;
}

const updateChangesResourceGroup = (data) => {
const changes = ['added', 'modified', 'deletion', 'deleted'];
let matches = [];
const iconsRootPath = path.join(__dirname, 'icons');

data.forEach(item => {
if (changes.indexOf(item['wc-status'].$.item) != -1) {
matches.push({
resourceUri: createResourceUri(item.$.path),
decorations: {
iconPath: vscode.Uri.file(path.join(iconsRootPath, `${item['wc-status'].$.item}.svg`)),
tooltip: item['wc-status'].$.item,
},
});
}
});

return matches;
}

const updateNotTrackedResourceGroup = (data) => {
let matches = [];
const iconsRootPath = path.join(__dirname, 'icons');

data.forEach(item => {
if (item['wc-status'].$.item == 'unversioned') {
matches.push({
resourceUri: createResourceUri(item.$.path),
decorations: {
iconPath: vscode.Uri.file(path.join(iconsRootPath, `unversioned.svg`)),
tooltip: item['wc-status'].$.item,
},
});
}
});

return matches;
}

function activate(context) {
console.log('svn-scm is now active!');

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

const modified = sourceControl.createResourceGroup('modified', 'Modified');
const removed = sourceControl.createResourceGroup('removed', 'Removed');
const changes = sourceControl.createResourceGroup('changes', 'Changes');
const notTracked = sourceControl.createResourceGroup('unversioned', 'Not Tracked');

modified.hideWhenEmpty = true;
removed.hideWhenEmpty = true;
changes.hideWhenEmpty = true;
notTracked.hideWhenEmpty = true;

const main = () => {
return checkAllFiles(client, statusBar)
.then((data) => {
modified.resourceStates = updateResourceGroup(data, 'modified');
removed.resourceStates = updateResourceGroup(data, 'removed');
notTracked.resourceStates = updateResourceGroup(data, 'unversioned');
changes.resourceStates = updateChangesResourceGroup(data);
notTracked.resourceStates = updateNotTrackedResourceGroup(data);
})
.catch((err) => vscode.window.showErrorMessage(err));
};
Expand Down
6 changes: 6 additions & 0 deletions icons/added.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions icons/deleted.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions icons/unversioned.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "svn-scm",
"displayName": "svn-scm",
"description": "",
"version": "0.2.0",
"version": "0.3.0",
"publisher": "johnstoncode",
"engines": {
"vscode": "^1.16.0"
Expand Down

0 comments on commit 1f1954b

Please sign in to comment.