Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix document symbol with a range based method (outline and breadcumbs) #674

Merged
merged 4 commits into from
May 9, 2021

Conversation

FederAndInk
Copy link
Contributor

This is an alternative to #660, I have redone all the algorithm for hierarchical document symbol, it is based on ranges of symbols and not on symbols and their children because some of them were missing and "duplicates" were removed (eg: namespace redefinition in the same file, or inline function defined after the class)

When we have members defined outside the class in a namespace in a separate file, the namespace doesn't have the members as children. The outline and breadcrumbs don't work correctly for them.
Before:
Screenshot_20200702_214411
After:
Screenshot_20200702_213950

There are other bugs with outline that I noticed which I am working on:

  • static member variable aren't in their class/struct
  • defined member functions after the class definition in the same file override the member function declaration
  • inline namespace

std::unordered_map<SymbolIdx, std::unique_ptr<DocumentSymbol>> sym2ds;
std::vector<std::pair<std::vector<const void *>, DocumentSymbol *>> funcs,
types;
std::vector<ExtentRef> syms;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may want this to be a vector of pointer to take less memory 32B to 8B per element and then sort the pointers.

src/messages/textDocument_document.cc Show resolved Hide resolved
@FederAndInk FederAndInk changed the title Fix/document symbol range based Fix document symbol with a range based method (outline and breadcumbs) Jul 20, 2020
@FederAndInk
Copy link
Contributor Author

Is there someone who can review this?

@FederAndInk FederAndInk force-pushed the fix/document_symbol_range_based branch from ca7252c to 407f78e Compare April 1, 2021 14:23
eg:
int i, j, k;

outline before:
k
 j
  i
after:
i
j
k
@joelhock
Copy link

joelhock commented May 7, 2021

i can say this fixed the issue for me, so I'm in favor!

MaskRay pushed a commit that referenced this pull request May 9, 2021
MaskRay pushed a commit that referenced this pull request May 9, 2021
MaskRay pushed a commit that referenced this pull request May 9, 2021
MaskRay pushed a commit that referenced this pull request May 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants