-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Improve document symbol hierarchy to match rust-analyzer layout #6678
Conversation
Just curious why both |
I just put that there as a placeholder for now, still need to sort that and quite a bit more out. Probably at least a few more days of work left to get this PR ready. I'd expect this part to change before i'm ready to open up the PR for review. |
cool |
434a551
to
46c8763
Compare
…ctions and handlers.
…entSymbolBuilder.
…ls in document_symbols.
… helper functions.
…ntegration tests.
996ab11
to
ae95905
Compare
CodSpeed Performance ReportMerging #6678 will degrade performances by 71.22%Comparing Summary
Benchmarks breakdown
|
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.
Apart from my questions and comments, looks good!
Thanks for the review. Should be good now. |
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.
This looks great!
I manually tested it on a bunch of different sway files and the only issue I found is that the outline doesn't show the types for enum variants the way it does for struct fields. For example, in sway-lsp/tests/fixtures/benchmark/src/main.sw
I'd expect to see u8
next to Enum11's Variant1, and so on.
Good catch, adding type information in for enum fields is a great idea! I'll add that now. Thanks :) |
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.
Description
Changes document symbols to provide a richer code outline view with nested hierarchies and type information, similar to rust-analyzer's implementation. This improves code navigation by showing relationships between elements (e.g., structs with their fields, functions with their variables) and includes type annotations for better understanding.
Key improvements:
Note: the performance impact is due to the
get_range_from_span
function which can't avoid calling. 19ms is still reasonable.closes #6100
Checklist
Breaking*
orNew Feature
labels where relevant.