Skip to content

Commit

Permalink
the locate debugger button is placed in the same place as the embedde…
Browse files Browse the repository at this point in the history
…d debugger [feenkcom/gtoolkit#3735]
  • Loading branch information
JurajKubelka committed May 15, 2024
1 parent 13ed295 commit 45c631a
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ Class {
'debugSession',
'debugger',
'sourceInterval',
'sourceString'
'sourceString',
'evaluatedCode'
],
#category : #'GToolkit-Coder-UI-Coders - Evaluation'
}
Expand Down Expand Up @@ -53,6 +54,41 @@ GtCoderDebugSessionInSpaceEvaluationStatus >> debuggerSpace [
space
]

{ #category : #accessing }
GtCoderDebugSessionInSpaceEvaluationStatus >> evaluatedCode [
<return: #TGtSourceCoderEvaluatedCode>
^ evaluatedCode ifNil: [
evaluatedCode := GtSourceCoderNoEvaluatedCode default ]
]

{ #category : #accessing }
GtCoderDebugSessionInSpaceEvaluationStatus >> evaluatedCode: anObject [
evaluatedCode := anObject
]

{ #category : #accessing }
GtCoderDebugSessionInSpaceEvaluationStatus >> evaluatedCodeContext [
"Return a stack context that corresponds to a given evaluated code."

<return: #Context or: nil>
self debugSession process ifNil: [ ^ nil ].

^ self evaluatedCode findRelevantContextInStack: self debugSession context stack
]

{ #category : #accessing }
GtCoderDebugSessionInSpaceEvaluationStatus >> evaluatedCodeInterval [
"Return an interval that corresponds to a given evaluated code."

<return: #Interval or: nil>
^ GtCoderEvaluatedCodeIntervalFinder new
debugSession: self debugSession;
context: self evaluatedCodeContext;
evaluatedCode: self evaluatedCode;
sourceString: self sourceString;
find
]

{ #category : #testing }
GtCoderDebugSessionInSpaceEvaluationStatus >> hasDebugSessionInSpace [
^ true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ GtCoderEmbeddedDebugSessionEvaluationStatus >> asDebugSessionInSpaceEvaluationSt
debugSession: anAnnouncement releasedSession;
debugger: anAnnouncement debugger;
sourceInterval: self sourceInterval;
sourceString: self sourceString
sourceString: self sourceString;
evaluatedCode: self evaluatedCode
]

{ #category : #accessing }
Expand Down Expand Up @@ -63,17 +64,12 @@ GtCoderEmbeddedDebugSessionEvaluationStatus >> evaluatedCodeInterval [
"Return an interval that corresponds to a given evaluated code."

<return: #Interval or: nil>
| aContext |
aContext := self evaluatedCodeContext.
aContext ifNil: [ ^ nil ].

(self debugSession process isNil or: [ aContext isDead ]) ifTrue: [ ^ nil ].

^ self
forPharo11OrNewer: [ self debugSession pcRangeForContext: aContext ]
forPharo10: [ self evaluatedCode
findSourceIntervalForContext: aContext
sourceString: self sourceString ]
^ GtCoderEvaluatedCodeIntervalFinder new
debugSession: self debugSession;
context: self evaluatedCodeContext;
evaluatedCode: self evaluatedCode;
sourceString: self sourceString;
find
]

{ #category : #accessing }
Expand Down
74 changes: 74 additions & 0 deletions src/GToolkit-Coder-UI/GtCoderEvaluatedCodeIntervalFinder.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
Class {
#name : #GtCoderEvaluatedCodeIntervalFinder,
#superclass : #Object,
#instVars : [
'debugSession',
'context',
'sourceString',
'evaluatedCode'
],
#category : #'GToolkit-Coder-UI-Coders - Evaluation'
}

{ #category : #accessing }
GtCoderEvaluatedCodeIntervalFinder >> context [
<return: #Context>
^ context
]

{ #category : #accessing }
GtCoderEvaluatedCodeIntervalFinder >> context: aContext [
context := aContext
]

{ #category : #accessing }
GtCoderEvaluatedCodeIntervalFinder >> debugSession [
<return: #DebugSession>
^ debugSession
]

{ #category : #accessing }
GtCoderEvaluatedCodeIntervalFinder >> debugSession: anObject [
debugSession := anObject
]

{ #category : #accessing }
GtCoderEvaluatedCodeIntervalFinder >> evaluatedCode [
<return: #TGtSourceCoderEvaluatedCode>
^ evaluatedCode
]

{ #category : #accessing }
GtCoderEvaluatedCodeIntervalFinder >> evaluatedCode: anObject [
evaluatedCode := anObject
]

{ #category : #finding }
GtCoderEvaluatedCodeIntervalFinder >> find [
"Return an interval that corresponds to a given evaluated code."

<return: #Interval or: nil>
debugSession ifNil: [ ^ nil ].
debugSession process ifNil: [ ^ nil ].
context ifNil: [ ^ nil ].
context isDead ifTrue: [ ^ nil ].

^ self
forPharo11OrNewer: [ self debugSession pcRangeForContext: context ]
forPharo10: [ evaluatedCode ifNil: [ ^ nil ].
sourceString ifNil: [ ^ nil ].
self evaluatedCode
findSourceIntervalForContext: context
sourceString: sourceString ]
]

{ #category : #accessing }
GtCoderEvaluatedCodeIntervalFinder >> sourceString [
<return: #String>
^ sourceString
]

{ #category : #accessing }
GtCoderEvaluatedCodeIntervalFinder >> sourceString: anObject [
sourceString := anObject
]

0 comments on commit 45c631a

Please sign in to comment.