remove keywords from completion after .& in Groovy
authorMaxim Medvedev <maxim.medvedev@jetbrains.com>
Mon, 7 Dec 2009 13:03:35 +0000 (16:03 +0300)
committerMaxim Medvedev <maxim.medvedev@jetbrains.com>
Mon, 7 Dec 2009 13:03:35 +0000 (16:03 +0300)
plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GroovyCompletionData.java
plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/filters/types/BuiltInTypeFilter.java

index a313f82b2c4e1cc93f71425914a571ca7aae0aff..1ca95d8552d062c0b8584af4ce3d4ca3e83a7672 100644 (file)
@@ -124,13 +124,7 @@ public class GroovyCompletionData extends CompletionData {
 
   private void registerBuiltInTypesAsArgumentCompletion() {
     AndFilter filter = new AndFilter(new BuiltInTypeAsArgumentFilter(), new NotFilter(new ThrowsFilter()));
-    LeftNeighbour afterDotFilter = new LeftNeighbour(new TextFilter("."));
-    CompletionVariant variant = new CompletionVariant(new AndFilter(new NotFilter(afterDotFilter), filter));
-    variant.includeScopeClass(LeafPsiElement.class);
-    for (String completion : BUILT_IN_TYPES) {
-      variant.addCompletion(completion, TailType.SPACE);
-    }
-    registerVariant(variant);
+    registerStandardCompletion(filter, BUILT_IN_TYPES);
   }
 
   private void registerSimpleExprsCompletion() {
@@ -193,7 +187,7 @@ public class GroovyCompletionData extends CompletionData {
    * @param keywords - Keywords to be completed
    */
   private void registerStandardCompletion(ElementFilter filter, String... keywords) {
-    LeftNeighbour afterDotFilter = new LeftNeighbour(new TextFilter("."));
+    LeftNeighbour afterDotFilter = new LeftNeighbour(new TextFilter(".", ".&"));
     CompletionVariant variant = new CompletionVariant(new AndFilter(new NotFilter(afterDotFilter), filter));
     variant.setItemProperty(LookupItem.HIGHLIGHTED_ATTR, "");
     variant.includeScopeClass(LeafPsiElement.class);
index 683c1d83b7bce5ee2636d94757a6e1c28876bdd2..d867f977afc170bc2ef1b9f3cd408bc5f779fa1c 100644 (file)
@@ -58,8 +58,7 @@ public class BuiltInTypeFilter implements ElementFilter {
         ASTNode node = prevSibling.getNode();
         return !GroovyTokenTypes.DOTS.contains(node.getElementType());
       } else {
-        return !(previous != null &&
-            GroovyTokenTypes.mAT.equals(previous.getNode().getElementType()));
+        return true;
       }
     }
     if (PsiImplUtil.realPrevious(context.getParent().getPrevSibling()) instanceof GrModifierList) {