0.7.0 brings several formatting changes to the table meaning that projects using the earlier version wills see their code reformatted slightly - hopefully for the better.
If you are checking formatting in CI, make sure to lock it down to the version you're using locally and upgrade the two together!
Formatting updates:
- Indent chained/dotted calls that start on a new line to make expression
boundaries clear. Example:
# old aaaa .f() .g() # new aaaa .f() .g()
- Keep lightweight prefix calls (e.g.,
@,%,?,not) on the same line as the assignment/opening when possible so lists and prefixed constructs don’t force an extra indent.# before let f2 = ?call( ... ) # after let f2 = ?call( ... )
- Put triple-string literals on same line if it fits
- Make
[]operator simple - Preserve block comments followed by single-line comments
New features:
--diffflag to show unified diff of formatting changes without modifying files--color/--no-colorflags for colored diff output (requires--diff).nph.tomlconfig file support for project-level configuration--excludeflag to replace default exclusion patterns--extend-excludeflag to add patterns to default exclusions--includeflag to customize which files to format--configflag to specify a custom config file- Default exclusion patterns for common directories (build, dist, .git, nimcache, etc.)
- Files passed explicitly on CLI bypass all exclude filters (matching Black's behavior)
- CLI options override config file settings
- pre-commit integration support with
nphhook
No formatting changes!
- nimble compatibility updates (fixes
nimble install nphsometimes) - osx arm64 binaries
- avoid putting
,on its own line after complex expressions, where possible - allow compiling with a wider range of Nim 2.0 versions, hoping it won't break
- a few bugfixes
- fix a bug in the length computation of postfix-commented items
- fix a bug in statement list expression rendering in calls
- fix a bug in whitespace retention between calls
- allow function calls to partially fill line in assignments
- trailing commas also in simple multi-line lists
- polish
- fix comment-eating bug in infix
..and..<gained spaces around them like all other infixes- chains of dot-calls get aligned
- prefer putting things on a new line if this helps fit the whole expression
- add
.to simple expressions - fix several cases of over-indent
- render infix expressions with operator ending the line where possible
- Back to
,as parameter separator - this helps compatibility with inline procs - 100% Nim compiler/stdlib compatibility
- New manual at https://arnetheduck.github.io/nph/
- Assorted bugfixes
- Initial versioned release
- Comes with VSCode integration and 99% compatibibility