Skip to content

Commit a050f64

Browse files
v0.1.3: Add language filtering and improve UI
- Added language-specific file extension mappings for Python, HTML, and CSS - Implemented language filtering functionality in history view - Enhanced UI with appropriate icons for action buttons - Improved display of history items with proper context menus - Added helper function to identify programming languages by file extension
1 parent 5d8b99f commit a050f64

16 files changed

Lines changed: 284 additions & 72 deletions

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,37 @@ assignees: ''
1111
A clear and concise description of the bug.
1212

1313
## Steps To Reproduce
14-
1. Go to '...'
15-
2. Click on '....'
16-
3. See error
14+
1. Open VS Code with version [e.g., 1.75.0]
15+
2. Open file(s) of type [e.g., JavaScript, Python, etc.]
16+
3. Access Comment Cleaner Pro via [e.g., sidebar, command palette, right-click menu]
17+
4. Select option [e.g., Clean Current File, Clean Multiple Files]
18+
5. [Any additional steps taken]
19+
6. Observe the issue: [specific error or unexpected behavior]
1720

1821
## Expected Behavior
1922
What you expected to happen.
2023

2124
## Actual Behavior
22-
What actually happened.
25+
What actually happened. Include any error messages or console output if available.
26+
27+
## Code Sample
28+
```python
29+
# Provide a minimal, reproducible example of the code where the bug occurs
30+
def example_function():
31+
print("Hello, world!")
32+
```
2333

2434
## Screenshots
2535
If applicable, add screenshots to help explain your problem.
2636

2737
## Environment
2838
- OS: [e.g. Windows 11, macOS Ventura]
2939
- VS Code Version: [e.g. 1.75.0]
30-
- Extension Version: [e.g. 0.1.0]
40+
- Extension Version: [e.g. 0.1.2]
3141
- Python Version: [e.g. 3.9.6]
42+
- File Type(s) Affected: [e.g., .js, .py, .html]
3243

3344
## Additional Information
34-
Any other context about the problem.
45+
- Does the issue occur every time or intermittently?
46+
- Have you tried any workarounds?
47+
- Any other context about the problem.

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,7 @@ npm-debug.log*
2828
!.vscode/tasks.json
2929

3030
# Optional - typically committed, but can be excluded
31-
# package-lock.json
31+
# package-lock.json
32+
33+
# Video files
34+
videos/

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
All notable changes to the "Comment Cleaner Pro" extension will be documented in this file.
44

5+
## [0.1.3] - 2025-05-29
6+
- Added language-specific file extension mappings
7+
- Enhanced language filtering in the history view
8+
- Added proper icon support for different action items
9+
- Improved UI for buttons in the sidebar
10+
- Fixed display issues with history items
11+
512
## [0.1.2] - 2025-05-28
613

714
### Fixed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Comment Cleaner Pro
22

3-
<p align="center">
3+
<p align="Left">
44
<img src="media/icon.png" width="128" height="128" alt="Comment Cleaner Pro Logo">
55
</p>
66

7-
<p align="center">
7+
<p align="Left">
88
<a href="https://marketplace.visualstudio.com/items?itemName=ChristliebDela.comment-cleaner-pro"><img src="https://img.shields.io/visual-studio-marketplace/v/ChristliebDela.comment-cleaner-pro?style=flat-square&color=000000&labelColor=222222" alt="Version"></a>
99
<a href="https://marketplace.visualstudio.com/items?itemName=ChristliebDela.comment-cleaner-pro"><img src="https://img.shields.io/visual-studio-marketplace/d/ChristliebDela.comment-cleaner-pro?style=flat-square&color=000000&labelColor=222222" alt="Downloads"></a>
1010
<a href="https://github.com/christliebdela/Comment-Cleaner-VsCode-Ext/blob/main/LICENSE"><img src="https://img.shields.io/github/license/christliebdela/Comment-Cleaner-VsCode-Ext?style=flat-square&color=000000&labelColor=222222" alt="License"></a>

media/ccpStyles.css

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
.ccp-button-item {
2+
background-color: var(--vscode-button-background);
3+
color: var(--vscode-button-foreground);
4+
border-radius: 3px;
5+
padding: 6px 10px;
6+
margin: 4px 0;
7+
display: flex;
8+
align-items: center;
9+
justify-content: center;
10+
box-shadow: 0 1px 2px rgba(0,0,0,0.1);
11+
text-align: center;
12+
font-size: 13px;
13+
font-weight: normal;
14+
}
15+
16+
.ccp-button-item:hover {
17+
background-color: var(--vscode-button-hoverBackground);
18+
}
19+
20+
.ccp-button-item .codicon {
21+
margin-right: 5px;
22+
}
23+
24+
.icon-split-horizontal::before {
25+
content: "\ea75";
26+
font-family: "codicon";
27+
}
28+
29+
.icon-history::before {
30+
content: "\ead0";
31+
font-family: "codicon";
32+
}
33+
34+
.icon-trash::before {
35+
content: "\eb9f";
36+
font-family: "codicon";
37+
}

package.json

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "comment-cleaner-pro",
33
"displayName": "Comment Cleaner Pro",
44
"description": "A Visual Studio Code extension for removing comments from source code files across multiple programming languages.",
5-
"version": "0.1.2",
5+
"version": "0.1.3",
66
"publisher": "ChristliebDela",
77
"icon": "media/icon.png",
88
"engines": {
@@ -25,15 +25,15 @@
2525
},
2626
{
2727
"command": "ccp.compareWithBackup",
28-
"title": "$(split-horizontal) Compare with Backup"
28+
"title": "Compare with Backup"
2929
},
3030
{
3131
"command": "ccp.restoreFromBackup",
32-
"title": "$(history) Restore from Backup"
32+
"title": "Restore from Backup"
3333
},
3434
{
3535
"command": "ccp.removeFromHistory",
36-
"title": "$(trash) Remove from History"
36+
"title": "Remove from History"
3737
},
3838
{
3939
"command": "ccp.previewCleanComments",
@@ -85,7 +85,11 @@
8585
{
8686
"command": "ccp.clearHistory",
8787
"when": "view == ccpHistory",
88-
"group": "navigation"
88+
"group": "navigation",
89+
"icon": {
90+
"light": "media/light/clear.svg",
91+
"dark": "media/dark/clear.svg"
92+
}
8993
}
9094
]
9195
},
@@ -101,8 +105,9 @@
101105
"views": {
102106
"comment-cleaner-pro": [
103107
{
104-
"id": "ccpFiles",
105-
"name": "Clean Comments"
108+
"id": "ccpButtons",
109+
"name": "Actions",
110+
"type": "webview"
106111
},
107112
{
108113
"id": "ccpHistory",
@@ -139,7 +144,22 @@
139144
"description": "Preserve comments matching these regex patterns"
140145
}
141146
}
142-
}
147+
},
148+
"customEditors": [
149+
{
150+
"viewType": "ccpFiles",
151+
"displayName": "Comment Cleaner Pro",
152+
"selector": [
153+
{
154+
"filenamePattern": "*"
155+
}
156+
],
157+
"priority": "default"
158+
}
159+
],
160+
"css": [
161+
"./media/ccpStyles.css"
162+
]
143163
},
144164
"scripts": {
145165
"vscode:prepublish": "npm run compile",

src/ccpViewProvider.ts

Lines changed: 40 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)