[squeak-dev] The Inbox: Tools-eem.1169.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Jul 25 19:06:55 UTC 2022


A new version of Tools was added to project The Inbox:
http://source.squeak.org/inbox/Tools-eem.1169.mcz

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

Name: Tools-eem.1169
Author: eem
Time: 25 July 2022, 12:06:53.062032 pm
UUID: f21870f4-8dbf-4b68-b24b-1ab56fa8f9f4
Ancestors: Tools-eem.1168

This is a quick hack to provide inheritance based diffing in message trace browsers; i.e. instead of diffing a selected method against its previous version it is diffed against the nearest inherited version, if present.
It is useful, but really points to the whole framework needing to be reimplemented properly.  For example, the scheme shoudl separate what is diffed against (previous version, method above/below in a messaqge trace, etc) from how it is diffed (pretty/token diffs vs exact/text diffs).

I note that the CodeHolder class variable ContentsSymbolQuints is not changed (addContentsSymbolQuint:afterEntry:, addContentsSymbolQuint:afterPosition:, removeContentsSymbol: have no senders).  SO the flexibility gets in the way, and arguably should be removed.

=============== Diff against Tools-eem.1168 ===============

Item was added:
+ ----- Method: ChangeList>>sourceAndDiffsQuintsOnly (in category 'controls') -----
+ sourceAndDiffsQuintsOnly
+ 	"Answer a list of quintuplets representing information on the alternative views available in the code pane for the case where the only plausible choices are showing source or either of the two kinds of diffs"
+ 
+ 	^ #(
+ (source			togglePlainSource 		showingPlainSourceString	'source'			'the textual source code as writen')
+ (showDiffs		toggleRegularDiffing	showingRegularDiffsString	'showDiffs'		'the textual source diffed from its prior version')
+ (prettyDiffs		togglePrettyDiffing		showingPrettyDiffsString	'prettyDiffs'		'formatted textual source diffed from formatted form of prior version'))!

Item was changed:
  ----- Method: CodeHolder class>>defaultContentsSymbolQuints (in category 'controls') -----
  defaultContentsSymbolQuints
  	"Default list of quintuplets representing information on the alternative views available in the code pane
  		first element:	the contentsSymbol used
  		second element:	the selector to call when this item is chosen.
  		third element:	the selector to call to obtain the wording of the menu item.
  		fourth element:	the wording to represent this view
  		fifth element:	balloon help
  	A hypen indicates a need for a seperator line in a menu of such choices"
  
  	^ {
  		{#source
  			. #togglePlainSource 
  			. #showingPlainSourceString 
  			. 'source'
  			. 'the textual source code as written' translated} .
  		{#documentation
  			. #toggleShowDocumentation
  			. #showingDocumentationString
  			. 'documentation'
  			. 'the first comment in the method' translated} .
  
  		#- .
  		{#prettyPrint
  			. #togglePrettyPrint
  			. #prettyPrintString
  			. 'prettyPrint'
  			. 'the method source presented in a standard text format' translated} .
  
  		#- .
  		{#showDiffs
  			. #toggleRegularDiffing
  			. #showingRegularDiffsString
  			. 'showDiffs'
  			. 'the textual source diffed from its prior version' translated} .
+ 		{#showInheritanceDiffs
+ 			. #toggleInheritanceDiffing
+ 			. #showingInheritanceDiffsString
+ 			. 'showInheritanceDiffs'
+ 			. 'the textual source diffed from its superclass implementation' translated} .
  
  		#- .
  		{#decompile
  			. #toggleDecompile
  			. #showingDecompileString
  			. 'decompile'
  			. 'source code decompiled from byteCodes' translated} .
  		{#byteCodes
  			. #toggleShowingByteCodes
  			. #showingByteCodesString
  			. 'byteCodes'	
  			. 'the bytecodes that comprise the compiled method' translated} .
  	}!

Item was added:
+ ----- Method: CodeHolder>>diffFromSuperclassFor:class:selector: (in category 'diffs') -----
+ diffFromSuperclassFor: sourceCode class: class selector: selector
+ 	"If there is a prior version of source for the selected method, return a diff, else just return the source code"
+ 
+ 	^(class superclass whichClassIncludesSelector: selector)
+ 		ifNil: [sourceCode]
+ 		ifNotNil:
+ 			[:superclass|
+ 			TextDiffBuilder buildDisplayPatchFrom: (superclass sourceCodeAt: selector) to: sourceCode inClass: class prettyDiffs: self showingPrettyDiffs]!

Item was added:
+ ----- Method: CodeHolder>>showInheritanceDiffs (in category 'diffs') -----
+ showInheritanceDiffs
+ 	"Answer whether the receiver is showing diffs of source code based on inheritance."
+ 
+ 	^ contentsSymbol == #showInheritanceDiffs
+ !

