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

Add go-to-symbol and open-symbol-by-name features #8

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

lydell
Copy link
Contributor

@lydell lydell commented Jul 21, 2023

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.


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)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO: Create this gif

Copy link
Contributor Author

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?)

@lydell lydell marked this pull request as ready for review July 22, 2023 10:01
src/features/go-to-symbol.ts Outdated Show resolved Hide resolved
@lydell lydell changed the title Add go-to-symbol feature Add go-to-symbol and open-symbol-by-name features Jul 22, 2023

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)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

And this one

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.

None yet

1 participant