GH-1409: do not compute completion proposals when cursor is on attribute name instead of value

This commit is contained in:
Martin Lippert
2024-11-15 19:14:35 +01:00
parent d43f16a757
commit 0b90be19a4
2 changed files with 6 additions and 0 deletions

View File

@@ -77,6 +77,7 @@ public class AnnotationAttributeCompletionProcessor implements CompletionProvide
}
// case: @Qualifier(value=<*>)
else if (node instanceof Name && node.getParent() instanceof MemberValuePair
&& ((MemberValuePair)node.getParent()).getName() != node
&& completionProviders.containsKey(((MemberValuePair)node.getParent()).getName().toString())) {
String attributeName = ((MemberValuePair)node.getParent()).getName().toString();
computeProposalsForSimpleName(project, node, attributeName, completions, offset, doc);

View File

@@ -169,6 +169,11 @@ public class DependsOnCompletionProviderTest {
assertCompletions("@DependsOn<*>(\"XXX\")", 0, null);
}
@Test
public void testDependsOnCompletionInsideOfAttributeName() throws Exception {
assertCompletions("@DependsOn(<*>value=\"bean1\")", 0, null);
}
@Test
public void testDependsOnCompletionInsideOfQuotesWithPrefixAndReplacedPostfix() throws Exception {
assertCompletions("@DependsOn(\"be<*>xxx\")", 2, "@DependsOn(\"bean1<*>\")");