Item was added:
+ ----- Method: CodeHolder>>showInheritanceDiffs: (in category 'diffs') -----
+ showInheritanceDiffs: aBoolean
+ 	"Set whether I'm showing regular diffs as indicated"
+ 
+ 	self showingInheritanceDiffs
+ 		ifFalse:
+ 			[aBoolean ifTrue:
+ 				[contentsSymbol := #showInheritanceDiffs]]
+ 		ifTrue:
+ 			[aBoolean ifFalse:
+ 				[contentsSymbol := #source]].
+ 	self setContentsToForceRefetch.
+ 	self contentsChanged!

Item was changed:
  ----- Method: CodeHolder>>showingAnyKindOfDiffs (in category 'diffs') -----
  showingAnyKindOfDiffs
  	"Answer whether the receiver is currently set to show any kind of diffs"
  
+ 	^ #(showDiffs showInheritanceDiffs prettyDiffs) includes: contentsSymbol!
- 	^ #(showDiffs prettyDiffs) includes: contentsSymbol!

Item was added:
+ ----- Method: CodeHolder>>showingInheritanceDiffs (in category 'diffs') -----
+ showingInheritanceDiffs
+ 	"Answer whether the receiver is showing regular diffs of source code"
+ 
+ 	^ contentsSymbol == #showInheritanceDiffs
+ !

Item was added:
+ ----- Method: CodeHolder>>showingInheritanceDiffsString (in category 'diffs') -----
+ showingInheritanceDiffsString
+ 	"Answer a string representing whether I'm showing regular diffs"
+ 
+ 	^ (self showingInheritanceDiffs
+ 		ifTrue:
+ 			['<yes>']
+ 		ifFalse:
+ 			['<no>']), 'showInheritanceDiffs'!

Item was changed:
  ----- Method: CodeHolder>>sourceAndDiffsQuintsOnly (in category 'controls') -----
  sourceAndDiffsQuintsOnly
  	"Answer a list of quintuplets representing information on the alternative views available in the code pane for the case where the only plausible choices are showing source or either of the two kinds of diffs"
  
  	^ #(
  (source			togglePlainSource 		showingPlainSourceString	'source'			'the textual source code as writen')
  (showDiffs		toggleRegularDiffing	showingRegularDiffsString	'showDiffs'		'the textual source diffed from its prior version')
+ (showInheritanceDiffs		toggleInheritanceDiffing	showingInheritanceDiffsString	'showInheritanceDiffs'		'the textual source diffed from its superclass implementation')
  (prettyDiffs		togglePrettyDiffing		showingPrettyDiffsString	'prettyDiffs'		'formatted textual source diffed from formatted form of prior version'))!

Item was changed:
  ----- Method: CodeHolder>>sourceStringPrettifiedAndDiffed (in category 'message list') -----
  sourceStringPrettifiedAndDiffed
  	"Answer a copy of the source code for the selected message, transformed by diffing and pretty-printing exigencies"
  
  	| class selector sourceString |
  	class := self selectedClassOrMetaClass.
  	selector := self selectedMessageName.
  	(class isNil or: [selector isNil]) ifTrue: [^'missing'].
  	sourceString := class ultimateSourceCodeAt: selector ifAbsent: [^'error'].
  	self validateMessageSource: sourceString forSelector: selector inClass: class.
  	(#(#prettyPrint #prettyDiffs) 
  		includes: contentsSymbol) 
  			ifTrue: 
  				[sourceString := class prettyPrinterClass 
  							format: sourceString
  							in: class
  							notifying: nil].
  	self showingAnyKindOfDiffs 
+ 		ifTrue: [sourceString := contentsSymbol == #showInheritanceDiffs
+ 								ifTrue: [self diffFromSuperclassFor: sourceString class: self selectedClass selector: self selectedMessageName]
+ 								ifFalse: [self diffFromPriorSourceFor: contents]].
- 		ifTrue: [sourceString := self diffFromPriorSourceFor: sourceString].
  	^sourceString!

Item was added:
+ ----- Method: CodeHolder>>toggleInheritanceDiffing (in category 'diffs') -----
+ toggleInheritanceDiffing
+ 	"Toggle whether inheritance-diffing should be shown in the code pane"
+ 
+ 	| wasShowingDiffs |
+ 	self okToChange ifTrue:
+ 		[wasShowingDiffs := self showingRegularDiffs or: [self showingInheritanceDiffs].
+ 		self restoreTextualCodingPane.
+ 		self showInheritanceDiffs: wasShowingDiffs not.
+ 		self setContentsToForceRefetch.
+ 		self contentsChanged]
+ 
+ !

Item was changed:
  ----- Method: CodeHolder>>toggleRegularDiffing (in category 'diffs') -----
  toggleRegularDiffing
  	"Toggle whether regular-diffing should be shown in the code pane"
  
  	| wasShowingDiffs |
  	self okToChange ifTrue:
+ 		[wasShowingDiffs := self showingRegularDiffs or: [self showingInheritanceDiffs].
- 		[wasShowingDiffs := self showingRegularDiffs.
  		self restoreTextualCodingPane.
  		self showRegularDiffs: wasShowingDiffs not.
  		self setContentsToForceRefetch.
  		self contentsChanged]
  
  !

Item was changed:
+ (PackageInfo named: 'Tools') postscript: 'CodeHolder initialize. "To see CodeHolder class>>defaultContentsSymbolQuints''s quints"
- (PackageInfo named: 'Tools') postscript: 'ToolIcons icons removeKey: #font ifAbsent: [].
  
+ ToolIcons icons removeKey: #font ifAbsent: [].
+ 
  "Update description of the preference #extraDebuggerButtons (Tools-ct.1128)"
  (Preferences preferenceAt: #extraDebuggerButtons) instVarNamed: ''helpString'' put: ''If true, debugger windows will show *two* rows of buttons -- the debugger-specific row (proceed, restart, etc.) and also the conventional code-tools row. This preference overrides the "Optional buttons" preference for debuggers.''.'!



More information about the Squeak-dev mailing list