Skip to content

Simfmt implementation - #2

Merged
ikripaka merged 27 commits into
devfrom
feat/impl
Aug 10, 2026
Merged

Simfmt implementation#2
ikripaka merged 27 commits into
devfrom
feat/impl

Conversation

@ikripaka

@ikripaka ikripaka commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Current algorithm works in this way:

  • After parsing, we pass input from 2 channels (ordinary tokens and extended ones) into the formatter, and it processes it
  • Whenever we have missing commits (buffer from is not empty) or we have an unexpected comment in some tricky span, we'll throw an error)

Comments:

  • Tests are extensive and cover a lot of logic, according to the recent refactor (we have unit, integration and CI tests). The last one uses public behaviour of the CLI. Whenever errors or mistakes are found, you can create an issue.
  • Span coverage can be extended on demand to handle complex insertions (comments inside a type declaration, enum path and others) (we have comments in simplicity_fmt::doc)

Current limitations:

  • No trailing commas (in some cases they're omitted, or we insert them on our demand)

Need to be fixed:

  • documentation completeness (document each public function for easy-to-use documentation)
  • public sharing of functions and structs (our code shares too much with the public function and struct declarations)

@ikripaka
ikripaka changed the base branch from master to dev July 17, 2026 13:59
ikripaka added 5 commits July 22, 2026 15:04
* add colours
* fix double newlines printing on them
* add trailling newline as a default option
* add hint for missing newline character
* add semicolon span for inserting newline
* add custom edit context for collecting idents in match edits
* add grouped formatting for long let chains
@ikripaka
ikripaka marked this pull request as ready for review July 24, 2026 11:09
@ikripaka
ikripaka force-pushed the feat/impl branch 2 times, most recently from bbb27fd to ed5ef7f Compare August 4, 2026 13:41
…tting mistakes

* align ui tests with recent changes
* add more unit tests for local testing, simplify testing with utils
* make more efficient search of trivia tokens
* make correct alignment of match arms
* remove additional wrapping of oneline match arms
* remove trailling coma for tuple types priting
* now comments are added without line ending with a newline
* edit rewriting of match expression when we're collecting edits
* make more flexible printing of match arms without comments
* add errorneous ui test case, update contracts
* make handling of comments easier
* remove custom edit context and copying of original file when we have comments inside it
* add Design.md
* fix error in CODE_OF_CONDUCT.md
* extend README.md
@ikripaka
ikripaka merged commit fea6ec6 into dev Aug 10, 2026
5 of 8 checks passed
@ikripaka
ikripaka deleted the feat/impl branch August 10, 2026 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant