diff --git a/crates/nu-parser/src/flatten.rs b/crates/nu-parser/src/flatten.rs index 8411025272..6a12f8484a 100644 --- a/crates/nu-parser/src/flatten.rs +++ b/crates/nu-parser/src/flatten.rs @@ -329,6 +329,9 @@ fn flatten_expression_into( if let Expr::String(..) | Expr::GlobPattern(..) = &head.expr { output.push(( head.span, + // If this external call is through an alias, then head.span points to the + // name of the alias, but we also need the name of the aliased command. We + // recover this from the span referenced by head.span_id. FlatShape::External(working_set.get_span(head.span_id)), )); } else {