@@ -31,22 +31,26 @@ export class FilesViewProvider implements vscode.TreeDataProvider<FileItem> {
3131 }
3232
3333 const cleanCurrentItem = new FileItem (
34- 'Clean Current File' , // Remove the $(trash) prefix
34+ 'Clean Current File' ,
3535 vscode . TreeItemCollapsibleState . None ,
3636 {
3737 command : 'ccp.cleanComments' ,
3838 title : 'Clean Current File'
39- }
39+ } ,
40+ undefined ,
41+ true // Mark as button
4042 ) ;
4143 cleanCurrentItem . iconPath = new vscode . ThemeIcon ( 'trash' ) ;
4244
4345 const cleanMultipleItem = new FileItem (
44- 'Clean Multiple Files' , // Remove the $(files) prefix
46+ 'Clean Multiple Files' ,
4547 vscode . TreeItemCollapsibleState . None ,
4648 {
4749 command : 'ccp.cleanMultipleFiles' ,
4850 title : 'Clean Multiple Files'
49- }
51+ } ,
52+ undefined ,
53+ true // Mark as button
5054 ) ;
5155 cleanMultipleItem . iconPath = new vscode . ThemeIcon ( 'files' ) ;
5256
@@ -119,14 +123,22 @@ export class HistoryViewProvider implements vscode.TreeDataProvider<FileItem> {
119123
120124 // Add filter option at top
121125 const filterItem = new FileItem (
122- 'Filter by Language' , // Remove the $(filter) prefix
126+ 'Filter by Language' ,
123127 vscode . TreeItemCollapsibleState . None ,
124128 {
125129 command : 'ccp.setLanguageFilter' ,
126130 title : 'Filter by Language'
127- }
131+ } ,
132+ undefined ,
133+ true // Mark as button
128134 ) ;
135+ // Add these lines to make the filter item correctly appear as a button
129136 filterItem . iconPath = new vscode . ThemeIcon ( 'filter' ) ;
137+ filterItem . contextValue = 'buttonItem' ;
138+ // Add this line to apply CSS classes
139+ filterItem . tooltip = 'Filter history by programming language' ;
140+ // This is important to make VS Code apply custom styling
141+ filterItem . description = '' ;
130142 items . push ( filterItem ) ;
131143
132144 // Filter history items by language if filter is active
@@ -166,29 +178,44 @@ class FileItem extends vscode.TreeItem {
166178 public readonly label : string ,
167179 public readonly collapsibleState : vscode . TreeItemCollapsibleState ,
168180 public readonly command ?: vscode . Command ,
169- public readonly filePath ?: string
181+ public readonly filePath ?: string ,
182+ public readonly isButton : boolean = false
170183 ) {
171184 super ( label , collapsibleState ) ;
172185 this . tooltip = filePath || label ;
173- this . description = filePath ? path . dirname ( filePath ) : '' ;
174186
175- // Add appropriate icons based on the action type
187+ if ( isButton ) {
188+ // Make items look like buttons
189+ this . description = "" ;
190+ this . tooltip = command ?. title || label ;
191+ } else {
192+ this . description = filePath ? path . dirname ( filePath ) : '' ;
193+ }
194+
195+ // Set appropriate icon based on action type
176196 if ( label === 'Clean Current File' ) {
177197 this . iconPath = new vscode . ThemeIcon ( 'trash' ) ;
198+ this . contextValue = 'buttonItem' ;
178199 } else if ( label === 'Clean Multiple Files' ) {
179200 this . iconPath = new vscode . ThemeIcon ( 'files' ) ;
201+ this . contextValue = 'buttonItem' ;
180202 } else if ( label === 'Filter by Language' ) {
181203 this . iconPath = new vscode . ThemeIcon ( 'filter' ) ;
182- } else if ( label === 'Preview Comment Removal' ) {
183- this . iconPath = new vscode . ThemeIcon ( 'eye' ) ;
184- } else if ( label . startsWith ( 'Compare with' ) ) {
204+ this . contextValue = 'buttonItem' ;
205+ } else if ( label === 'Compare with Backup' ) {
185206 this . iconPath = new vscode . ThemeIcon ( 'split-horizontal' ) ;
186- } else if ( label . startsWith ( 'Restore from' ) ) {
207+ this . contextValue = 'buttonItem' ;
208+ } else if ( label === 'Restore from Backup' ) {
187209 this . iconPath = new vscode . ThemeIcon ( 'history' ) ;
210+ this . contextValue = 'buttonItem' ;
211+ } else if ( label === 'Remove from History' ) {
212+ this . iconPath = new vscode . ThemeIcon ( 'trash' ) ;
213+ this . contextValue = 'buttonItem' ;
188214 } else {
189215 // For file entries in history
190216 if ( filePath ) {
191217 this . iconPath = vscode . ThemeIcon . File ;
218+ this . contextValue = 'historyItem' ;
192219 }
193220 }
194221 }
0 commit comments