Skip to content
New issue

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

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

Already on GitHub? # to your account

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

Merged
merged 22 commits into from
Dec 15, 2024

Conversation

lydell
Copy link
Contributor

@lydell lydell commented Jul 21, 2023

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.


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

@lydell lydell Jul 21, 2023

Choose a reason for hiding this comment

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

TODO for Ryan: Create this gif

Copy link
Contributor Author

@lydell lydell Jul 23, 2023

Choose a reason for hiding this comment

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

TODO for Ryan: 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
@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

@lydell lydell Jul 22, 2023

Choose a reason for hiding this comment

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

TODO for Ryan: And this one

@ericwern
Copy link

ericwern commented Dec 9, 2024

any update on this?

@lydell
Copy link
Contributor Author

lydell commented Dec 9, 2024

I’ve been running a build based on this PR + #21 on my computer for a while now, and it’s working well!

@ryan-haskell Do you have time to merge? (And do the two readme tasks.)

@ryan-haskell ryan-haskell merged commit c0c61fa into elm-land:main Dec 15, 2024
@lydell lydell deleted the outline branch December 15, 2024 16:30
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants