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

fix: jump to definition on dotted definition #92

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions starlark/src/lsp/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -687,15 +687,17 @@ impl<T: LspContext> Backend<T> {
// so it's simpler to do the lookup here, rather than threading a ton of
// information through.
Definition::Dotted(DottedDefinition {
root_definition_location: IdentifierDefinition::Location { .. },
root_definition_location: IdentifierDefinition::Location { destination, .. },
segments,
..
}) => {
let member_location = ast.find_exported_symbol_and_member(
segments.first().expect("at least one segment").as_str(),
segments.get(1).expect("at least two segments").as_str(),
);
Self::location_link(source, &uri, member_location.unwrap_or_default())?
let member_location = ast
.find_exported_symbol_and_member(
segments.first().expect("at least one segment").as_str(),
segments.get(1).expect("at least two segments").as_str(),
)
.unwrap_or(destination);
Self::location_link(source, &uri, member_location)?
}
Definition::Dotted(definition) => self.resolve_definition_location(
definition.root_definition_location,
Expand Down