Skip to content

Commit

Permalink
Merge 3f92932
Browse files Browse the repository at this point in the history
  • Loading branch information
chisandrei committed May 14, 2024
2 parents 0652399 + 3f92932 commit 7d16efa
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 20 deletions.
5 changes: 3 additions & 2 deletions src/GToolkit-Debugger/BlBlocUIManager.extension.st
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Extension { #name : #BlBlocUIManager }

{ #category : #'*GToolkit-Debugger' }
BlBlocUIManager >> gtDebugProcess: process context: context withEmbeddedDebuggerIn: aCoderRequesterObject withSourceString: aSourceString withSourceInterval: aSourceInterval forException: exception [
BlBlocUIManager >> gtDebugProcess: process context: context withEmbeddedDebuggerIn: aCoderRequesterObject withSourceString: aSourceString withSourceInterval: aSourceInterval forException: exception evaluationInfo: anEvaluationInfo [
"Open a dedicated debugger as a result of an error that happened when executing code
in an editor. The debugger can decide if and how to embed itself within the editor."

Expand All @@ -16,5 +16,6 @@ BlBlocUIManager >> gtDebugProcess: process context: context withEmbeddedDebugger
dueTo: exception
embeddedIn: aCoderRequesterObject
withSourceString: aSourceString
withSourceInterval: aSourceInterval ]
withSourceInterval: aSourceInterval
evaluationInfo: anEvaluationInfo ]
]
15 changes: 8 additions & 7 deletions src/GToolkit-Debugger/GtCoderEmbeddedDebuggerElement.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,16 @@ GtCoderEmbeddedDebuggerElement class >> isEmbeddedDebuggerEnabled [
]

{ #category : #opening }
GtCoderEmbeddedDebuggerElement class >> openOn: debugSession dueTo: anException embeddedIn: aCoderRequesterObject withSourceString: aSourceString withSourceInterval: aSourceInterval [
GtCoderEmbeddedDebuggerElement class >> openOn: debugSession dueTo: anException embeddedIn: aCoderRequesterObject withSourceString: aSourceString withSourceInterval: aSourceInterval evaluationInfo: anEvaluationInfo [
| isHandled |
isHandled := false.
self isEmbeddedDebuggerEnabled ifTrue: [
isHandled := aCoderRequesterObject
notifyShowDebuggerRequest: debugSession
dueTo: anException
sourceString: aSourceString
sourceInterval: aSourceInterval ].
self isEmbeddedDebuggerEnabled
ifTrue: [ isHandled := aCoderRequesterObject
notifyShowDebuggerRequest: debugSession
dueTo: anException
sourceString: aSourceString
sourceInterval: aSourceInterval
evaluationInfo: anEvaluationInfo ].

isHandled
ifFalse: [ ^ Smalltalk tools debugger openOn: debugSession withFullView: true ]
Expand Down
11 changes: 8 additions & 3 deletions src/GToolkit-Debugger/GtEmbeddedDebuggerStyler.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Class {

{ #category : #'api - styling' }
GtEmbeddedDebuggerStyler >> extraStyle: aText ast: theAst [
| aStatus anEvaluatedSource anEvaluatedInterval theSourceStartInText theSourceEndInText anAttribute |
| aStatus anEvaluatedSource anEvaluatedInterval theSourceStartInText theSourceEndInText anAttribute anAttributeIndex |
super extraStyle: aText ast: theAst.

self coderViewModel ifNil: [ ^ self ].
Expand All @@ -31,8 +31,13 @@ GtEmbeddedDebuggerStyler >> extraStyle: aText ast: theAst [
anAttribute := GtEmbeddedDebuggerAttribute new
signaledException: aStatus exception;
debugSession: aStatus sharedDebugSession.

anAttributeIndex := aStatus evaluatedCodeInterval
ifNil: [ theSourceEndInText ]
ifNotNil: [ :aContextInterval | (aContextInterval last + theSourceStartInText) min: aText size ].

aText
attribute: anAttribute
from: theSourceEndInText
to: theSourceEndInText
from: anAttributeIndex
to: anAttributeIndex
]
15 changes: 7 additions & 8 deletions src/GToolkit-Debugger/MorphicUIManager.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -38,27 +38,26 @@ MorphicUIManager >> gtDebugProcess: process context: context label: title fullVi
]

{ #category : #'*GToolkit-Debugger' }
MorphicUIManager >> gtDebugProcess: process context: context withEmbeddedDebuggerIn: aCoderRequesterObject withSourceString: aSourceString withSourceInterval: aSourceInterval forException: exception [
MorphicUIManager >> gtDebugProcess: process context: context withEmbeddedDebuggerIn: aCoderRequesterObject withSourceString: aSourceString withSourceInterval: aSourceInterval forException: exception evaluationInfo: anEvaluationInfo [
"This is a copy of the standard method for opening the debugger with the difference that
the embedeable debugger is opened instead of the standard one."

| debugSession |
debugSession := process
newDebugSessionNamed: exception description
startedAt: context.
newDebugSessionNamed: exception description
startedAt: context.
debugSession exception: exception.
debugSession logStackToFileIfNeeded.
debugSession isAboutUIProcess
ifTrue:
[ DefaultExecutionEnvironment beActiveDuring: [ self spawnNewProcess ] ].
ifTrue: [ DefaultExecutionEnvironment beActiveDuring: [ self spawnNewProcess ] ].
self
defer: [ "Opened the embeddeable debugger instead of the default one."
[ GtCoderEmbeddedDebuggerElement
defer: [ "Opened the embeddeable debugger instead of the default one."[ GtCoderEmbeddedDebuggerElement
openOn: debugSession
dueTo: exception
embeddedIn: aCoderRequesterObject
withSourceString: aSourceString
withSourceInterval: aSourceInterval ]
withSourceInterval: aSourceInterval
evaluationInfo: anEvaluationInfo ]
on: Error
do: [ :ex | debugSession signalDebuggerError: ex ] ].
process suspend
Expand Down

0 comments on commit 7d16efa

Please sign in to comment.