sloganking / scfmt

A code formatter for structured comments
MIT License
0 stars 0 forks source link
codeformatter formatter rust

Structured commenting formatter (scfmt)

scfmt is a formatter designed to enable structured commenting in your code. Running scfmt after traditional code formatters, will ensure your structured comments are indented correctly and not mangled. This repository provides both a CLI for quickly formatting files, and a rust library for adding scfmt support to other projects.

Quick Links

FAQ

Features

Formatting

scfmt will format strings with bracketed structured comments, so that their contents inside them are correctly indented.

Adding Brackets

Adding brackets converts the bracketless method of structured commenting to the bracketed version. Strucutred comments must be bracketed before being run through the formatter, or else no change will take effect.

Removing Brackets

Removing brackets converts the bracketed method of structured commenting to the bracketless version. Bracketless structured comments are less verbose, but have no method of being recovered if their whitespace gets messed up. Say after running them through a traditional code formatter.

Nullifying Brackets

Nullifying brackets puts a _ character in front of any existing bracketed comments. This allows for more easily converting existing projects to being compatible with structured commenting.

What is scfmt allowed to do?

The only things scfmt is allowed to do are:

What will scfmt not do?

Noteworthy bugs

/*
//>
comment line that will get indented after formatting
//<
*/

let multi_line_str = "
//>
string line that will get indented after formatting
//<
"