Fix in Smalltalk completion: do now show globals which are actually class vars.
--- 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 <jan.vrany@fit.cvut.cz>"
- "Modified: / 25-11-2013 / 11:48:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 09-04-2014 / 13:52:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
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 <jan.vrany@fit.cvut.cz>"
+! !
+
!SmalltalkCompletionEngine class methodsFor:'documentation'!
version_HG