From d24d66ff099d24cca87e0ec9f7046926c6472981 Mon Sep 17 00:00:00 2001 From: Eric Winger Date: Tue, 21 Aug 2018 12:06:14 -0700 Subject: [PATCH] Partial fix for #62. Save method in debugger Seems to save the method but doesn't resent the code pane to the right step point yet. --- sources/RowanDebugger.cls | 101 ++++++++++++++++++++++---------- sources/RowanProcessService.cls | 4 ++ 2 files changed, 75 insertions(+), 30 deletions(-) diff --git a/sources/RowanDebugger.cls b/sources/RowanDebugger.cls index f2a72297..22b8a90e 100755 --- a/sources/RowanDebugger.cls +++ b/sources/RowanDebugger.cls @@ -53,12 +53,44 @@ browseSenders yourself. ! +compilationWarningFrom: methodServices + + methodServices do:[:methodService | + methodService compilationWarnings ifNotNil:[:warning | ^warning]]. + ^nil! + createSchematicWiring super createSchematicWiring. frameListPresenter when: #actionPerformed send: #browseClass to: self. ! +currentMethodSourceFrom: sourceString + + | source fromStream writeStream | + fromStream := ReadStream on: sourceString. + writeStream := WriteStream on: String new. + [ + fromStream atEnd not. + ] whileTrue: [ + | char | + (char := fromStream next) == Character cr ifTrue: [ + fromStream peek ~~ Character lf ifTrue: [ + writeStream nextPut: Character lf. + ]. + ] ifFalse: [ + writeStream nextPut: char. + ]. + ]. + source := writeStream contents. + [ + source last codePoint <= 32. + ] whileTrue: [ + source := source copyFrom: 1 to: source size - 1. + ]. + ^source. +! + documentPresenter ^documentPresenter! @@ -74,7 +106,6 @@ getProcessList self updateServices: (Array with: (RowanDebuggerService onProcess: gsProcess)).! - issueCommand: services | stonString stonResultString | services do:[:service | service prepareForReplication]. @@ -92,7 +123,6 @@ methodListSelection self updateServices: (Array with: methodService). ^methodService! - methodSourcePresenter ^codePane! @@ -167,41 +197,50 @@ registerPresentersForUpdates selector: #processListUpdate: ! -saveMethod +reportCompileError: anArrayOfArray in: methodSourcePresenter + + | source position stream string indicators | + indicators := OrderedCollection new. + methodSourcePresenter view clearContainerIndicators. + source := (self currentMethodSourceFrom: methodSourcePresenter value) , Character lf asString. + position := methodSourcePresenter view caretPosition. + methodSourcePresenter value: source. + methodSourcePresenter view caretPosition: position. + stream := WriteStream on: String new. + anArrayOfArray do: [:eachArray | + | start | + start := eachArray at: 2. + string := eachArray at: 3. + stream nextPutAll: string , '; '. + indicators add: (ScintillaIndicator + styleName: 10 + range: (start to: (start + 10 min: source size)) + tag: string). + ]. + methodSourcePresenter view backcolor: JadeTextStyles default colorForCompileError. + methodSourcePresenter view indicators: indicators. + string := stream contents. + self statusBarText: (string copyFrom: 1 to: string size - 2).! - | classService result string | +saveMethod + | classService string | string := self getDocumentData reject: [:each | each == Character cr]. classService := RowanClassService new - name: frame method className; - meta: frame method meta; - yourself. + name: frame method className; + meta: frame method meta; + yourself. classService command: #saveMethodSource:category:; commandArgs: (Array with: string with: frame method category). -self error: 'waiting on answer in https://github.com/ericwinger/Jade/issues/62'. [self issueCommand: (Array with: classService)] on: GsCompileError do: [:ex | ^self reportCompileError: ex list in: nil]. (self compilationWarningFrom: classService selectedMethods) - ifNotNil: [:warning | self statusBarText: warning] -" -self halt. - result := gciSession - serverPerform: #'compile:frame:process:' - with: (self getDocumentData reject: [:each | each == Character cr]) - with: frameListPresenter selectionByIndex + frameListOffset - with: gsProcess. - (result isKindOf: Boolean) ifTrue: [ - result ifTrue: [ - documentPresenter isModified: false. - gsProcess trimStackToLevel: frameListPresenter selectionByIndex + frameListOffset. - ^self update. - ] ifFalse: [ - MessageBox notify: 'New method has different selector so will not be on stack!!'. - ^self selectedFrame. - ]. - ]. - MessageBox notify: result. -"! + ifNotNil: [:warning |MessageBox notify: warning]. + documentPresenter isModified: false. + (gsProcess gsProcessForSession: gciSession) + trimStackToLevel: frameListPresenter selectionByIndex + frameListOffset. + ^self update +! selectedFrame @@ -280,14 +319,15 @@ variableDataPresenter variableListPresenter ^variableListPresenter! ! - !RowanDebugger categoriesFor: #_terminateProcess:!public! ! !RowanDebugger categoriesFor: #basicSelectedFrame!public! ! !RowanDebugger categoriesFor: #browseFrameMethod!public! ! !RowanDebugger categoriesFor: #browseImplementors!public! ! !RowanDebugger categoriesFor: #browseObjectClass!public! ! !RowanDebugger categoriesFor: #browseSenders!public! ! +!RowanDebugger categoriesFor: #compilationWarningFrom:!compiling!public! ! !RowanDebugger categoriesFor: #createSchematicWiring!public! ! +!RowanDebugger categoriesFor: #currentMethodSourceFrom:!compiling!public! ! !RowanDebugger categoriesFor: #documentPresenter!Accessing!public! ! !RowanDebugger categoriesFor: #errorMessagePresenter!Accessing!public! ! !RowanDebugger categoriesFor: #frameListPresenter!Accessing!public! ! @@ -301,7 +341,8 @@ variableListPresenter !RowanDebugger categoriesFor: #processListPresenter!Accessing!public! ! !RowanDebugger categoriesFor: #queryCommand:!public! ! !RowanDebugger categoriesFor: #registerPresentersForUpdates!public! ! -!RowanDebugger categoriesFor: #saveMethod!public! ! +!RowanDebugger categoriesFor: #reportCompileError:in:!compiling!public! ! +!RowanDebugger categoriesFor: #saveMethod!compiling!public! ! !RowanDebugger categoriesFor: #selectedFrame!public! ! !RowanDebugger categoriesFor: #stepInto!public! ! !RowanDebugger categoriesFor: #stepOut!public! ! diff --git a/sources/RowanProcessService.cls b/sources/RowanProcessService.cls index d5739635..5a40648d 100755 --- a/sources/RowanProcessService.cls +++ b/sources/RowanProcessService.cls @@ -14,6 +14,9 @@ frameForLevel: anInteger ^frames at: anInteger! +gsProcessForSession: session + ^GsProcess session: session oopType: self oopType! + oop ^oop! @@ -26,6 +29,7 @@ stack ^frames collect: [:each | each printString]! ! !RowanProcessService categoriesFor: #frameForLevel:!public! ! +!RowanProcessService categoriesFor: #gsProcessForSession:!public! ! !RowanProcessService categoriesFor: #oop!public! ! !RowanProcessService categoriesFor: #oopType!public! ! !RowanProcessService categoriesFor: #stack!public! !