For some time I tried to write a formatting tool for my programming language. After achieving first results I gave up. I have found that writing a formatter is surprisingly hard task. Operating on token-level can't provide good enough result, so a proper parser is necessary. Reusing existing parser isn't possible, since it ignores whitespaces and comments. Even more problems creates the necessity to preserve user-defined formatting in ambiguous cases.
So I thought, that there is no reason trying to solve all these problems, since it requires too much time investments. But without solving all this a semi-working formatter isn't good enough to be useful and not annoying.