# HG changeset patch # User Jan Vrany # Date 1397046073 -7200 # Node ID afdaa19094ef47d9afabc4aeee376d0feb9715cb # Parent 67f1d06c1b883e024b19b6c2e4309e2b3cabef58 Fix in Smalltalk completion: do now show globals which are actually class vars. diff -r 67f1d06c1b88 -r afdaa19094ef SmallSense__SmalltalkCompletionEngine.st --- a/SmallSense__SmalltalkCompletionEngine.st Wed Apr 09 14:20:07 2014 +0200 +++ b/SmallSense__SmalltalkCompletionEngine.st Wed Apr 09 14:21:13 2014 +0200 @@ -126,7 +126,9 @@ result add:(ClassPO new subject: cls; showPrefix: cls isJavaClass). ] ] ifFalse:[ - result add:(VariablePO globalVariable: nm) + (self isGlobalKeyForClassVariable: nm) ifFalse:[ + result add:(VariablePO globalVariable: nm) + ]. ]. ]. ]. @@ -139,7 +141,9 @@ cls isBehavior ifTrue:[ result add:(ClassPO new subject: cls; showPrefix: cls isJavaClass). ] ifFalse:[ - result add:(VariablePO globalVariable: cls). + (self isGlobalKeyForClassVariable: nm) ifFalse:[ + result add:(VariablePO globalVariable: nm). + ]. ] ] ] @@ -148,7 +152,7 @@ ] "Created: / 26-11-2011 / 17:29:10 / Jan Vrany " - "Modified: / 25-11-2013 / 11:48:44 / Jan Vrany " + "Modified: / 09-04-2014 / 13:52:25 / Jan Vrany " ! addJavaClassesInPackage: prefix @@ -562,6 +566,35 @@ ] ! ! +!SmalltalkCompletionEngine methodsFor:'queries'! + +isGlobalKeyForClassVariable: aString + | i | + + i := 0. + [ + i := aString indexOf: $: startingAt: i + 1. + i ~~ 0 + ] whileTrue:[ + aString size > i ifTrue:[ + (aString at: i + 1) ~~ $: ifTrue:[ + ^ true + ]. + ]. + i := i + 1. + ]. + ^ false + + " + SmalltalkCompletionEngine new isGlobalKeyForClassVariable: 'AAA' + SmalltalkCompletionEngine new isGlobalKeyForClassVariable: 'AAA:X' + SmalltalkCompletionEngine new isGlobalKeyForClassVariable: 'BB::CC::AA' + SmalltalkCompletionEngine new isGlobalKeyForClassVariable: 'BB::CC::AA:X' + " + + "Created: / 09-04-2014 / 13:49:41 / Jan Vrany " +! ! + !SmalltalkCompletionEngine class methodsFor:'documentation'! version_HG