From 0f4b2d5cd097a80e0d9ebe549a574411efe6af49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20Paku=C5=82a?= Date: Sun, 15 Oct 2023 22:39:00 +0200 Subject: [PATCH] Fix attribute quick assist --- .../php/internal/ui/text/correction/ASTResolving.java | 7 +++++++ .../ui/text/correction/SimilarElementsRequestor.java | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/text/correction/ASTResolving.java b/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/text/correction/ASTResolving.java index a71380f9fe..1f493abf05 100644 --- a/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/text/correction/ASTResolving.java +++ b/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/text/correction/ASTResolving.java @@ -216,12 +216,16 @@ private static int internalGetPossibleElementKinds(ASTNode node) { } ASTNode parent = node.getParent(); + if (parent.getType() == ASTNode.NAMESPACE_NAME) { + parent = parent.getParent(); + } switch (parent.getType()) { case ASTNode.CLASS_DECLARATION: case ASTNode.INTERFACE_DECLARATION: kind = SimilarElementsRequestor.CLASSES | SimilarElementsRequestor.INTERFACES; break; + case ASTNode.METHOD_DECLARATION: kind = SimilarElementsRequestor.ALL_TYPES; break; @@ -243,6 +247,9 @@ private static int internalGetPossibleElementKinds(ASTNode node) { case ASTNode.FUNCTION_NAME: kind = SimilarElementsRequestor.FUNCTIONS; break; + case ASTNode.ATTRIBUTE: + kind = SimilarElementsRequestor.CLASSES | SimilarElementsRequestor.INTERFACES; + break; default: } return kind; diff --git a/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/text/correction/SimilarElementsRequestor.java b/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/text/correction/SimilarElementsRequestor.java index c4e2ba6d60..5e570e16ec 100644 --- a/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/text/correction/SimilarElementsRequestor.java +++ b/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/text/correction/SimilarElementsRequestor.java @@ -55,7 +55,7 @@ public static SimilarElement[] findSimilarElement(ISourceModule cu, Identifier n requestor.setIgnored(CompletionProposal.LABEL_REF, true); requestor.setIgnored(CompletionProposal.PACKAGE_REF, true); requestor.setIgnored(CompletionProposal.VARIABLE_DECLARATION, true); - requestor.setIgnored(CompletionProposal.METHOD_REF, true); + // requestor.setIgnored(CompletionProposal.METHOD_REF, true); requestor.setIgnored(CompletionProposal.FIELD_REF, true); requestor.setIgnored(CompletionProposal.LOCAL_VARIABLE_REF, true); requestor.setIgnored(CompletionProposal.VARIABLE_DECLARATION, true);