openscad-LSP icon indicating copy to clipboard operation
openscad-LSP copied to clipboard

Formatting should not sort includes

Open sameer opened this issue 1 year ago • 1 comments

Hi Leathong, thanks for creating this LSP and the VSCode extension. Just started using it today and it has been very helpful!

I ran the built-in formatter and noticed that it sorts includes. This can break programs because the order matters.

i.e. I use NopSCADlib which has a file utils/fans.scad that implicitly depends on utils/screws.scad. Putting screws.scad after fans.scad in the include order breaks the build.

  • Formatting commit: https://github.com/sameer/models/commit/adc5244a946a031d7a012ff109fc7aa18bd81585
  • Undo sorting commit: https://github.com/sameer/models/commit/c486dca2959d0adb29466786d2dc08ec4f3756b6

sameer avatar Dec 15 '23 18:12 sameer

You can customized a .clang-format file for this. Formatting function simply calls clang-format.

Leathong avatar Jan 02 '24 04:01 Leathong