[squeak-dev] The Trunk: Tools-mt.918.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Nov 26 08:01:10 UTC 2019


Marcel Taeumel uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-mt.918.mcz

==================== Summary ====================

Name: Tools-mt.918
Author: mt
Time: 26 November 2019, 9:01:06.905455 am
UUID: 21303972-3181-0c44-a186-154a350444b3
Ancestors: Tools-mt.917, Tools-jr.894

Merges Tools-jr.894 and Tools-jr.893, which offers some fixes for MessageSet tools. Also, users can remove all selected methods in MessageTrace now.

I chose to move the fixes for invalid method references down to RecentMessageSet. We should not spoil the base code with undocumented "ifNil" checks. :-)

=============== Diff against Tools-mt.917 ===============

Item was changed:
  ----- Method: CodeHolder>>messageHelpForMethod: (in category 'message list') -----
  messageHelpForMethod: aMethod
  	"Answer the formatted help text for a method."
  	"Show the first n lines of the source code of the method."
+ 	| source formatted |
- 	| source formatted lineCount |
  	source := aMethod getSource.
  	formatted := (Smalltalk classNamed: #SHTextStylerST80)
  		ifNil: [ source asText ]
  		ifNotNil: [ :textStylerClass |
  			textStylerClass new
  				classOrMetaClass: aMethod methodClass;
  				styledTextFor: source asText ].
+ 	^ self messageHelpTruncated: formatted!
- 	
- 	lineCount := 0.
- 	source doWithIndex: [:char :index |
- 		char = Character cr ifTrue: [lineCount := lineCount + 1].
- 		lineCount > 10 ifTrue: [
- 			formatted := formatted copyFrom: 1 to: index-1.
- 			formatted append: ' [...]'.
- 			^ formatted]].
- 
- 	^ formatted!

Item was added:
+ ----- Method: CodeHolder>>messageHelpTruncated: (in category 'message list') -----
+ messageHelpTruncated: aText
+ 	"Show only the first n lines of the text."
+ 	| formatted lineCount |
+ 	formatted := aText.
+ 	lineCount := 0.
+ 	aText doWithIndex: [:char :index |
+ 		char = Character cr ifTrue: [lineCount := lineCount + 1].
+ 		lineCount > 10 ifTrue: [
+ 			formatted := formatted copyFrom: 1 to: index-1.
+ 			formatted append: ' [...]'.
+ 			^ formatted]].
+ 	^ formatted!

Item was added:
+ ----- Method: MessageSet>>isClassDefinition: (in category 'message list') -----
+ isClassDefinition: messageListItemOrSymbol
+ 	"Answer whether this item from the message list (or its extracted selector) indicates a
+ 	class definition."
+ 	^ messageListItemOrSymbol selector = #Definition!

Item was added:
+ ----- Method: MessageSet>>isComment: (in category 'message list') -----
+ isComment: messageListItemOrSymbol
+ 	"Answer whether this item from the message list (or its extracted selector) indicates a
+ 	class comment."
+ 	^ messageListItemOrSymbol selector = #Comment!

Item was added:
+ ----- Method: MessageSet>>isHierarchy: (in category 'message list') -----
+ isHierarchy: messageListItemOrSymbol
+ 	"Answer whether this item from the message list (or its extracted selector) indicates a
+ 	class hierarchy."
+ 	^ messageListItemOrSymbol selector = #Hierarchy!

Item was changed:
  ----- Method: MessageSet>>messageHelpAt: (in category 'message list') -----
  messageHelpAt: anIndex
  	"Show the first n lines of the sources code of the selected message."
  	
  	| reference |
  	Preferences balloonHelpInMessageLists ifFalse: [^ nil].
  	self messageList size < anIndex ifTrue: [^ nil].
  	
  	reference := self messageList at: anIndex.
  	reference isValid ifFalse: [^ nil].
+ 	(self isComment: reference) ifTrue: [^ self messageHelpForComment: reference].
+ 	(self isClassDefinition: reference) ifTrue: [^ self messageHelpForClassDefinition: reference].
+ 	(self isHierarchy: reference) ifTrue: [^ self messageHelpForClassHierarchy: reference].
  	^ self messageHelpForMethod: reference compiledMethod!

Item was added:
+ ----- Method: MessageSet>>messageHelpForClassDefinition: (in category 'message list') -----
+ messageHelpForClassDefinition: aMethodReference
+ 	"Answer the formatted help text for a class definition."
+ 	^ aMethodReference setClassAndSelectorIn: [:class :sel | class definition]!

Item was added:
+ ----- Method: MessageSet>>messageHelpForClassHierarchy: (in category 'message list') -----
+ messageHelpForClassHierarchy: aMethodReference
+ 	"Answer the formatted help text for a class hierarchy."
+ 	"Show the first n lines of the class hierarchy."
+ 	| source |
+ 	source := aMethodReference setClassAndSelectorIn: [:class :sel | class printHierarchy].
+ 	^ self messageHelpTruncated: source asText!

Item was added:
+ ----- Method: MessageSet>>messageHelpForComment: (in category 'message list') -----
+ messageHelpForComment: aMethodReference
+ 	"Answer the formatted help text for a class comment."
+ 	"Show the first n lines of the class comment."
+ 	| source |
+ 	source := aMethodReference setClassAndSelectorIn: [:class :sel | class comment].
+ 	^ self messageHelpTruncated: source asText!

Item was changed:
+ ----- Method: MessageTrace>>copySelector (in category 'menus') -----
- ----- Method: MessageTrace>>copySelector (in category '*Tools') -----
  copySelector
  	Clipboard clipboardText:
  		(String streamContents:
  			[ : stream | self selectedMessages
  				do: [ : each | stream nextPutAll: each selector asString ]
  				separatedBy: [ stream space ] ])!

Item was added:
+ ----- Method: MessageTrace>>removeFromCurrentChanges (in category 'message list') -----
+ removeFromCurrentChanges
+ 	"Tell the changes mgr to forget that the selected messages were changed."
+ 
+ 	self selectedMessages do: [:each |
+ 		each setClassAndSelectorIn: [:class :selector |
+ 			ChangeSet current removeSelectorChanges: selector class: class]].
+ 	self changed: #annotation!

Item was added:
+ ----- Method: RecentMessageSet>>formattedLabel:forSelector:inClass: (in category 'message list') -----
+ formattedLabel: aString forSelector: aSymbol inClass: aClass
+ 	"Overridden to account for outdated MethodReference after class renames."	
+ 
+ 	self flag: #fix. "mt: We might want to fix RecentMessages to instead. Other tools (or features) might depend on it, too."
+ 	^ aClass
+ 		ifNil: [aString asText]
+ 		ifNotNil: [super formattedLabel: aString forSelector: aSymbol inClass: aClass]
+ !

Item was added:
+ ----- Method: RecentMessageSet>>messageHelpForMethod: (in category 'message list') -----
+ messageHelpForMethod: aMethod
+ 	"Overridden to account for outdated MethodReference after class renames."
+ 	
+ 	self flag: #fix. "mt: We might want to fix RecentMessages to instead. Other tools (or features) might depend on it, too."
+ 	^ aMethod ifNotNil: [super messageHelpForMethod: aMethod]!



More information about the Squeak-dev mailing list