-
Notifications
You must be signed in to change notification settings - Fork 2
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 go-to-symbol and open-symbol-by-name features #8
base: main
Are you sure you want to change the base?
Conversation
|
||
You can navigate symbols inside a file. This is helpful for quickly navigating among functions, values and types in a file. | ||
|
||
![Go to symbol](./go-to-symbol.gif) |
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.
TODO: Create this gif
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.
TODO: Update the performance tables further below
(should probably be done on the same computer as the other features?)
|
||
You can navigate to any top-level declaration in any file, which is a quick way of getting to the right file. | ||
|
||
![Open symbol by name](./open-symbol-by-name.gif) |
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.
And this one
Conflicts: src/features/jump-to-definition.ts
Status: This seems to work well for me. I just need Ryan’s help with the docs stuff (we talked about it IRL a while ago).
This implements Go to Symbol and the Outline view (they go together), as well as Open symbol by name (which is a bit hacky, but I think it provides a lot of value even if it’s not 100 % pedantically correct). That’s what VSCode calls those features (see the links), but personally I think it’s not super clear what is what. Open to name changes if you want!
At first, on a large file it was too slow (when typing, the UI locked up and the characters appeared too late). It turned out 99.9 % of the time was spent parsing. I solved this by parsing in a Worker Thread. So now it never blocks the main thread. For small files, the outline feels instant (like 15 ms), and for big files I notice a ~0.5 second delay for it sometimes.
Note that the worker stuff is a bit tricky, so some extra testing might be good – this affects all features that parses using elm-syntax.