Skip to content

Commit

Permalink
completion on class fields and properties must show only instance mem…
Browse files Browse the repository at this point in the history
…bers, regardless of how property is defined

e.g.
class MyClass {
static Integer A_FIELD = 10;
A_FIELD.<caret> must list instance members of Integer
}
  • Loading branch information
neowit committed Oct 15, 2014
1 parent 8636143 commit d8a3763
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/scala/com/neowit/apex/completion/AutoComplete.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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; }

Expand All @@ -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
{
Expand Down

0 comments on commit d8a3763

Please sign in to comment.