This patch introduces basic textDocument/foldingRange support. It relies on
textDocument/documentSymbols to collect all symbols and uses takes ranges
to create folds.
The next steps for textDocument/foldingRange support would be:
- Implementing FoldingRangeClientCapabilities and respecting respect client preferences
- Specifying folding range kind
- Migrating from DocumentSymbol implementation to custom RecursiveASTVisitor flow that will allow more flexibility
- Supporting more folding range types: comments, PP conditional regions, includes and other code regions (e.g. public/private/protected sections of classes, control flow statement bodies)
Tested: (Neo)Vim (coc-clangd) and VSCode.
Related issue: https://github.com/clangd/clangd/issues/310