Crates.io | scfmt |
lib.rs | scfmt |
version | 0.3.1 |
source | src |
created_at | 2022-04-14 03:45:19.191078 |
updated_at | 2022-04-19 04:28:24.191973 |
description | A tool for formatting code with structured comments |
homepage | |
repository | https://github.com/sloganking/Structured-commenting-formatter |
max_upload_size | |
id | 567334 |
size | 99,995 |
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.
scfmt
will format strings with bracketed structured comments, so that their contents inside them are correctly indented.
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 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 puts a _
character in front of any existing bracketed comments. This allows for more easily converting existing projects to being compatible with structured commenting.
The only things scfmt
is allowed to do are:
//<
closing comments>
, <>
to the begining of existing comments.What will scfmt not do?
max_width
scfmt
will mistake lines in multi-line strings or multi-line comments, as strucutred comments if those lines start with your language's comment starter. This means multi-line strings and comments such as the one below would get formatted, even though they should not be./*
//>
comment line that will get indented after formatting
//<
*/
let multi_line_str = "
//>
string line that will get indented after formatting
//<
"