[PATCH] D105904: [clangd] Support `#pragma mark` in the outline

David Goldman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 13 09:27:42 PDT 2021


dgoldman created this revision.
Herald added subscribers: usaxena95, kadircet, arphaman, kbarton, mgorny, nemanjai.
dgoldman requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added projects: clang, clang-tools-extra.

Xcode uses `#pragma mark -` to draw a divider in the outline view
and `#pragma mark Note` to add `Note` in the outline view. For more
information, see https://nshipster.com/pragma/.

Since the LSP spec doesn't contain dividers for the symbol outline,
instead we treat `#pragma mark -` as a group with children - the
decls that come after it.

Work left to do:

- Support some edge cases where the document symbols may not be nested / sorted properly.

- Consider supporting `#pragma mark`s before any decls

- Consider supporting the following:

  #pragma mark -
  #pragma mark Bar

by treating it like `#pragma mark - Bar` instead of an unnamed
group followed by a named mark.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D105904

Files:
  clang-tools-extra/clangd/CMakeLists.txt
  clang-tools-extra/clangd/FindSymbols.cpp
  clang-tools-extra/clangd/ParsedAST.cpp
  clang-tools-extra/clangd/ParsedAST.h
  clang-tools-extra/clangd/Protocol.h
  clang-tools-extra/clangd/TextMarks.cpp
  clang-tools-extra/clangd/TextMarks.h
  clang-tools-extra/clangd/unittests/FindSymbolsTests.cpp
  clang/include/clang/Lex/PPCallbacks.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105904.358306.patch
Type: text/x-patch
Size: 19375 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210713/ce919677/attachment-0001.bin>


More information about the cfe-commits mailing list