Implement and apply openscad-format#50
Conversation
|
Looks like a bug due to the dashes, I'll fix that, bump the NPM version, and update the results here. I'll also add some options for custom formatting... it uses some hacks with Clang to format it. On order and position: the only edge case I can think if that would be beneficial is when you have an include/use inside of a module, e.g. for testing... is that right? The other issue I'm seeing is keeping them after header comments (at the top of files), but that's a relatively easy fix. I just made the formatter the other day and thought I'd poke you folks for interest since it's a bigger repo. EDIT: Also, from the README... But I don't really know who manages the repo anymore. |
|
MCAD repo is 'managed' by the same main OpenSCAD community, it gets little love, as changing it opens up a can of worms. |
|
Since you bring the difficulty with changing MCAD, I'll bring up a repo I've been building this formatter (and also a language server based on pygls) for. My hope is to keep the convention very strict, the code base very stable, and offer a wide array of well documented modules/functions including HTML docs. I'm working on creating the other tools first, but some sample code is in the util folder. But back on topic, what you've explained makes sense. The main issue with hacking Clang is the include/use syntax must be converted before it's parsed, however I think I have an idea. Fixes coming soon. 👍 |
|
That should fix the includes, and the indentation is now to your preference. Whatever you folks decide on, it can be changed via the |
This automates the task of code formatting for the whole repo. Simply execute
./format.py