[squeak-dev] The Inbox: Tools-ct.1054.mcz
commits at source.squeak.org
commits at source.squeak.org
Thu May 6 21:40:30 UTC 2021
A new version of Tools was added to project The Inbox:
http://source.squeak.org/inbox/Tools-ct.1054.mcz
==================== Summary ====================
Name: Tools-ct.1054
Author: ct
Time: 6 May 2021, 11:40:27.54561 pm
UUID: edc189dc-7bb9-974a-9aa3-4760e7e67239
Ancestors: Tools-mt.1053
Proposal: Adds a new preference #acceptWithPrettyPrint that, if enabled, automatically pretty-prints every message before accepting it in a code holder. When used together with the preferences #browseWithPrettyPrint (and maybe also #diffsWithPrettyPrint), given a good pretty-printer such as PoppyPrint, this has the potential to make your journey through Squeak even prettier. :-)
=============== Diff against Tools-mt.1053 ===============
Item was changed:
----- Method: Browser>>defineMessageFrom:notifying: (in category 'message functions') -----
defineMessageFrom: aString notifying: aController
"Compile the expressions in aString. Notify aController if a syntax error occurs. Install the compiled method in the selected class classified under the currently selected message category name. Answer the selector obtained if compilation succeeds, nil otherwise."
| selectedMessageName selector category oldMessageList selectedClassOrMetaClass |
selectedMessageName := self selectedMessageName.
oldMessageList := self messageList.
selectedClassOrMetaClass := self selectedClassOrMetaClass.
contents := nil.
selector := (selectedClassOrMetaClass newParser parseSelector: aString).
(self metaClassIndicated
and: [(selectedClassOrMetaClass includesSelector: selector) not
and: [Metaclass isScarySelector: selector]])
ifTrue: ["A frist-time definition overlaps the protocol of Metaclasses"
(self confirm: ((selector , ' is used in the existing class system.
Overriding it could cause serious problems.
Is this really what you want to do?') asText makeBoldFrom: 1 to: selector size))
ifFalse: [^nil]].
category := selectedMessageName
ifNil: [ self selectedMessageCategoryName ]
ifNotNil: [ (selectedClassOrMetaClass >> selectedMessageName) methodReference ifNotNil: [ : ref | ref category ]].
+ selector := self
+ basicCompile: aString
+ in: selectedClassOrMetaClass
+ classified: category
+ notifying: aController.
- selector := selectedClassOrMetaClass
- compile: aString
- classified: category
- notifying: aController.
selector == nil ifTrue: [^ nil].
contents := aString copy.
self changed: #messageCategoryList. "Because the 'as yet unclassified' might just appear."
self changed: #messageList. "Because we have code-dependent list formatting by now such as #isDeprecated."
selector ~~ selectedMessageName
ifTrue:
[category = ClassOrganizer nullCategory
ifTrue: [self changed: #classSelectionChanged.
self changed: #classList.
self messageCategoryListIndex: 1].
self setClassOrganizer. "In case organization not cached"
(oldMessageList includes: selector)
ifFalse: [self changed: #messageList].
self messageListIndex: (self messageList indexOf: selector)].
^ selector!
Item was added:
+ ----- Method: CodeHolder>>basicCompile:in:classified:notifying: (in category 'code pane') -----
+ basicCompile: aString in: aClassOrMetaClass classified: category notifying: requestor
+
+ | source |
+ source := SystemBrowser acceptWithPrettyPrint
+ ifTrue: [aClassOrMetaClass prettyPrinterClass
+ format: aString in: aClassOrMetaClass notifying: requestor]
+ ifFalse: [aString].
+ ^ aClassOrMetaClass
+ compile: source
+ classified: category
+ notifying: requestor!
Item was changed:
----- Method: CodeHolder>>compileMessage:notifying: (in category 'code pane') -----
compileMessage: aString notifying: aController
"Compile the code that was accepted by the user, placing the compiled method into an appropriate message category. Return true if the compilation succeeded, else false."
| selectedMessageName selector category selectedClassOrMetaClass |
selectedMessageName := self selectedMessageName.
selectedClassOrMetaClass := self selectedClassOrMetaClass.
contents := nil.
selector := (selectedClassOrMetaClass newParser parseSelector: aString).
(self metaClassIndicated
and: [(selectedClassOrMetaClass includesSelector: selector) not
and: [Metaclass isScarySelector: selector]])
ifTrue: ["A frist-time definition overlaps the protocol of Metaclasses"
(self confirm: ((selector , ' is used in the existing class system.
Overriding it could cause serious problems.
Is this really what you want to do?') asText makeBoldFrom: 1 to: selector size))
ifFalse: [^nil]].
category := self selectedMessageCategoryName.
+ selector := self
+ basicCompile: aString
+ in: selectedClassOrMetaClass
+ classified: category
+ notifying: aController.
- selector := selectedClassOrMetaClass
- compile: aString
- classified: category
- notifying: aController.
selector == nil ifTrue: [^ nil].
contents := aString copy.
currentCompiledMethod := selectedClassOrMetaClass compiledMethodAt: selector.
^ true!
Item was changed:
----- Method: DependencyBrowser>>defineMessageFrom:notifying: (in category 'contents') -----
defineMessageFrom: aString notifying: aController
"Compile the expressions in aString. Notify aController if a syntax error occurs. Install the compiled method in the selected class classified under the currently selected message category name. Answer the selector obtained if compilation succeeds, nil otherwise."
| selectedMessageName selector category oldMessageList |
selectedMessageName := self selectedMessageName.
oldMessageList := self messageList.
contents := nil.
selector := (self selectedClassOrMetaClass newParser parseSelector: aString).
+ selector := self
+ basicCompile: aString
+ in: self selectedClassOrMetaClass
+ classified: (category := self selectedMessageCategoryName)
+ notifying: aController.
- selector := self selectedClassOrMetaClass
- compile: aString
- classified: (category := self selectedMessageCategoryName)
- notifying: aController.
selector == nil ifTrue: [^ false].
contents := aString copy.
^ true
!
Item was changed:
AppRegistry subclass: #SystemBrowser
instanceVariableNames: ''
+ classVariableNames: 'AcceptWithPrettyPrint BrowseWithDragNDrop BrowseWithPrettyPrint'
- classVariableNames: 'BrowseWithDragNDrop BrowseWithPrettyPrint'
poolDictionaries: ''
category: 'Tools-Base'!
!SystemBrowser commentStamp: '<historical>' prior: 0!
This is the AppRegistry class for class browsing!
Item was added:
+ ----- Method: SystemBrowser class>>acceptWithPrettyPrint (in category 'preferences') -----
+ acceptWithPrettyPrint
+ <preference: 'Accept with pretty-print' category: 'browsing' description: 'If true, browsers will automatically pretty-print every method when you accept it.' type: #Boolean>
+ ^ AcceptWithPrettyPrint ifNil: [false].!
Item was added:
+ ----- Method: SystemBrowser class>>acceptWithPrettyPrint: (in category 'preferences') -----
+ acceptWithPrettyPrint: aBoolean
+ AcceptWithPrettyPrint := aBoolean.!
More information about the Squeak-dev
mailing list
|