3434import de .halirutan .mathematica .parsing .psi .api .rules .RuleDelayed ;
3535import de .halirutan .mathematica .parsing .psi .impl .SymbolPsiReference ;
3636import de .halirutan .mathematica .parsing .psi .util .LocalizationConstruct ;
37+ import de .halirutan .mathematica .parsing .psi .util .LocalizationConstruct .ConstructType ;
3738import de .halirutan .mathematica .parsing .psi .util .MathematicaPatternVisitor ;
3839import de .halirutan .mathematica .parsing .psi .util .MathematicaPsiUtilities ;
3940import org .jetbrains .annotations .NotNull ;
4950 *
5051 * @author patrick (5/22/13)
5152 */
52- public class LocalDefinitionCompletionProvider extends BaseScopeProcessor {
53+ class LocalDefinitionCompletionProvider extends BaseScopeProcessor {
5354
5455 private final List <Symbol > mySymbols = Lists .newLinkedList ();
5556 private final Symbol myStartElement ;
5657
57- public LocalDefinitionCompletionProvider (Symbol myStartElement ) {
58+ public LocalDefinitionCompletionProvider (Symbol startElement ) {
5859 super ();
59- this .myStartElement = myStartElement ;
60+ this .myStartElement = startElement ;
6061 }
6162
6263 @ Override
63- public boolean execute (@ NotNull PsiElement element , ResolveState state ) {
64+ public boolean execute (@ NotNull PsiElement element , @ NotNull ResolveState state ) {
6465 if (element instanceof Set || element instanceof SetDelayed || element instanceof TagSetDelayed || element instanceof TagSet ) {
6566 MathematicaPatternVisitor patternVisitor = new MathematicaPatternVisitor ();
6667 element .accept (patternVisitor );
@@ -70,7 +71,7 @@ public boolean execute(@NotNull PsiElement element, ResolveState state) {
7071 final FunctionCall functionCall = (FunctionCall ) element ;
7172 if (functionCall .isScopingConstruct ()) {
7273 List <Symbol > vars = Lists .newArrayList ();
73- final LocalizationConstruct . ConstructType scopingConstruct = functionCall .getScopingConstruct ();
74+ final ConstructType scopingConstruct = functionCall .getScopingConstruct ();
7475
7576 if (LocalizationConstruct .isFunctionLike (scopingConstruct )) {
7677 vars = MathematicaPsiUtilities .getLocalFunctionVariables (functionCall );
@@ -116,13 +117,13 @@ public boolean execute(@NotNull PsiElement element, ResolveState state) {
116117 */
117118 public List <Symbol > getSymbols () {
118119
119- Collections .sort (mySymbols , new SymbolComparator ());
120- Pattern pattern = Pattern .compile (myStartElement .getSymbolName ().substring (0 , 1 ) + ".*" );
120+ mySymbols .sort (new SymbolComparator ());
121+ Pattern pattern = Pattern .compile (myStartElement .getFullSymbolName ().substring (0 , 1 ) + ".*" );
121122 Symbol tmp = null ;
122123 for (Iterator <Symbol > symbolIterator = mySymbols .iterator (); symbolIterator .hasNext (); ) {
123124 Symbol next = symbolIterator .next ();
124125
125- if (!pattern .matcher (next .getSymbolName ()).matches ()) {
126+ if (!pattern .matcher (next .getFullSymbolName ()).matches ()) {
126127 symbolIterator .remove ();
127128 continue ;
128129 }
@@ -132,7 +133,7 @@ public List<Symbol> getSymbols() {
132133 continue ;
133134 }
134135
135- if (tmp .getSymbolName ().equals (next .getSymbolName ())) {
136+ if (tmp .getFullSymbolName ().equals (next .getFullSymbolName ())) {
136137 symbolIterator .remove ();
137138 } else {
138139 tmp = next ;
@@ -148,7 +149,7 @@ private class SymbolComparator implements Comparator<Symbol> {
148149
149150 @ Override
150151 public int compare (Symbol o1 , Symbol o2 ) {
151- return (o1 .getSymbolName ().compareTo (o2 .getSymbolName ()));
152+ return (o1 .getFullSymbolName ().compareTo (o2 .getFullSymbolName ()));
152153 }
153154
154155 }
0 commit comments