genemichaels icon indicating copy to clipboard operation
genemichaels copied to clipboard

Call for public codebases

Open andrewbaxter opened this issue 10 months ago • 6 comments

Just in case anyone is using genemichaels, if you have public projects with formatted code please let me know - I can test new releases on them to hopefully avoid unnecessary breakage.

andrewbaxter avatar Feb 01 '25 18:02 andrewbaxter

I just recently formatted all of https://gitlab.com/elfeiin/riscv_vm using prior release. It's also where the macro issue arose and has a few comments as well (more than I usually do).

ghost avatar Feb 04 '25 02:02 ghost

Oh thanks!

andrewbaxter avatar Feb 04 '25 16:02 andrewbaxter

Check src/instruction.rs for macro usages that get formatted weirdly, specifically the bits! macro. genemichaels defaulting to spaces after colons is fine in the majority of cases but sometimes it can look odd depending on the context. In this case, it's two numbers with a colon between, so maybe that can be special-cased. However, you mentioned in another issue about using genemichaels-lib which I will look into for making custom formatters per-project (sounds fun, right??).

ghost avatar Mar 30 '25 14:03 ghost

Sounds fun to me! :D

Special case macros like that are tricky... I think special casing would be difficult because that example could just as easily be (for instance) key-value pairs in a map (or like the tracing/log span structured data kv pairs syntax), and the formatter doesn't have enough context to figure it out. I think .. as a range separator might be less ambiguous, although I'm not sure how that'd be treated in macros currently.

andrewbaxter avatar Apr 01 '25 06:04 andrewbaxter

Sounds fun to me! :D

Special case macros like that are tricky... I think special casing would be difficult because that example could just as easily be (for instance) key-value pairs in a map (or like the tracing/log span structured data kv pairs syntax), and the formatter doesn't have enough context to figure it out. I think .. as a range separator might be less ambiguous, although I'm not sure how that'd be treated in macros currently.

I would use .. but genemichaels puts spaces around it too

ghost avatar Apr 01 '25 17:04 ghost

Ah... 😅

andrewbaxter avatar Apr 02 '25 18:04 andrewbaxter