@@ -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+
74113function 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 } ;
0 commit comments