From b1ad145b4749a94a4ff286114d098202118d68ad Mon Sep 17 00:00:00 2001 From: Tudor Girba Date: Thu, 31 Oct 2024 15:33:22 +0100 Subject: [PATCH 1/4] ensure symbol in typeNameFor: feenkcom/gtoolkit#4137 --- .../GtExtractMethodFromSnippetController.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Pharo-Coder-AddOns/GtExtractMethodFromSnippetController.class.st b/src/GToolkit-Pharo-Coder-AddOns/GtExtractMethodFromSnippetController.class.st index 98a24a92..e4dd1654 100644 --- a/src/GToolkit-Pharo-Coder-AddOns/GtExtractMethodFromSnippetController.class.st +++ b/src/GToolkit-Pharo-Coder-AddOns/GtExtractMethodFromSnippetController.class.st @@ -138,7 +138,7 @@ GtExtractMethodFromSnippetController >> refactoring [ { #category : #private } GtExtractMethodFromSnippetController >> typeNameFor: aRBClass [ - ^ aRBClass name , (aRBClass isMeta ifTrue: [ ' class' ] ifFalse: [ '' ]) + ^ (aRBClass name , (aRBClass isMeta ifTrue: [ ' class' ] ifFalse: [ '' ])) asSymbol ] { #category : #accessing } From c25ac9a37b41b33089b5be3df41b7b446f3b7817 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 1 Nov 2024 13:25:41 -0300 Subject: [PATCH 2/4] superclass might be `nil` --- src/GToolkit-Pharo-Coder-UI/GtClassUpdateForm.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Pharo-Coder-UI/GtClassUpdateForm.class.st b/src/GToolkit-Pharo-Coder-UI/GtClassUpdateForm.class.st index 82cdf445..f038862f 100644 --- a/src/GToolkit-Pharo-Coder-UI/GtClassUpdateForm.class.st +++ b/src/GToolkit-Pharo-Coder-UI/GtClassUpdateForm.class.st @@ -25,7 +25,7 @@ GtClassUpdateForm >> commit [ GtClassUpdateForm >> onClass: aClass [ | packageName tagName | self newClassName: aClass name. - self superclassName: aClass superclass name. + self superclassName: (aClass superclass ifNotNil: #name). self slots: ((aClass slots select: [ :aSlot | aSlot definingClass = aClass ]) collect: #name). self traits: (aClass traits collect: #name). From 86fa0f5fea3e1b3cdf113a96b3441105399f58c5 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Mon, 4 Nov 2024 11:30:41 -0600 Subject: [PATCH 3/4] Pharo Styler that hides instrumentation message sends such as assert: and time:during: --- .../GtPharoSourceCoder.extension.st | 9 +++- .../GtPharoHidingStyler.class.st | 53 +++++++++++++++++++ .../GtPharoMethodCoderViewModel.class.st | 10 ++-- .../GtPharoStyler.class.st | 4 +- ...lass.st => GtTextFolderAttribute.class.st} | 12 ++--- 5 files changed, 74 insertions(+), 14 deletions(-) create mode 100644 src/GToolkit-Pharo-Coder-Method-UI/GtPharoHidingStyler.class.st rename src/GToolkit-Pharo-Coder-Method-UI/{GtParenthesisFolderAttribute.class.st => GtTextFolderAttribute.class.st} (77%) diff --git a/src/GToolkit-Pharo-Coder-AddOns/GtPharoSourceCoder.extension.st b/src/GToolkit-Pharo-Coder-AddOns/GtPharoSourceCoder.extension.st index 527315b1..473a1122 100644 --- a/src/GToolkit-Pharo-Coder-AddOns/GtPharoSourceCoder.extension.st +++ b/src/GToolkit-Pharo-Coder-AddOns/GtPharoSourceCoder.extension.st @@ -344,6 +344,12 @@ GtPharoSourceCoder >> glamorousIconsAddOnFor: anAST into: coderAddOns [ coderAddOns addStyler: GtPharoGlamorousIconStyler new. ] +{ #category : #'*GToolkit-Pharo-Coder-AddOns' } +GtPharoSourceCoder >> hidingAddOnFor: anAST into: coderAddOns [ + + coderAddOns addStyler: GtPharoHidingStyler new +] + { #category : #'*GToolkit-Pharo-Coder-AddOns' } GtPharoSourceCoder >> highlightNodesBlock: aCollection [ ^ [ :textualCoderViewModel | @@ -360,7 +366,8 @@ GtPharoSourceCoder >> initializeAddOns: addOns [ GtPharoDynamicHighlightStyler. GtPharoDeprecationStyler. GtPharoMethodExpanderStyler. - GtPharoClassExpanderStyler} collect: #new. + GtPharoClassExpanderStyler. + GtPharoHidingStyler} collect: #new. addOns addStylers: stylers ] diff --git a/src/GToolkit-Pharo-Coder-Method-UI/GtPharoHidingStyler.class.st b/src/GToolkit-Pharo-Coder-Method-UI/GtPharoHidingStyler.class.st new file mode 100644 index 00000000..e6ac0e16 --- /dev/null +++ b/src/GToolkit-Pharo-Coder-Method-UI/GtPharoHidingStyler.class.st @@ -0,0 +1,53 @@ +Class { + #name : #GtPharoHidingStyler, + #superclass : #GtGenericPharoStyler, + #category : #'GToolkit-Pharo-Coder-Method-UI-Stylers' +} + +{ #category : #'as yet unclassified' } +GtPharoHidingStyler >> styleAssert: aMessage [ + | messageMarker folder | + ((text attributesAt: aMessage startPosition - 1) + anySatisfy: [ :each | each class == GtTextFolderAttribute ]) + ifTrue: [ ^ self ]. + messageMarker := BrTextInvisibleMarkerAttribute new. + self + attributes: {messageMarker} + from: aMessage startPosition + to: aMessage stopPosition. + folder := GtTextFolderAttribute new attribute: messageMarker. + self + attribute: folder + from: aMessage startPosition - 1 + to: aMessage startPosition - 1. +] + +{ #category : #'as yet unclassified' } +GtPharoHidingStyler >> styleTimeDuring: aMessage [ + | messageMarker folder | + ((text attributesAt: aMessage startPosition - 1) + anySatisfy: [ :each | each class == GtTextFolderAttribute ]) + ifTrue: [ ^ self ]. + messageMarker := BrTextInvisibleMarkerAttribute new. + self + attributes: {messageMarker} + from: aMessage startPosition + to: aMessage message values second leftBracket position. + self + attributes: {messageMarker} + from: aMessage message values second rightBracket position + to: aMessage message values second rightBracket position. + folder := GtTextFolderAttribute new attribute: messageMarker. + self + attribute: folder + from: aMessage startPosition - 1 + to: aMessage startPosition - 1 +] + +{ #category : #'as yet unclassified' } +GtPharoHidingStyler >> visitMessageSend: aMessageSend [ + super visitMessageSend: aMessageSend. + aMessageSend selector == #assert:description: ifTrue: [self styleAssert: aMessageSend]. + aMessageSend selector == #time:during: ifTrue: [self styleTimeDuring: aMessageSend]. + aMessageSend selector == #timeSync:during: ifTrue: [self styleTimeDuring: aMessageSend] +] diff --git a/src/GToolkit-Pharo-Coder-Method-UI/GtPharoMethodCoderViewModel.class.st b/src/GToolkit-Pharo-Coder-Method-UI/GtPharoMethodCoderViewModel.class.st index 900e4f21..54647c9f 100644 --- a/src/GToolkit-Pharo-Coder-Method-UI/GtPharoMethodCoderViewModel.class.st +++ b/src/GToolkit-Pharo-Coder-Method-UI/GtPharoMethodCoderViewModel.class.st @@ -212,11 +212,6 @@ GtPharoMethodCoderViewModel >> methodOrigin [ ^ coderModel methodOrigin ] -{ #category : #'private - notifying' } -GtPharoMethodCoderViewModel >> notifySaved: aCompiledMethod [ - self announce: (GtMethodCoderSaved new method: aCompiledMethod) -] - { #category : #'private - notifying' } GtPharoMethodCoderViewModel >> notifySaveDisabled [ self announce: (GtMethodCoderSaveDisabled new preventors: savePreventors asArray) @@ -227,6 +222,11 @@ GtPharoMethodCoderViewModel >> notifySaveEnabled [ self announce: (GtMethodCoderSaveEnabled new) ] +{ #category : #'private - notifying' } +GtPharoMethodCoderViewModel >> notifySaved: aCompiledMethod [ + self announce: (GtMethodCoderSaved new method: aCompiledMethod) +] + { #category : #'private - evaluation' } GtPharoMethodCoderViewModel >> objectVariableBindingsTo: theBindings [ super objectVariableBindingsTo: theBindings. diff --git a/src/GToolkit-Pharo-Coder-Method-UI/GtPharoStyler.class.st b/src/GToolkit-Pharo-Coder-Method-UI/GtPharoStyler.class.st index ecfe6d12..d8cd83db 100644 --- a/src/GToolkit-Pharo-Coder-Method-UI/GtPharoStyler.class.st +++ b/src/GToolkit-Pharo-Coder-Method-UI/GtPharoStyler.class.st @@ -14,9 +14,9 @@ GtPharoStyler >> collapserForParenthesesLeft: aLeftIndex right: aRightIndex [ to: aRightIndex - 1. folder := (text attributesAt: aLeftIndex) - detect: [ :each | each class == GtParenthesisFolderAttribute ] + detect: [ :each | each class == GtTextFolderAttribute ] ifNone: [ | att | - att := GtParenthesisFolderAttribute new beNotOverwritableByStyler. + att := GtTextFolderAttribute new beNotOverwritableByStyler. text attribute: att from: aLeftIndex diff --git a/src/GToolkit-Pharo-Coder-Method-UI/GtParenthesisFolderAttribute.class.st b/src/GToolkit-Pharo-Coder-Method-UI/GtTextFolderAttribute.class.st similarity index 77% rename from src/GToolkit-Pharo-Coder-Method-UI/GtParenthesisFolderAttribute.class.st rename to src/GToolkit-Pharo-Coder-Method-UI/GtTextFolderAttribute.class.st index 50c880f9..e46e9989 100644 --- a/src/GToolkit-Pharo-Coder-Method-UI/GtParenthesisFolderAttribute.class.st +++ b/src/GToolkit-Pharo-Coder-Method-UI/GtTextFolderAttribute.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtParenthesisFolderAttribute, + #name : #GtTextFolderAttribute, #superclass : #BrGlamorousTriangleExpanderTextAttribute, #instVars : [ 'attribute', @@ -9,12 +9,12 @@ Class { } { #category : #accessing } -GtParenthesisFolderAttribute class >> forAttribute: anAttribute [ +GtTextFolderAttribute class >> forAttribute: anAttribute [ ^self new attribute: anAttribute ] { #category : #accessing } -GtParenthesisFolderAttribute >> applyExpandedOrCollapsedAttributesOn: aTBrTextEditorTextualPiece in: aTextEditor [ +GtTextFolderAttribute >> applyExpandedOrCollapsedAttributesOn: aTBrTextEditorTextualPiece in: aTextEditor [ | text | text := aTextEditor text. text @@ -32,12 +32,12 @@ GtParenthesisFolderAttribute >> applyExpandedOrCollapsedAttributesOn: aTBrTextEd ] { #category : #accessing } -GtParenthesisFolderAttribute >> attribute: anAttribute [ +GtTextFolderAttribute >> attribute: anAttribute [ attribute := anAttribute ] { #category : #'as yet unclassified' } -GtParenthesisFolderAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ +GtTextFolderAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ | aToggle | aToggle := BrTriangle new id: self id; @@ -58,7 +58,7 @@ GtParenthesisFolderAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEdito ] { #category : #accessing } -GtParenthesisFolderAttribute >> initialize [ +GtTextFolderAttribute >> initialize [ super initialize. self beNotOverwritableByStyler. isExpanded := true. From 1c61904484571e02bef6f27c2e5ca75b504b69ec Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 5 Nov 2024 00:10:48 -0300 Subject: [PATCH 4/4] build coder composite phlows with listeners [feenkcom/gtoolkit#4142] --- .../GtPharoBehaviorCoderElement.class.st | 45 +++++++++---------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/src/GToolkit-Pharo-Coder-UI/GtPharoBehaviorCoderElement.class.st b/src/GToolkit-Pharo-Coder-UI/GtPharoBehaviorCoderElement.class.st index a7b2505a..8f2146ed 100644 --- a/src/GToolkit-Pharo-Coder-UI/GtPharoBehaviorCoderElement.class.st +++ b/src/GToolkit-Pharo-Coder-UI/GtPharoBehaviorCoderElement.class.st @@ -142,10 +142,29 @@ GtPharoBehaviorCoderElement >> buildContentPane [ { #category : #'building ui' } GtPharoBehaviorCoderElement >> buildContentTabs [ - + | classCoder context object aListener | + classCoder := behaviorCoderViewModel coder. + context := GtPhlowContext new. + context optionAt: #behaviorCoder put: behaviorCoderViewModel. + object := classCoder theClass. contentTabs := GtPhlowCompositeView new - views: self classViewItems; - asElementDo: [ :aBrTabGroup | aBrTabGroup ]. + object: object + arguments: {GtPhlowView empty. + context}; + collectorDo: [ :aCollector | + aCollector + context: context; + fromObject: object; + from: object class; + to: Behavior; + pragmaName: #gtClassView ]; + asElementDo: [ :aBrTabGroup | aBrTabGroup ]. + + aListener := GtPhlowChangeMethodSystemAnnouncerListener + installOnCompositeElement: contentTabs. + aListener + interestingPragmas: { #gtClassView } + andObject: object. ^ contentTabs ] @@ -163,26 +182,6 @@ GtPharoBehaviorCoderElement >> classCoder [ ^ behaviorCoderViewModel classCoder ] -{ #category : #private } -GtPharoBehaviorCoderElement >> classViewItems [ - | classCoder collector context | - - classCoder := behaviorCoderViewModel coder. - - collector := GtPhlowViewsCollector new - fromObject: classCoder theClass; - from: classCoder theClass class; - to: Behavior; - pragmaName: #gtClassView. - - context := GtPhlowContext new. - context optionAt: #behaviorCoder put: behaviorCoderViewModel. - - collector context: context. - - ^ collector collect -] - { #category : #accessing } GtPharoBehaviorCoderElement >> coderViewModel [ ^ behaviorCoderViewModel