diff --git a/src/main/scala/com/neowit/apex/completion/AutoComplete.scala b/src/main/scala/com/neowit/apex/completion/AutoComplete.scala index 3cd897d5..a2edbc9b 100644 --- a/src/main/scala/com/neowit/apex/completion/AutoComplete.scala +++ b/src/main/scala/com/neowit/apex/completion/AutoComplete.scala @@ -290,6 +290,8 @@ class AutoComplete(file: File, line: Int, column: Int, cachedTree: ApexTree, ses val members1 = definitionMember match { case Some(m:EnumMember) => members //do not filter anything for Enum case Some(m:EnumConstantMember) => members //do not filter anything for Enum + case Some(m:FieldMember) => members.filter(instanceOnlyFilter) + case Some(m:PropertyMember) => members.filter(instanceOnlyFilter) case _ => definitionMember match { case Some(_defMember) if !_defMember.isStatic => //remove all static members members.filter(instanceOnlyFilter) diff --git a/src/test/resources/completions/src/classes/ApexClassCompletions.cls b/src/test/resources/completions/src/classes/ApexClassCompletions.cls index ddb16530..477d65e5 100644 --- a/src/test/resources/completions/src/classes/ApexClassCompletions.cls +++ b/src/test/resources/completions/src/classes/ApexClassCompletions.cls @@ -8,8 +8,12 @@ */ public with sharing class ApexClassCompletions { + //static field private static Integer STATIC_INT = 0; public enum Season {WINTER, SPRING, SUMMER, FALL} + + //static property + public static Integer propStatic { public get; set; } public String propShort { public get; set; } @@ -21,7 +25,36 @@ public with sharing class ApexClassCompletions { void test1() {} //void test24() {} + + /** + * #START + { + "lineMarker": "testStaticField", + "column": 14, + "itemsCountMin": 1, + "signatureContains": ["format"], + "signatureMustNotContain" : ["valueOf"] + } + * #END + */ + public void testStaticField () { + STATIC_INT.; //testStaticField + } + /** + * #START + { + "lineMarker": "testStaticProperty", + "column": 14, + "itemsCountMin": 1, + "signatureContains": ["format"], + "signatureMustNotContain" : ["valueOf"] + } + * #END + */ + public void testStaticProperty () { + propStatic.; //testStaticProperty + } /** * #START {