Skip to content

Commit

Permalink
Displays the context status for watch expressions
Browse files Browse the repository at this point in the history
This commit displays the watch expression's context status in the watch
expression editor.

The status can be `Executing` if the context is still running
(e.g. it is present in the call stack) or terminated (e.g. the method
has returned).
  • Loading branch information
npapagna committed Mar 3, 2022
1 parent cbfd43f commit 4da36b8
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 23 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -21,6 +21,7 @@ project does not follow [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
* Context menu item and shortcut (shift + double-click) for editing watches.
* Support for evaluating expressions in the debugger's context. It is available via the temporary variable's inspector context menu > `Evaluate expression...`.
* Support for live evaluating expressions from a selection in the debugger.
* Context status (either Executing or Terminated) to the watch expression editor.

## Changed
* Uses the new `AdvancedDebuggerWindow` instead of the built-in `DebuggerWindow` for opening the debugger.
Expand Down
82 changes: 59 additions & 23 deletions Tools-AdvancedDebugger.pck.st
@@ -1,6 +1,6 @@
'From Cuis 5.0 [latest update: #4913] on 1 March 2022 at 1:31:36 pm'!
'From Cuis 5.0 [latest update: #4913] on 3 March 2022 at 10:35:11 am'!
'Description '!
!provides: 'Tools-AdvancedDebugger' 1 22!
!provides: 'Tools-AdvancedDebugger' 1 23!
SystemOrganization addCategory: #'Tools-AdvancedDebugger'!
SystemOrganization addCategory: #'Tools-AdvancedDebugger-UI'!
SystemOrganization addCategory: 'Tools-AdvancedDebugger-UI-Core'!
Expand Down Expand Up @@ -98,7 +98,7 @@ WatchExpressionEditorWindow class

!classDefinition: #WatchExpressionEditorMorph category: #'Tools-AdvancedDebugger-UI'!
WidgetMorph subclass: #WatchExpressionEditorMorph
instanceVariableNames: 'watchExpressionEditor layoutMorph resultLabel acceptAction cancelAction nameInput showNameAndActionButtons'
instanceVariableNames: 'watchExpressionEditor layoutMorph resultLabel acceptAction cancelAction nameInput showNameAndActionButtons contextStatusLabel'
classVariableNames: ''
poolDictionaries: ''
category: 'Tools-AdvancedDebugger-UI'!
Expand Down Expand Up @@ -938,6 +938,16 @@ buildCancelButton
action: #cancelContents
label: 'Cancel'! !

!WatchExpressionEditorMorph methodsFor: 'GUI building' stamp: 'NPM 3/3/2022 10:15:54'!
buildContextStatusLabel

contextStatusLabel _ LabelMorph contents: ''.

layoutMorph
addMorphKeepMorphHeight: (self buildHeader: 'Context status');
addMorph: contextStatusLabel fixedHeight: self defaultButtonPaneHeight
! !

!WatchExpressionEditorMorph methodsFor: 'GUI building' stamp: 'NPM 2/22/2022 02:30:57'!
buildExpressionInput

Expand Down Expand Up @@ -994,16 +1004,19 @@ buildResultPanel

! !

!WatchExpressionEditorMorph methodsFor: 'GUI building' stamp: 'NPM 2/22/2022 02:47:46'!
!WatchExpressionEditorMorph methodsFor: 'GUI building' stamp: 'NPM 3/3/2022 10:34:40'!
buildSubmorphs

self
buildLayout;
buildNameInput;
buildContextStatusLabel;
buildExpressionInput;
buildResultPanel;
buildActionButtons.
watchExpressionEditor whenExpressionIsAcceptedSend: #accept to: self. ! !

watchExpressionEditor
whenExpressionIsAcceptedSend: #accept to: self. ! !

!WatchExpressionEditorMorph methodsFor: 'GUI building' stamp: 'NPM 2/17/2022 01:52:36'!
defaultButtonPaneHeight
Expand Down Expand Up @@ -1042,18 +1055,13 @@ layoutSubmorphs

layoutMorph morphPosition: 0@0 extent: self morphExtent! !

!WatchExpressionEditorMorph methodsFor: 'stepping' stamp: 'NPM 2/22/2022 02:01:49'!
!WatchExpressionEditorMorph methodsFor: 'stepping' stamp: 'NPM 3/3/2022 10:25:37'!
stepAt: millisecondSinceLast

| result |
result _ [
[ watchExpressionEditor actualWatchExpression value displayStringOrText ]
valueWithin: 500 milliSeconds
onTimeout: [ 'evaluation timed out' ] ]
on: Error
do: [ 'evaluation failed' ].

resultLabel contents: result
self
updateContextStatus;
updateResult


! !

Expand All @@ -1067,6 +1075,29 @@ wantsSteps

^ true! !

!WatchExpressionEditorMorph methodsFor: 'updating' stamp: 'NPM 3/3/2022 10:25:11'!
updateContextStatus

| contextStatus |
contextStatus _ watchExpressionEditor actualWatchExpression isContextExecuting
ifTrue: [ 'Executing' ] ifFalse: [ 'Terminated' ].

contextStatusLabel contents: contextStatus.
! !

!WatchExpressionEditorMorph methodsFor: 'updating' stamp: 'NPM 3/3/2022 10:25:45'!
updateResult

| result |
result _ [
[ watchExpressionEditor actualWatchExpression value displayStringOrText ]
valueWithin: 500 milliSeconds
onTimeout: [ 'evaluation timed out' ] ]
on: Error
do: [ 'evaluation failed' ].

resultLabel contents: result! !

!WatchExpressionEditorMorph class methodsFor: 'instance creation' stamp: 'NPM 2/22/2022 02:38:33'!
model: aWatchExpressionEditor showNameAndActionButtons: aBoolean

Expand Down Expand Up @@ -2101,6 +2132,14 @@ kind

^ 'Watch expression'! !

!WatchExpression methodsFor: 'copying' stamp: 'NPM 2/16/2022 00:52:39'!
copy

^ self class
named: name
toEvaluate: expression
in: context! !

!WatchExpression methodsFor: 'editing' stamp: 'NPM 1/7/2022 17:41:25'!
changeExpressionTo: anExpression

Expand Down Expand Up @@ -2194,6 +2233,11 @@ initializeNamed: aName toEvaluate: anExpressionBlock in: aContext

self changeExpressionTo: anExpressionBlock ! !

!WatchExpression methodsFor: 'testing' stamp: 'NPM 3/3/2022 10:25:11'!
isContextExecuting

^ context isDead not! !

!WatchExpression methodsFor: 'testing' stamp: 'NPM 1/7/2022 17:51:18'!
renameTo: newName

Expand All @@ -2205,14 +2249,6 @@ renameTo: newName

! !

!WatchExpression methodsFor: 'as yet unclassified' stamp: 'NPM 2/16/2022 00:52:39'!
copy

^ self class
named: name
toEvaluate: expression
in: context! !

!WatchExpression class methodsFor: 'instance creation' stamp: 'NPM 1/5/2022 17:59:51'!
named: aName toEvaluate: anExpressionBlock in: aContext

Expand Down

0 comments on commit 4da36b8

Please sign in to comment.