Insert perfectly formatted comment separators with one keystroke. Language-aware, configurable, toggleable.
Saturno FancyComments is a VS Code extension that generates consistently formatted single-line and multi-line comment separators. It reads your language's comment syntax automatically and fills to a configurable width. Press once to format, press again to undo.
Maintained by Saturno.Software.
Quick Start
Install from Marketplace
code --install-extension SaturnoSoftware.saturno-fancy-comments
Use
- Place cursor on a line (empty or with text)
- Open Command Palette (
Ctrl+Shift+P)
- Run
Saturno: Single Line Comment or Saturno: Multi Line Comment
Before:
CONSTANTS
After (Single Line):
// --- CONSTANTS ----------------------------------------------------------
After (Multi Line):
/*
* CONSTANTS
*/
// ------------------------------------------------------------------------
Press the same command again on the formatted line to toggle it back to plain text.
Features
- Single-Line Separators -- 80-char formatted comment with fill characters
- Multi-Line Blocks -- Open/middle/close block with trailing separator
- Toggle/Undo -- Same command strips formatting back to plain text
- Language-Aware -- Reads VS Code's language config (
//, #, <!-- -->, etc.)
- Block-Aware -- Multi-line toggle works with cursor on any line of the block
- Configurable -- Line width, fill character, prefix length via VS Code settings
- Zero Config -- Works out of the box with sensible defaults
Installation
From Marketplace
Search for Saturno FancyComments in the VS Code Extensions sidebar, or install via CLI:
code --install-extension SaturnoSoftware.saturno-fancy-comments
From VSIX
code --install-extension saturno-fancy-comments-2.0.5.vsix
Requirements
Configuration
All settings are available in VS Code Settings UI under Saturno FancyComments, or in settings.json:
{
"saturno-fancy-comments.lineWidth": 80,
"saturno-fancy-comments.separatorChar": "-",
"saturno-fancy-comments.separatorPrefixLength": 3
}
| Setting |
Default |
Description |
lineWidth |
80 |
Total width of generated comment lines (20-200) |
separatorChar |
"-" |
Character used to fill separator lines (single char) |
separatorPrefixLength |
3 |
Number of separator characters before the text (1-20) |
Examples with Different Configs
Default (-, width 80, prefix 3):
// --- Title --------------------------------------------------------------
Stars (*, width 80, prefix 3):
// *** Title **************************************************************
Equals (=, width 120, prefix 5):
// ===== Title =====================================...============================
Commands
| Command |
Title |
Description |
saturno-fancy-comments.singleLineComment |
Saturno: Single Line Comment |
Format/toggle a single separator line |
saturno-fancy-comments.multiLineComment |
Saturno: Multi Line Comment |
Format/toggle a multi-line comment block |
Suggested Keybindings
Add to your keybindings.json:
[
{
"key": "ctrl+alt+/",
"command": "saturno-fancy-comments.singleLineComment"
},
{
"key": "ctrl+alt+shift+/",
"command": "saturno-fancy-comments.multiLineComment"
}
]
How It Works
The extension reads VS Code's built-in language configuration files (the same ones used by Toggle Line Comment). It extracts lineComment and blockComment definitions for the active file's language. No manual setup required.
Supported out of the box: C, C++, C#, Java, JavaScript, TypeScript, Python, Ruby, Go, Rust, HTML, CSS, Shell, PowerShell, and any language with a VS Code language extension.
Toggle Detection
When you run the command on a line that's already a fancy comment, the extension detects the pattern (prefix + separator chars + optional text + fill + suffix) and strips it back to plain text. Detection uses your current separatorChar setting.
For multi-line blocks, the extension searches up to 3 lines backwards from the cursor to find the block start, so toggle works regardless of which line your cursor is on.
Local Development
npm install
npm test # Compile + run 297 tests
npm run lint # ESLint check
npm run build # Full build + staging
npm run package # Create .vsix
Contributing
Contributions welcome! Please:
- Follow existing code style
- Add tests for new features
- Submit pull requests against
main
License
GPL-3.0 -- See LICENSE.txt for details.
Maintained by Saturno.Software
FAQ
Q: Does it work with my language?
A: If VS Code can toggle comments in your language, FancyComments will work. It reads the same language configuration.
Q: Can I use * or = instead of -?
A: Yes. Set saturno-fancy-comments.separatorChar to any single character.
Q: Does toggle work if I change the separator char after creating comments?
A: No. Detection uses your current config. Old comments with a different char will be treated as plain text.
Q: Does it work with multi-cursor / selections?
A: It operates on the line where the primary cursor is. Multi-cursor is not currently supported.
Q: How do I install without the Marketplace?
A: Build the .vsix with npm run package, then code --install-extension __DIST/*.vsix.
Links
Made with