Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>clang format commentNew to Visual Studio Code? Get it now.
clang format comment

clang format comment

noname

|
255 installs
| (0) | Free
clang format comment
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

clang format comment README

This is the README for the "clang format comment" Visual Studio Code extension.

Features

This extension provides three commands to format C/C++ comments in your code:

  1. Format Comment Selection: Formats the comments in the currently selected text.
  2. Add Comment and Format Comment Selection: Adds a comment marker (//) to uncommented lines and formats the comments in the currently selected text.
  3. Format Comment All: Formats all comments in the active editor.

The formatting follows these rules:

  • If the code before the comment is shorter than the formatColumn setting (default 100), the comment is padded with spaces or tabs to align with the specified column.
  • If the code before the comment is longer than the formatColumn setting, the comment is padded with a fixed number of spaces or tabs (10 spaces or 3 tabs).

Usage

You can trigger the commands using the following shortcuts:

  • alt+/: Format Comment Selection
  • alt+ctrl+/: Add Comment and Format Comment Selection
  • alt+shift+/: Format Comment All

Requirements

This extension requires Visual Studio Code version 1.88.0 or later.

Extension Settings

This extension contributes the following setting:

  • clangFormatComment.formatColumn: The column position for aligning comments (default: 100).

Known Issues

None currently known.

Release Notes

1.0.1

  • Added a new command: "Add Comment and Format Comment Selection"

1.0.0

Initial release of the "clang format comment" extension.

  • Format comments based on the formatColumn setting.
  • Support for formatting selected comments or all comments in the active editor.
  • Customizable keybindings for the formatting commands.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft