-
Notifications
You must be signed in to change notification settings - Fork 43
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
feat(symbols): definition paths #320
Conversation
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.
I want this feature because in libpack I need to know where the path goes from a local module to a remote module and I need to know how it's imported from the remote module.
)), | ||
range: export_decl.range(), | ||
}, | ||
); |
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.
These removals resolve the todo here: https://github.com/denoland/deno_graph/pull/320/files#diff-a05c59be6d87eb681f2159cb5c6aea202a9d11d2cc5ee9e20ebfb7bc803646f9L482-L484
/// Finds the path to a definition. | ||
/// | ||
/// Note: For performance reasons, this excludes paths that overlap. | ||
pub fn find_definition_paths<'a>( |
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.
Ideally this would be lazily traversed, but this is fine for a first pass.
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.
Could you update the comment to shot what "overlapping paths" are? (can be done in a follow up)
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.
Also, can this operation be cached somehow so it's only computed once per symbol in the whole program?
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.
Sure, I'll update in the next PR.
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.
Actually, I don't think this would ever happen in practice. I was thinking too abstractly. I'll remove this comment.
This allows seeing the path from a symbol to a definition.