The International Simutrans Forum

Development => Technical Documentation => Topic started by: Matthew on February 23, 2020, 07:17:44 PM

Title: Does anyone have a .clang-format file for Simutrans code?
Post by: Matthew on February 23, 2020, 07:17:44 PM
I am working through a C++ tutorial in the hope that one day in the (far!) future I might be able to contribute to Simutrans.

Visual Studio Code uses .clang-format files (https://code.visualstudio.com/docs/cpp/cpp-ide) to automate code formatting. Is anyone already using such a file that fits Simutrans' coding style (https://github.com/jamespetts/simutrans-extended/blob/master/documentation/coding_styles.txt), please? It might help me get into good habits from the start. So far the closest I can find are the Google and Webkit styles, but both have spaces between function names and their parameters.
Title: Re: Does anyone have a .clang-format file for Simutrans code?
Post by: prissi on February 24, 2020, 11:26:42 AM
We discussed beatifying the code many times, but any automatic tends to fail a lot. But, more important, no patches would survive this (or is git clever enough to ignore all whitespace changes?)

During that discussion, I tried a lot of beatifier, but none could really do all the Simutrans formatting. I would be very much interested in a useful formatter. Unfortunately, at least my MSVC rather destroys my formatting, unless I switch it off.