Skip to content

Commit

Permalink
Merge 86fa0f5
Browse files Browse the repository at this point in the history
  • Loading branch information
JurajKubelka committed Nov 5, 2024
2 parents 1c61904 + 86fa0f5 commit 243b485
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,12 @@ GtPharoSourceCoder >> glamorousIconsAddOnFor: anAST into: coderAddOns [
coderAddOns addStyler: GtPharoGlamorousIconStyler new.
]

{ #category : #'*GToolkit-Pharo-Coder-AddOns' }
GtPharoSourceCoder >> hidingAddOnFor: anAST into: coderAddOns [
<gtAstCoderAddOns: 100>
coderAddOns addStyler: GtPharoHidingStyler new
]

{ #category : #'*GToolkit-Pharo-Coder-AddOns' }
GtPharoSourceCoder >> highlightNodesBlock: aCollection [
^ [ :textualCoderViewModel |
Expand All @@ -360,7 +366,8 @@ GtPharoSourceCoder >> initializeAddOns: addOns [
GtPharoDynamicHighlightStyler.
GtPharoDeprecationStyler.
GtPharoMethodExpanderStyler.
GtPharoClassExpanderStyler} collect: #new.
GtPharoClassExpanderStyler.
GtPharoHidingStyler} collect: #new.

addOns addStylers: stylers
]
Expand Down
53 changes: 53 additions & 0 deletions src/GToolkit-Pharo-Coder-Method-UI/GtPharoHidingStyler.class.st
Original file line number Diff line number Diff line change
@@ -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]
]
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions src/GToolkit-Pharo-Coder-Method-UI/GtPharoStyler.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Class {
#name : #GtParenthesisFolderAttribute,
#name : #GtTextFolderAttribute,
#superclass : #BrGlamorousTriangleExpanderTextAttribute,
#instVars : [
'attribute',
Expand All @@ -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
Expand All @@ -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;
Expand All @@ -58,7 +58,7 @@ GtParenthesisFolderAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEdito
]

{ #category : #accessing }
GtParenthesisFolderAttribute >> initialize [
GtTextFolderAttribute >> initialize [
super initialize.
self beNotOverwritableByStyler.
isExpanded := true.
Expand Down

0 comments on commit 243b485

Please sign in to comment.