VS Thanos Snap
"Perfectly balanced, as all code should be."
Bring the power of Thanos to your codebase! This VS Code extension randomly deletes 50% of "expendable" code (comments, console logs, and empty lines) with a cinematic dust effect animation.
Features
- Smart Detection: Automatically identifies expendable code across multiple languages
- Cinematic Animation: Watch your code fade away with a dust effect
- Highly Configurable: Customize what gets deleted and how
- Multi-Language Support: Works with JavaScript, TypeScript, Python, Java, C#, C++, Go, Rust, PHP, Ruby, and more
- Safe by Default: Confirmation dialog before deletion (can be disabled)
- Statistics: See exactly what was deleted
Installation
From VS Code Marketplace (Coming Soon)
- Open VS Code
- Go to Extensions (
Ctrl+Shift+X / Cmd+Shift+X)
- Search for "VS Thanos Snap"
- Click Install
Usage
- Open any code file
- Open Command Palette (
Ctrl+Shift+P / Cmd+Shift+P)
- Type "Thanos Snap: Balance the Code"
- Confirm the snap (if confirmation is enabled)
- Watch the magic happen!
Configuration
Access settings via File > Preferences > Settings and search for "Thanos Snap"
Available Settings
thanosSnap.confirmBeforeSnap
- Type:
boolean
- Default:
true
- Description: Show confirmation dialog before snapping
thanosSnap.targetPatterns
thanosSnap.animationDuration
- Type:
number
- Default:
1500
- Range:
0-5000 (milliseconds)
- Description: Duration of the dust effect animation
Example Configuration
{
"thanosSnap.confirmBeforeSnap": false,
"thanosSnap.targetPatterns": {
"comments": true,
"consoleLogs": true,
"emptyLines": false
},
"thanosSnap.animationDuration": 2000
}
What Gets Deleted?
- JavaScript/TypeScript:
//, /*, */
- Python:
#
- Java/C#/C++:
//, /*, */
- Ruby:
#
- And more!
Console Logs
- JavaScript/TypeScript:
console.log(), console.warn(), etc.
- Python:
print(), logging.*
- Java:
System.out.print*, logger.*
- C#:
Console.Write*, Debug.Write*
- And more!
Empty Lines
Any line with only whitespace
Examples
Before Snap
// This is a comment
function calculateTotal(items) {
console.log('Calculating total...');
let total = 0;
// Loop through items
for (const item of items) {
console.log('Processing:', item);
total += item.price;
}
console.log('Total:', total);
return total;
}
After Snap (Example Result)
function calculateTotal(items) {
console.log('Calculating total...');
let total = 0;
for (const item of items) {
total += item.price;
}
return total;
}
Note: Results are random - approximately 50% of expendable lines are deleted
Supported Languages
- JavaScript / TypeScript
- Python
- Java
- C# / C / C++
- Go
- Rust
- PHP
- Ruby
- And more coming soon!
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
⚠️ Disclaimer
This extension permanently deletes code. While VS Code's undo feature (Ctrl+Z / Cmd+Z) will restore deleted lines, please use with caution. Always commit your work before snapping!
🙏 Acknowledgments
- Inspired by Thanos from the Marvel Cinematic Universe
- Built with ❤️ using the VS Code Extension API
Remember: With great power comes great responsibility. Snap wisely! ⚡