Index: pkg/analysis_server/lib/src/edit/edit_domain.dart |
diff --git a/pkg/analysis_server/lib/src/edit/edit_domain.dart b/pkg/analysis_server/lib/src/edit/edit_domain.dart |
index f6e91a14ca1eaa44358d0c36c7a3445d5fdfb290..693200e80fc941e09b0867ecc2c54b6b32e1dd84 100644 |
--- a/pkg/analysis_server/lib/src/edit/edit_domain.dart |
+++ b/pkg/analysis_server/lib/src/edit/edit_domain.dart |
@@ -372,6 +372,15 @@ class _RefactoringManager { |
if (nodes.isNotEmpty && elements.isNotEmpty) { |
AstNode node = nodes[0]; |
Element element = elements[0]; |
+ // climb from "Class" in "new Class()" to "new Class()" |
+ if (node.parent is TypeName && |
+ node.parent.parent is ConstructorName && |
+ node.parent.parent.parent is InstanceCreationExpression) { |
+ InstanceCreationExpression creation = node.parent.parent.parent; |
+ node = creation; |
+ element = creation.staticElement; |
+ } |
+ // do create the refactoring |
refactoring = new RenameRefactoring(searchEngine, element); |
feedback = |
new RenameFeedback(node.offset, node.length, 'kind', 'oldName'); |