-
Notifications
You must be signed in to change notification settings - Fork 223
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
Add SortDocumentSymbols
to make the outline hierarchical (again)
#2084
Conversation
This is probably what OmniSharp was doing for us.
7519e9d
to
27b5325
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feedback from code review meeting.
src/PowerShellEditorServices/Services/TextDocument/Handlers/DocumentSymbolHandler.cs
Outdated
Show resolved
Hide resolved
src/PowerShellEditorServices/Services/TextDocument/Handlers/DocumentSymbolHandler.cs
Outdated
Show resolved
Hide resolved
src/PowerShellEditorServices/Services/TextDocument/Handlers/DocumentSymbolHandler.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Love it ❤️
This finishes the optimizations by relying on the fact that we're passing a reference to the list which means we can modify it in-place. We sort the whole list of symbols on the first pass only, and then as sort children into parents' buckets we *move* them by adding them to `parent.Children` and removing them from the current list, and then recurse and modify those lists until we're done. I don't normally like relying on side-effects such as modifying in the called function, but it makes the most sense in this case for optimizations and is duly noted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even better ❤️
This is probably what OmniSharp was doing for us. Fixes the bug introduced by #2083.
Hey, at least I didn't use LINQ. Thanks Bing Chat for the algorithm help. This should probably wait for the pre-release after the next stable release.