Skip to content

Commit b1df344

Browse files
chore: update CHANGELOG and README for version 0.1.5; enhance output handling in ccpRunner.ts
1 parent cddc058 commit b1df344

4 files changed

Lines changed: 77 additions & 16 deletions

File tree

CHANGELOG.md

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

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

5+
## [0.1.5] - 2025-06-01
6+
### Fixed
7+
- Critical statistics tracking issue where only file count was updating
8+
- Improved Python output parsing for reliable statistics collection
9+
- Fixed stderr/stdout handling to properly capture all cleaning data
10+
11+
### Changed
12+
- Removed CI/CD workflow references
13+
- Updated documentation with humorous acknowledegment of the comment paradox
14+
- Enhanced output handling resilience for different Python implementations
15+
516
## [0.1.4] - 2025-05-31
617
### Added
718
- Undo/Redo buttons to the Actions panel for easy reverting and restoring changes

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@
1818

1919
Comment Cleaner Pro is a powerful VS Code extension for removing comments from source code files. It helps you streamline your code by efficiently removing all types of comments (line, block, and documentation) across 20+ programming languages while preserving the core functionality of your code.
2020

21+
## The Ironic Truth
22+
23+
> "Yes, this comment remover has comments in its source code. It's like a barber with fabulous hair."
24+
25+
We believe in documenting our code to help contributors, even while building a tool that removes comments. Our extension removes comments from _production code_, not development code. We're like dentists who eat candy but still brush their teeth! 😉
26+
27+
You could say our source code lives by the motto: _"Do as I say, not as I'm coded."_
28+
2129
## Key Features
2230

2331
### Comprehensive Language Support
@@ -36,6 +44,7 @@ Comment Cleaner Pro is a powerful VS Code extension for removing comments from s
3644
- **Comment Count** - Track the number of comments removed per file
3745
- **Line Reduction** - See exactly how many lines were removed
3846
- **File Size Impact** - Measure the size reduction achieved
47+
- **Accurate Tracking** - Now with improved accuracy in statistics tracking
3948

4049
![Comment Cleaner Pro in action](media/demo.gif)
4150

@@ -156,7 +165,7 @@ See the [CHANGELOG](https://github.com/christliebdela/Comment-Cleaner-VsCode-Ext
156165

157166
## Contributing
158167

159-
Contributions are welcome! See CONTRIBUTING.md for guidelines.
168+
Contributions are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
160169

161170
## License
162171

@@ -166,3 +175,5 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
166175

167176

168177
Created and maintained by <a href="https://github.com/christliebdela">Christlieb Dela</a>.
178+
179+
<!-- Yes, this is a comment in a comment remover's README. The irony isn't lost on us! -->

package.json

Lines changed: 4 additions & 2 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.4",
5+
"version": "0.1.5",
66
"publisher": "ChristliebDela",
77
"icon": "media/icon.png",
88
"engines": {
@@ -182,7 +182,9 @@
182182
"clean",
183183
"remove",
184184
"code",
185-
"multiple languages"
185+
"multiple languages",
186+
"code cleanup",
187+
"optimization"
186188
],
187189
"author": {
188190
"name": "Christlieb Dela"

src/ccpRunner.ts

Lines changed: 50 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,64 @@ export function runCcpScript(filePath: string, noBackup: boolean, force: boolean
77
// Get path to the Python script, relative to extension directory
88
const pythonScriptPath = path.join(__dirname, 'python', 'ccp.py');
99

10-
// Build command with proper arguments
11-
const args = [
10+
// Check if Python script exists
11+
const fs = require('fs');
12+
if (!fs.existsSync(pythonScriptPath)) {
13+
reject(`Python script not found: ${pythonScriptPath}`);
14+
return;
15+
}
16+
17+
// Build command with proper arguments - use an array for better argument handling
18+
const pythonArgs = [
1219
pythonScriptPath,
1320
filePath,
14-
noBackup ? '--no-backup' : '',
15-
force ? '--force' : '',
16-
].filter(Boolean).map(arg => `"${arg}"`).join(' ');
21+
];
22+
23+
if (noBackup) {
24+
pythonArgs.push('--no-backup');
25+
}
26+
27+
if (force) {
28+
pythonArgs.push('--force');
29+
}
30+
31+
// Log the full command for debugging
32+
console.log(`Executing: python ${pythonArgs.join(' ')}`);
33+
vscode.window.showInformationMessage(`Running: python with ${pythonScriptPath}`);
34+
35+
// Use spawn instead of exec for better output handling
36+
const pythonProcess = cp.spawn('python', pythonArgs);
1737

18-
// Use Python to run the script
19-
const command = `python ${args}`;
38+
let stdout = '';
39+
let stderr = '';
2040

21-
vscode.window.showInformationMessage(`Running: ${command}`);
41+
pythonProcess.stdout.on('data', (data) => {
42+
stdout += data.toString();
43+
console.log(`Python stdout: ${data}`);
44+
});
45+
46+
pythonProcess.stderr.on('data', (data) => {
47+
stderr += data.toString();
48+
console.log(`Python stderr: ${data}`);
49+
});
2250

23-
// Execute the command
24-
cp.exec(command, (error, stdout, stderr) => {
25-
if (error) {
26-
reject(`Error: ${stderr || error.message}`);
51+
pythonProcess.on('close', (code) => {
52+
console.log(`Python process exited with code ${code}`);
53+
54+
if (code !== 0) {
55+
reject(`Python script failed with code ${code}: ${stderr}`);
2756
} else {
28-
resolve(stdout);
57+
if (!stdout.trim() && !stderr.trim()) {
58+
console.log("Warning: Python script produced no output");
59+
}
60+
// Pass both stdout and stderr to resolve
61+
resolve(stdout + '\n' + stderr);
2962
}
3063
});
64+
65+
pythonProcess.on('error', (err) => {
66+
reject(`Failed to execute Python: ${err.message}`);
67+
});
3168
});
3269
}
3370

0 commit comments

Comments
 (0)