Enhanced comment highlighting and documentation generation for multiple programming languages
Comment Lens transforms your code comments into a powerful documentation and highlighting system. Whether you're writing JSDoc, JavaDoc, XML documentation, or custom comment patterns, Comment Lens makes your comments more visible, organized, and useful.
- Features
- Showcase
- Quick Start
- Supported Languages
- Configuration
- Comment Patterns
- Documentation Generation
- Dividers and Comment Boxes
- Commands
- Advanced Features
- Contributing
- Multi-language Support: C#, C++, Java, JavaScript, TypeScript, PHP, Rust
- Semantic Colors: Different colors for TODOs, FIXMEs, warnings, and more
- Custom Patterns: Define your own comment patterns with regex
- Real-time Updates: Instant highlighting as you type
- Markdown Export: Convert comments to beautiful Markdown documentation
- Multiple Formats: Support for JSDoc, JavaDoc, Doxygen, XML docs, and more
- Table of Contents: Automatic generation with customizable templates
- Code Examples: Extract and format code examples from comments
- Divider Creation: Insert decorative dividers between code sections
- Comment Boxes: Create visually appealing comment containers
- Quick Insert: Fast access via command palette and context menus
- Customizable Styles: Full control over appearance and behavior
- Auto-completion: Smart suggestions for comment tags and patterns
- Hover Information: Rich hover details for comment patterns
- Configuration UI: Easy setup through VS Code settings
Comment Highlight Showcase
Comment Box Generator (Ctrl + Shift + B)

