[all-commits] [llvm/llvm-project] ba06ac: [clangd] Support `#pragma mark` in the outline

David Goldman via All-commits all-commits at lists.llvm.org
Mon Aug 9 14:07:09 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ba06ac8b45ca2ad047131fb9cc9af922cb913ea1
      https://github.com/llvm/llvm-project/commit/ba06ac8b45ca2ad047131fb9cc9af922cb913ea1
  Author: David Goldman <davg at google.com>
  Date:   2021-08-09 (Mon, 09 Aug 2021)

  Changed paths:
    M clang-tools-extra/clangd/CollectMacros.cpp
    M clang-tools-extra/clangd/CollectMacros.h
    M clang-tools-extra/clangd/FindSymbols.cpp
    M clang-tools-extra/clangd/ParsedAST.cpp
    M clang-tools-extra/clangd/ParsedAST.h
    M clang-tools-extra/clangd/Preamble.cpp
    M clang-tools-extra/clangd/Preamble.h
    M clang-tools-extra/clangd/SourceCode.cpp
    M clang-tools-extra/clangd/SourceCode.h
    M clang-tools-extra/clangd/unittests/FindSymbolsTests.cpp
    M clang-tools-extra/clangd/unittests/ParsedASTTests.cpp
    M clang/include/clang/Lex/PPCallbacks.h

  Log Message:
  -----------
  [clangd] Support `#pragma mark` in the outline

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, implicitly terminating when the symbol's
parent ends.

The following code:

```
@implementation MyClass

- (id)init {}

- (int)foo;
@end
```

Would give an outline like

```
MyClass
        > Overrides
                    > init
        > Public Accessors
                    > foo
```

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




More information about the All-commits mailing list