================
@@ -490,6 +491,13 @@ bool eligibleForExtraction(const SelectionTree::Node *N) {
         BO->getRHS() == OuterImplicit.ASTNode.get<Expr>())
       return false;
   }
+  if (const auto *Decl = Parent->ASTNode.get<VarDecl>()) {
+    if (!Decl->isInitCapture() &&
----------------
ckandeler wrote:

> For this case in particular, even if you said the refactoring is available 
> for selection of `x = 1 + [[2 + 3]]` through 
> these heuristics, clangd will still end up extracting the full RHS, because 
> that's the AST node we associated with that 
> selection.

I'm not sure I follow. In the example given above, invoking the tweak on the 
selection results in:
```
auto placeholder = 2 + 3;
int x = 1 + placeholder;
```
Which is exactly what I (the user) wanted. Am I misunderstanding something?

https://github.com/llvm/llvm-project/pull/69477
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to