Community
Participate
Working Groups
Created attachment 285803 [details] My custom format file. Hello, the internal formatter can't handle some constructs related to references. The following code: #include <unordered_map> std::unordered_map<int, long> mymap; long inc(int i) { mymap.at(i)++; return mymap.at(i); } gets formatted to #include <unordered_map> std::unordered_map<int, long> mymap; long inc(int i) { mymap.at(i)++;return mymap .at(i); } I have this with many references and i don't know whats happening. But this bug sometimes affects only the following statement and sometimes some more of the following lines. Also, the on-/off-tags don't work properly: #include <unordered_map> std::unordered_map<int, long> mymap; namespace bug::lol { void something(); } long inc(int i) { mymap.at(i)++; // @formatter:off return mymap.at(i); // @formatter:on } void bug::lol::something() { } *sometimes* gets to #include <unordered_map> std::unordered_map<int, long> mymap; namespace bug::lol { void something(); } long inc(int i) { mymap.at(i)++; // @formatter:off return mymap.at(i); // @formatter:on }void bug::lol::something() { } Notice the intendation of the @formatter:on tag and the missing new line before the void bug::lol::something() (even before the formatter run). I can't reproduce the second example every single time. Sometimes the formatter removes new lines, sometimes it adds spaces. But every time it goes wild and trahes my code. I've attached my custom format file. Regards :)
I think the problem is much worse than i expected. For example i get the following formatting results: ... virtual void drawImage(const Drawing::Image &image, const Drawing::Rectangle &destination, double rotation = 0.0, const Drawing::FlipMode &flip = Drawing::FlipMode::NONE) const override; virtual void void drawImage(const Drawing::Image &image, const Drawing::Rectangle &clip, decltype(Drawing::Point::x) x, decltype(Drawing::Point::y) y, double rotation = 0.0, const Drawing::FlipMode &flip = Drawing::FlipMode::NONE) const override; ... It also seems that the formatter really don't like decltypes.