@@ -71,6 +71,45 @@ const updateResourceGroup = (data, type) => {
71
71
return matches ;
72
72
}
73
73
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
+
74
113
function activate ( context ) {
75
114
console . log ( 'svn-scm is now active!' ) ;
76
115
@@ -86,20 +125,17 @@ function activate(context) {
86
125
const sourceControl = svnSCM . init ( ) ;
87
126
svnContentProvider . init ( ) ;
88
127
89
- const modified = sourceControl . createResourceGroup ( 'modified' , 'Modified' ) ;
90
- const removed = sourceControl . createResourceGroup ( 'removed' , 'Removed' ) ;
128
+ const changes = sourceControl . createResourceGroup ( 'changes' , 'Changes' ) ;
91
129
const notTracked = sourceControl . createResourceGroup ( 'unversioned' , 'Not Tracked' ) ;
92
130
93
- modified . hideWhenEmpty = true ;
94
- removed . hideWhenEmpty = true ;
131
+ changes . hideWhenEmpty = true ;
95
132
notTracked . hideWhenEmpty = true ;
96
133
97
134
const main = ( ) => {
98
135
return checkAllFiles ( client , statusBar )
99
136
. 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 ) ;
103
139
} )
104
140
. catch ( ( err ) => vscode . window . showErrorMessage ( err ) ) ;
105
141
} ;
0 commit comments