diff --git a/starlark/src/lsp/server.rs b/starlark/src/lsp/server.rs index ab6ca77d3..d595d1606 100644 --- a/starlark/src/lsp/server.rs +++ b/starlark/src/lsp/server.rs @@ -687,15 +687,17 @@ impl Backend { // 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,