# HG changeset patch # User Claus Gittinger # Date 1288118055 -7200 # Node ID 94fb4a47d10871f009af6ac85f0f33f4a236b31e # Parent e28b5c4fe0c9a6d509d46d9698c7ffe8247d7dd2 added: #selectorCompletion:inEnvironment:match:ignoreCase: changed: #selectorCompletion:inEnvironment:match: diff -r e28b5c4fe0c9 -r 94fb4a47d108 DoWhatIMeanSupport.st --- a/DoWhatIMeanSupport.st Tue Oct 26 12:47:16 2010 +0200 +++ b/DoWhatIMeanSupport.st Tue Oct 26 20:34:15 2010 +0200 @@ -1568,6 +1568,29 @@ 2 entries: 1st: the longest match 2nd: collection consisting of matching implemented selectors" + ^ self + selectorCompletion:aPartialSymbolName + inEnvironment:anEnvironment + match:doMatch + ignoreCase:false + + " + DoWhatIMeanSupport selectorCompletion:'inst*p' inEnvironment:Smalltalk match:true + DoWhatIMeanSupport selectorCompletion:'inst*pl' inEnvironment:Smalltalk match:true + DoWhatIMeanSupport selectorCompletion:'at:p' inEnvironment:Smalltalk match:true + DoWhatIMeanSupport selectorCompletion:'nextP' inEnvironment:Smalltalk match:true + DoWhatIMeanSupport selectorCompletion:'nextp' inEnvironment:Smalltalk match:true + " + + "Modified: / 07-06-1996 / 08:44:33 / stefan" + "Modified: / 26-10-2010 / 20:30:27 / cg" +! + +selectorCompletion:aPartialSymbolName inEnvironment:anEnvironment match:doMatch ignoreCase:ignoreCase + "given a partial selector, return an array consisting of + 2 entries: 1st: the longest match + 2nd: collection consisting of matching implemented selectors" + |matches best lcSym isMatch| matches := IdentitySet new. @@ -1576,13 +1599,15 @@ anEnvironment allMethodsWithSelectorDo:[:eachMethod :eachSelector | (isMatch - ifTrue:[ (aPartialSymbolName match:eachSelector) ] - ifFalse:[ (eachSelector startsWith:aPartialSymbolName) ]) + ifTrue:[ (aPartialSymbolName match:eachSelector ignoreCase:ignoreCase) ] + ifFalse:[ ignoreCase + ifTrue:[ (eachSelector asLowercase startsWith:aPartialSymbolName asLowercase) ] + ifFalse:[ (eachSelector startsWith:aPartialSymbolName) ] ]) ifTrue:[ matches add:eachSelector ]. ]. - matches isEmpty ifTrue:[ + (matches isEmpty and:[ignoreCase not]) ifTrue:[ "/ search for case-ignoring match lcSym := aPartialSymbolName asLowercase. anEnvironment allMethodsWithSelectorDo:[:eachMethod :eachSelector | @@ -1613,8 +1638,8 @@ DoWhatIMeanSupport selectorCompletion:'nextp' inEnvironment:Smalltalk match:true " - "Modified: / 7.6.1996 / 08:44:33 / stefan" - "Modified: / 14.6.1998 / 15:54:03 / cg" + "Modified: / 07-06-1996 / 08:44:33 / stefan" + "Created: / 26-10-2010 / 20:30:06 / cg" ! ! !DoWhatIMeanSupport class methodsFor:'rename support'! @@ -1931,9 +1956,9 @@ !DoWhatIMeanSupport class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libwidg2/DoWhatIMeanSupport.st,v 1.74 2010-08-24 13:28:35 sr Exp $' + ^ '$Header: /cvs/stx/stx/libwidg2/DoWhatIMeanSupport.st,v 1.75 2010-10-26 18:34:15 cg Exp $' ! version_CVS - ^ '$Header: /cvs/stx/stx/libwidg2/DoWhatIMeanSupport.st,v 1.74 2010-08-24 13:28:35 sr Exp $' + ^ '$Header: /cvs/stx/stx/libwidg2/DoWhatIMeanSupport.st,v 1.75 2010-10-26 18:34:15 cg Exp $' ! !