5 ms·
The worst is when you have lines in a similar pattern across your formatter's line length boundary and you end up with setup_spi(&adc, mode=SPI_01, rate=15,
by sn0wleppard 1y ago
The worst is when you have lines in a similar pattern across your formatter's line length boundary and you end up with
setup_spi(&adc, mode=SPI_01, rate=15, cs_control=CS_MUXED, cs=0x01);
setup_spi(&eeprom,
mode=SPI_10,
rate=13,
cs_control=CS_MUXED,
cs=0x02);
setup_spi(&mram, mode=SPI_10, rate=50, cs_control=CS_DIRECT, cs=0x08);
- crazygringo 1y agoI think with the Black formatter you can force the multiline version by adding a trailing comma to the arguments. The pain point you describe is real, which is why that was intentionally added as a feature. Of course it requires a language that allows trailing commas, and a formatter that uses that convention.
- dvdkon 1y agoA similar tip: As far as I can tell, clang-format doesn't reflow across comments, so to force a linebreak you can add a // end-of-line comment.