C++ Code Doctor
Detect unused variables and unused includes in C++ directly in Visual Studio Code.
C++ Code Doctor helps you find unused variables, detect unnecessary #include directives, reduce compile times, and keep your C++ code clean, efficient, and maintainable.
Supports both fast RegEx-based analysis (Free) and accurate AST-based analysis (Pro).
What This Extension Does
C++ Code Doctor is a C++ static analysis extension for VS Code focused on identifying:
- Unused variables in C++ files
- Unused includes in C++ projects
- Dead code patterns (planned)
- Inefficient or unnecessary dependencies
By detecting unused variables and unused includes early, you can:
- Reduce compilation time
- Improve code readability
- Avoid hidden bugs
- Keep your codebase clean and maintainable
Visual Demo
Unused Variable Detection (C++)
Detects unused variables in C++ files directly inside VS Code.
Unused Include Detection (C++)
Detects unused includes and unnecessary dependencies in C++ files.
Free vs Pro
| Feature |
Free |
Pro |
| Analysis method |
Regex-based detection |
AST-based analysis |
| Unused variable detection |
✔️ |
✔️ |
| Unused include detection |
✔️ |
✔️ |
| Dead code detection |
❌ |
✔️* |
| Unevaluated return values |
❌ |
✔️* |
| Project-wide analysis |
❌ |
✔️ |
| Accuracy |
Medium |
High |
| False positive reduction |
❌ |
✔️ |
| Custom findings panel |
❌ |
✔️ |
- planned in upcoming release
Free Version (RegEx-Based C++ Analysis)
The Free version provides fast, lightweight detection of unused variables and unused includes in C++.
Included
- Detect unused variables in C++ (file-level)
- Detect unused includes in C++ (file-level)
- Fast execution inside VS Code
- No external dependencies
Limitations
- May produce false positives in complex C++ code
- Limited handling of templates, macros, and namespaces
- Less accurate for large or complex projects
- Header files with multiple dots (e.g.
my.header.hpp) may be misdetected
- System headers are ignored
Pro Version (AST-Based C++ Analysis)
The Pro version uses AST (Abstract Syntax Tree) analysis for accurate C++ static analysis.
This enables reliable detection of unused variables and unused includes in complex C++ codebases.
Included
- AST-based unused variable detection (scope-aware)
- AST-based unused include detection (scope-aware)
- Accurate C++ parsing using Tree-sitter
- Project-wide analysis across multiple files
- Dedicated findings panel
- Mark findings as false positives and persist them
Ideal for larger C++ projects and professional development workflows.
👉 Upgrade here: https://www.rscd.net/pricing/
Why Use C++ Code Doctor?
Unlike general-purpose tools, C++ Code Doctor focuses specifically on:
- Detecting unused variables in C++
- Detecting unused includes in C++
- Providing instant feedback directly in VS Code
- Working without requiring a build step
This makes it faster and easier to maintain clean C++ code during development.
Requirements
- Visual Studio Code
- A C++ project
No additional setup required.
Activating Pro
Set your license key in:
cppCodeDoctor.proLicenseKey
Known Limitations
Free Version
- Less accurate in complex C++ syntax
- Possible false positives or false negatives
- Limited macro and template handling
Pro Version
- Some
using / typedef cases may not always resolve perfectly
- Complex include chains can cause edge cases
- Extremely macro-heavy code may still produce rare inaccuracies
Get Started
Install C++ Code Doctor and immediately start detecting unused variables and unused includes in your C++ code.
Upgrade to Pro for full AST-based analysis and higher accuracy:
https://www.rscd.net/pricing/
Third-Party Components
This extension uses:
- Tree-sitter (MIT)
- Tree-sitter C/C++ grammars (MIT)
- vscode-languageclient (MIT)
- TypeScript (Apache 2.0)
- ESLint (MIT)
See the NOTICE file for full details.
License
This project is proprietary software.
See LICENSE for details.
Changelog
See CHANGELOG.md for all updates and improvements.