- Open VS Code
- Go to Extensions (
Ctrl+Shift+XorCmd+Shift+X) - Search for "Comment Lens"
- Click Install
- Reload VS Code
Comment Lens works automatically once installed. Here's how to get started:
Simply write comments with common patterns:
// @todo: Implement user authentication
// @bug: Fix memory leak in event listeners
// @note: This function handles complex data processing
// @warn: Performance may be slow with large datasets- Open Command Palette (
Ctrl+Shift+PorCmd+Shift+P) - Type "Generate Documentation from File"
- Enter filename and folder (optional)
- Get beautiful Markdown documentation
- Open Command Palette (
Ctrl+Shift+PorCmd+Shift+P) - Type "Insert Divider"
- Choose your preferred style
- Customize length and text position
| Language | Documentation Format | Status |
|---|---|---|
| C# | XML Documentation | β Full Support |
| C++ | Doxygen, XML | β Full Support |
| Java | JavaDoc | β Full Support |
| JavaScript | JSDoc | β Full Support |
| TypeScript | TSDoc | β Full Support |
| PHP | PHPDoc | β Full Support |
| Rust | Rust Doc | β Full Support |
/// <summary>
/// Calculates the area of a circle
/// </summary>
/// <param name="radius">The radius of the circle</param>
/// <returns>The area of the circle</returns>
/// <exception cref="ArgumentException">Thrown when radius is negative</exception>
public double CalculateArea(double radius)
{
// Implementation here
}/**
* Represents a user in the system
*
* @param id The unique identifier
* @param name The user's full name
* @return A new User instance
* @throws IllegalArgumentException if id is negative
*/
public User createUser(int id, String name) {
// Implementation here
}/**
* Processes user data with validation
* @param {Object} user - The user object
* @param {string} user.name - User's name
* @param {string} user.email - User's email
* @returns {Promise<Object>} Processed user data
* @throws {Error} When user data is invalid
* @example
* const result = await processUser({
* name: "John Doe",
* email: "john@example.com"
* });
*/
async function processUser(user) {
// Implementation here
}Comment Lens can be configured through VS Code settings. Open Settings (Ctrl+, or Cmd+,) and search for "Comment Lens":
{
"commentLens.highlightMode": "onHover",
"commentLens.commentBoxTextPosition": "center",
"commentLens.dividerTextPosition": "center",
"commentLens.patterns": [
{
"id": "@something",
"name": "@something",
"pattern": "@something:",
"textColor": "#ff",
"backgroundColor": "#000",
"enabled": true,
"showTextColor": true,
"showBackgroundColor": true,
"overrideDefault": false
}
],
"commentLens.dividers": [
{
"id": "space-theme",
"name": "Space Theme",
"pattern": "β
β",
"length": 40,
"enabled": true,
"textPosition": "center",
"textPadding": 2
}
],
"commentLens.commentBoxes": [
{
"id": "custom-box",
"name": "Custom Box",
"topLeft": "β",
"topRight": "β",
"bottomLeft": "β",
"bottomRight": "β",
"horizontal": "β",
"vertical": "β",
"enabled": true
}
]
}commentLens.highlightMode:"always"|"onHover"- When to show comment highlighting"always": Comments are highlighted continuously as you type and view the file"onHover": Comments are only highlighted when you hover your mouse over them
commentLens.dividerTextPosition:"left"|"center"|"right"- Default text position for dividerscommentLens.commentBoxTextPosition:"left"|"center"|"right"- Default text position for comment boxes
id:string- Unique identifier for the patternname:string- Display name for the patternpattern:string- String pattern to match commentstextColor:string- Text color (hex, rgb, rgba)backgroundColor:string- Background color (hex, rgb, rgba)enabled:boolean- Whether this pattern is activeshowTextColor:boolean- Whether to apply text colorshowBackgroundColor:boolean- Whether to apply background coloroverrideDefault:boolean- Whether this pattern overrides a default one
id:string- Unique identifier for the divider stylename:string- Display name for the divider stylepattern:string- Character pattern for the dividerlength:number- Default length of the dividerenabled:boolean- Whether this divider style is activetextPosition:"left"|"center"|"right"- Position of text in the dividertextPadding:number- Number of spaces around the text
id:string- Unique identifier for the comment box stylename:string- Display name for the comment box styletopLeft:string- Character for top-left cornertopRight:string- Character for top-right cornerbottomLeft:string- Character for bottom-left cornerbottomRight:string- Character for bottom-right cornerhorizontal:string- Character for horizontal linesvertical:string- Character for vertical linesenabled:boolean- Whether this comment box style is active
Comment Lens comes with 8 built-in patterns:
| Pattern | Description | Color |
|---|---|---|
@warn |
Warnings and alerts | π΄ Red |
@question |
Questions and doubts | π΅ Blue |
@todo |
Tasks to be completed | π‘ Yellow |
@fixme |
Code that needs fixing | π Orange |
@note |
Important information | π’ Green |
@highlight |
Code sections to highlight | π‘ Yellow |
@test |
Test-related comments | π¦ Teal |
@status |
Status indicators | π΅ Blue |
Create your own patterns with string matching:
{
"id": "api-endpoint",
"name": "API Endpoint",
"pattern": "@api",
"textColor": "#2E7D32",
"backgroundColor": "#E8F5E8",
"enabled": true
}// @todo: Implement user authentication system
// @bug: Fix memory leak in event listeners
// @note: This function handles complex data processing
// @warn: Performance may be slow with large datasets
// @highlight: 15-20 This section contains critical business logic
// @api: POST /api/users - Create new user
// @security: Validate input to prevent XSS attacksComment Lens can generate beautiful Markdown documentation from your code comments. Use the Command Palette to run "Generate Documentation from File" and convert your comments into organized documentation.
Features:
- Convert JSDoc, JavaDoc, XML docs, and more to Markdown
- Automatic table of contents generation
- Group by type (functions, classes, methods)
- Extract and format code examples
Create visual separators between code sections with simple lines:
--------------------------------------------------
Available patterns: -, =, *, #, ~, >, +, _, ^, |, \, /, @, &, %, $, !, ?, :, ;, ., ,
Create visually appealing comment containers:
βββββββββββββββββββββββββββββββββββββββ
β This is an important notice β
β that needs attention β
βββββββββββββββββββββββββββββββββββββββ
Available styles: Simple, Double, Rounded, Custom Unicode
| Command | Description | Shortcut |
|---|---|---|
Comment Lens: Insert Divider |
Insert a decorative divider | Ctrl+Shift+D |
Comment Lens: Insert Comment Box |
Insert a comment box | Ctrl+Shift+B |
Comment Lens: Generate Documentation from File |
Generate Markdown documentation from current file | Ctrl+Shift+M |
Access all Comment Lens features via the Command Palette (Ctrl+Shift+P or Cmd+Shift+P):
- Type "Comment Lens" to see all available commands
- Select the desired action
- Follow the prompts or use default settings
Comment Lens provides intelligent auto-completion for comment tags:
// Type @ and get suggestions for:
// @todo, @fixme, @note, @warn, @bug, @highlight, @api, @securityHover over @highlight comments to see detailed information:
We welcome contributions! Here's how you can help:
-
Clone the repository
git clone https://github.com/spacelaxy/comment-lens.git cd comment-lens -
Install dependencies
npm install
-
Build the extension
npm run compile
-
Run tests
npm test
- Fork the repository
- Create a feature branch
git checkout -b feature/amazing-feature
- Make your changes
- Add tests for new functionality
- Commit your changes
git commit -m "Add amazing feature" - Push to your branch
git push origin feature/amazing-feature
- Open a Pull Request
- New Language Support: Add parsers for additional languages
- Documentation: Improve examples and guides
- Testing: Add more comprehensive tests
- Performance: Optimize parsing and rendering
- UI/UX: Enhance the user experience
Copyright Β© 2025 Spacelaxy LLC. All rights reserved.


