From 16365c120b48b7c84847cf97d813190bc9a92025 Mon Sep 17 00:00:00 2001 From: Marcel Greter Date: Mon, 7 Oct 2019 19:58:56 +0200 Subject: [PATCH] Fix compound extend warning --- src/expand.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/expand.cpp b/src/expand.cpp index 1b9bf9158..f5789b423 100644 --- a/src/expand.cpp +++ b/src/expand.cpp @@ -681,10 +681,18 @@ namespace Sass { if (compound->length() != 1) { - std::cerr << - "compound selectors may no longer be extended.\n" - "Consider `@extend ${compound.components.join(', ')}` instead.\n" - "See http://bit.ly/ExtendCompound for details.\n"; + std::stringstream sels; bool addComma = false; + sels << "Compound selectors may no longer be extended.\n"; + sels << "Consider `@extend "; + for (auto sel : compound->elements()) { + if (addComma) sels << ", "; + sels << sel->to_sass(); + addComma = true; + } + sels << "` instead.\n"; + sels << "See http://bit.ly/ExtendCompound for details."; + + warning(sels.str(), compound->pstate()); // Make this an error once deprecation is over for (SimpleSelectorObj simple : compound->elements()) {