Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1491.mcz
==================== Summary ====================
Name: Morphic-mt.1491
Author: mt
Time: 11 July 2019, 7:43:26.133838 am
UUID: 8e7d61cb-067a-d145-a86e-3484bfb38617
Ancestors: Morphic-cmfcmf.1490
Replaces one use of Symbol class >> #lookup: with the more common (i.e., more senders) idiom Symbol class >> #hasInterned:ifTrue:.
=============== Diff against Morphic-cmfcmf.1490 ===============
Item was changed:
----- Method: SearchBar>>smartSearch:in: (in category 'searching') -----
smartSearch: text in: morph
"Take the user input and perform an appropriate search"
| input newContents |
self removeResultsWidget.
input := text asString ifEmpty:[^self].
self class useSmartSearch ifFalse: [^ ToolSet default browseMessageNames: input].
"If it is a global or a full class name, browse that class."
(Smalltalk bindingOf: input) ifNotNil:[:assoc| | global |
global := assoc value.
^ToolSet browse: (global isBehavior ifTrue:[global] ifFalse:[global class]) selector: nil].
"If it is a symbol and there are implementors of it, browse those implementors."
+ Symbol hasInterned: input ifTrue: [:selector |
- (Symbol lookup: input) ifNotNil: [:selector |
(SystemNavigation new allImplementorsOf: selector) ifNotEmpty:[:list|
^SystemNavigation new
browseMessageList: list
name: 'Implementors of ' , input]].
"If it starts uppercase, browse classes if any. Otherwise, just search for messages."
input first isUppercase
ifTrue: [
(UIManager default classFromPattern: input withCaption: '')
ifNotNil:[:aClass| ^ToolSet browse: aClass selector: nil]
ifNil: [
newContents := input, ' -- not found.'.
self searchTerm: newContents.
self selection: (input size+1 to: newContents size).
self currentHand newKeyboardFocus: morph textMorph.
^ self]]
ifFalse: [
ToolSet default browseMessageNames: input].!
Marcel Taeumel uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-mt.1069.mcz
==================== Summary ====================
Name: System-mt.1069
Author: mt
Time: 11 July 2019, 9:21:36.166354 am
UUID: 27227430-c08f-3c47-b9fd-b646e7f948b6
Ancestors: System-mt.1068
Fixes minor regression in suggestedTypeNames. That is. 'someMorphThing' should also yield 'MorphThing', not just 'Morph' and 'Thing'.
=============== Diff against System-mt.1068 ===============
Item was changed:
----- Method: String>>suggestedTypeNames (in category '*system') -----
suggestedTypeNames
^ Array streamContents: [:stream |
self findFeatureIndicesDo: [:start :end |
(self at: start) isUppercase ifTrue: [
stream nextPut: (self copyFrom: start to: end).
+ end ~= self size ifTrue: [
+ stream nextPut: (self copyFrom: start to: self size) withBlanksTrimmed].
"Often, argument names that refer to Collections end in the letter s, which can cause the suggested type-name to not be found. Account for this."
(self at: end) = $s ifTrue: [
stream nextPut: (self copyFrom: start to: end -1)]]]].!
A new version of ToolBuilder-Kernel was added to project The Inbox:
http://source.squeak.org/inbox/ToolBuilder-Kernel-mt.125.mcz
==================== Summary ====================
Name: ToolBuilder-Kernel-mt.125
Author: mt
Time: 11 July 2019, 8:50:30.487838 am
UUID: 3f3a21f8-a141-734f-8aed-f0c21aff22b9
Ancestors: ToolBuilder-Kernel-mt.124
Updates the search for class names using the new find-features feature on strings. Find WeakIdentityKeyDictionary (in a small list of results) with any of the following patterns:
WKD
Weak*Dict*
WeakDict
WeakIdentityKeyDictionary
=============== Diff against ToolBuilder-Kernel-mt.124 ===============
Item was changed:
----- Method: UIManager>>classOrTraitFrom:pattern:label: (in category 'system introspecting') -----
classOrTraitFrom: environment pattern: pattern label: label
+ "Given a pattern and an environment, try to find a class or trait using several strategies:
+ - EXACT: If there is a class or trait whose name exactly given by pattern, return it.
+ - UPPER: If the pattern is upper-case only, find camel-case letters with that sequence.
+ - WILD: Try the pattern as-is for regular wild-card search.
+ - FEATURE: Split patterns at feature boundaries and insert wild cards between.
+ - FUZZY: Split patterns at feature boundaries BUT treat each feature as a full class name.
+ If there is only one class or trait in the given environment whose name matches pattern, return it. Otherwise, put up a menu offering the names of all classes that match pattern, and return the class chosen, else nil if nothing chosen.
- "If there is a class or trait whose name exactly given by pattern, return it.
- If there is only one class or trait in the given environment whose name matches pattern, return it.
- Otherwise, put up a menu offering the names of all classes that match pattern, and return the class chosen, else nil if nothing chosen.
- This method ignores separator characters in the pattern"
+ !!!! In any case, separator characters in the pattern are ignored."
+
+ | toMatch potentialNames names selectedIndex |
+
+ "If there's a class or trait named as pattern, then return it."
+ (environment classOrTraitNamed: pattern) ifNotNil: [:classOrTrait | ^ classOrTrait].
+
+ "Validate pattern."
- | toMatch potentialNames names exactMatch lines reducedIdentifiers selectedIndex |
toMatch := pattern copyWithoutAll: Character separators.
+ toMatch := toMatch asLowercase copyWithout: $..
toMatch ifEmpty: [ ^nil ].
+
+ "Fetch search space."
+ names := OrderedCollection new.
+ potentialNames := environment classAndTraitNames asOrderedCollection.
+
+ "Try uppercase-only patterns for patterns such as 'WKD' to find 'WeakIdentityKeyDictionary' etc."
+ names ifEmpty: [
+ (pattern allSatisfy: [:char | char isUppercase]) ifTrue: [
+ potentialNames do: [:each |
+ | patternStream |
+ patternStream := pattern readStream.
+ each detect: [:char |
+ (patternStream atEnd not and: [patternStream peek = char])
+ ifTrue: [
+ patternStream next.
+ patternStream atEnd
+ ifTrue: [names add: each. true "Match!!"]
+ ifFalse: [false "Not yet..."]]
+ ifFalse: [false "No match..."] ] ifNone: [] ] ]].
+
+ "Try wildcard search for patterns such as 'Weak*Dict*' to find 'WeakIdentityKeyDictionary' etc."
+ names ifEmpty: [
+ names := potentialNames select: [ :each | toMatch match: each ]].
- "If there's a class or trait named as pattern, then return it."
- Symbol hasInterned: pattern ifTrue: [ :symbol |
- environment at: symbol ifPresent: [ :maybeClassOrTrait |
- ((maybeClassOrTrait isKindOf: Class) or: [
- maybeClassOrTrait isTrait ])
- ifTrue: [ ^maybeClassOrTrait ] ] ].
- "No exact match, look for potential matches."
- toMatch := pattern asLowercase copyWithout: $..
- potentialNames := (environment classAndTraitNames) asOrderedCollection.
- names := pattern last = $. "This is some old hack, using String>>#match: may be better."
- ifTrue: [ potentialNames select: [ :each | each asLowercase = toMatch ] ]
- ifFalse: [
- potentialNames select: [ :each |
- each includesSubstring: toMatch caseSensitive: false ] ].
- exactMatch := names detect: [ :each | each asLowercase = toMatch ] ifNone: [ nil ].
- lines := OrderedCollection new.
- exactMatch ifNotNil: [ lines add: 1 ].
- "Also try some fuzzy matching."
- reducedIdentifiers := pattern suggestedTypeNames select: [ :each |
- potentialNames includes: each ].
- reducedIdentifiers ifNotEmpty: [
- names addAll: reducedIdentifiers.
- lines add: 1 + names size + reducedIdentifiers size ].
- "Let the user select if there's more than one possible match. This may give surprising results."
- names size = 0 ifTrue: [^ nil "nothing matches"].
+ "Try feature-based search for patterns such as 'WeakDict' to find 'WeakIdentityKeyDictionary' etc."
+ names ifEmpty: [
+ toMatch := pattern copyWithoutAll: '.*#'.
+ toMatch findFeatures in: [:features |
+ "1) Insert wildcards between features and at the end."
+ toMatch := (features joinSeparatedBy: '*'), '*'.
+ names := potentialNames select: [ :each | toMatch match: each ].
+ names ifEmpty: [
+ "2) Insert wildcards before, between, and after features."
+ toMatch := '*', (features joinSeparatedBy: '*'), '*'.
+ names := potentialNames select: [ :each | toMatch match: each ] ]] ].
+
+ "Try some fuzzy matching."
+ names addAll: (pattern suggestedTypeNames select: [ :each | potentialNames includes: each ]).
+
+ "Still no match?"
+ names ifEmpty: [ ^ nil ].
+
+ "Let the user select if there's more than one possible match. This may give surprising results."
selectedIndex := names size = 1
ifTrue: [ 1 ]
+ ifFalse: [ self chooseFrom: names title: label ].
- ifFalse: [
- exactMatch ifNotNil: [ names addFirst: exactMatch ].
- self chooseFrom: names lines: lines title: label ].
selectedIndex = 0 ifTrue: [ ^nil ].
^environment at: (names at: selectedIndex) asSymbol!
Marcel Taeumel uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-mt.1068.mcz
==================== Summary ====================
Name: System-mt.1068
Author: mt
Time: 11 July 2019, 8:46:30.024838 am
UUID: e2fe883c-8353-bf4d-8921-ba296fa973bb
Ancestors: System-cmm.1067
Use new find-features feature to implement #suggestedTypeNames.
=============== Diff against System-cmm.1067 ===============
Item was changed:
----- Method: String>>suggestedTypeNames (in category '*system') -----
suggestedTypeNames
+
+ ^ Array streamContents: [:stream |
+ self findFeatureIndicesDo: [:start :end |
+ (self at: start) isUppercase ifTrue: [
+ stream nextPut: (self copyFrom: start to: end).
+ "Often, argument names that refer to Collections end in the letter s, which can cause the suggested type-name to not be found. Account for this."
+ (self at: end) = $s ifTrue: [
+ stream nextPut: (self copyFrom: start to: end -1)]]]].!
- ^ Array streamContents:
- [ : stream |
- self withIndexDo:
- [ : eachChar : index |
- eachChar isUppercase ifTrue:
- [ stream nextPut:
- (self
- copyFrom: index
- to: self size) withBlanksTrimmed.
- "Often, argument names that refer to Collections end in the letter s, which can cause the suggested type-name to not be found. Account for this."
- self last = $s
- ifTrue:
- [ stream nextPut:
- (self
- copyFrom: index
- to: self size-1) withBlanksTrimmed ] ] ] ]!