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

feat(symbols): definition paths #320

Merged
merged 20 commits into from
Nov 6, 2023
Merged

Conversation

dsherret
Copy link
Member

@dsherret dsherret commented Nov 4, 2023

This allows seeing the path from a symbol to a definition.

Copy link
Member Author

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(),
},
);
Copy link
Member Author

Choose a reason for hiding this comment

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

/// Finds the path to a definition.
///
/// Note: For performance reasons, this excludes paths that overlap.
pub fn find_definition_paths<'a>(
Copy link
Member Author

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.

Copy link
Member

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)

Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member Author

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.

@dsherret dsherret marked this pull request as ready for review November 6, 2023 16:12
@dsherret dsherret requested a review from bartlomieju November 6, 2023 16:12
@dsherret dsherret merged commit 2c22ee6 into denoland:main Nov 6, 2023
3 checks passed
@dsherret dsherret deleted the definition_paths branch November 6, 2023 16:34
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.

2 participants