[clangd] Revamp textDocument/onTypeFormatting.
Summary: The existing implementation (which triggers on }) is fairly simple and has flaws: - doesn't trigger frequently/regularly enough (particularly in editors that type the } for you) - often reformats too much code around the edit - has jarring cases that I don't have clear ideas for fixing This implementation is designed to trigger on newline, which feels to me more intuitive than } or ;. It does have allow for reformatting after other characters - it has a basic behavior and a model for adding specialized behavior for particular characters. But at least initially I'd stick to advertising \n in the capabilities. This also handles comment splitting: when you insert a line break inside a line comment, it will make the new line into an aligned line comment. Working on tests, but want people to patch it in and try it - it's hard to see if "feel" is right purely by looking at a test. Reviewers: ilya-biryukov, hokein Subscribers: mgorny, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60605 llvm-svn: 362939
Loading
Please register or sign in to comment