[all-commits] [llvm/llvm-project] 7a514c: [clangd] Implement textDocument/foldingRange

Kirill Bobyrev via All-commits all-commits at lists.llvm.org
Tue Jul 14 00:29:11 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 7a514c9bf8f2513b57aee685879dd2c104381d99
      https://github.com/llvm/llvm-project/commit/7a514c9bf8f2513b57aee685879dd2c104381d99
  Author: Kirill Bobyrev <kbobyrev at google.com>
  Date:   2020-07-14 (Tue, 14 Jul 2020)

  Changed paths:
    M clang-tools-extra/clangd/ClangdLSPServer.cpp
    M clang-tools-extra/clangd/ClangdLSPServer.h
    M clang-tools-extra/clangd/ClangdServer.cpp
    M clang-tools-extra/clangd/ClangdServer.h
    M clang-tools-extra/clangd/Protocol.cpp
    M clang-tools-extra/clangd/Protocol.h
    M clang-tools-extra/clangd/SemanticSelection.cpp
    M clang-tools-extra/clangd/SemanticSelection.h
    M clang-tools-extra/clangd/tool/ClangdMain.cpp
    M clang-tools-extra/clangd/unittests/SemanticSelectionTests.cpp

  Log Message:
  -----------
  [clangd] Implement textDocument/foldingRange

Summary:
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

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: nridge, ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D82436




More information about the All-commits mailing list