Le 21/05/2012 16:34, Ted F.A. van Gaalen a écrit :
... it does (of course) only get the BlockCannotReturn error when attempting to re-format unchanged code
Yes, it was that. Now, no suggestions about putting it somewhere else in the menu ? I'm not yet too familiar with the GUI architecture of Pharo to find of a nice way to put it in the top-level menu and link it to a keyboard shortcut. Thierry
removed the return from
(aBuilder item: #'Format') action: [ | source tree formatted morph | morph := target sourceTextArea. source := morph text asString. tree := RBParser parseMethod: source onError: [ :msg :pos | ^ target ]. formatted := tree formattedCode. formatted = source ifFalse: [ morph editString: formatted; hasUnacceptedEdits: true] "<-= here" ]; parent: #'Source code refactoring';
works ok now, however not really tested..
ted
On 21.05.2012 16:11, Ted F.A. van Gaalen wrote:
C'est merveilleux, merci Thierry!
plugged it in, At first sight, it works OK in Pharo1.4 Latest update #14437
indeed, a bit nested in the menutree
Why can't I return ^ from a block it just did, e.g. does it leave problems e.g. uncollectable garbage?
Thanks Ted (floating (sinking?) in unemployment, web design, php (jikes!) typo3, Smalltalk Seaside, any IT, nevertheless having fun)
ted van gaalen *it* services
www.tedvg.com <http://www.tedvg.com/>
Ted F.A. van Gaalen Hauptstr.19/3 D-88636 Illmensee Germany T: +49 7558 92 17 840 M: +49 151 587 86 247
On 21.05.2012 14:50, Goubier Thierry wrote:
Le 21/05/2012 14:42, Stéphane Ducasse a écrit :
cool we should add it :)
Beware: I think I left a mistake in there, here :
formatted = source ifTrue: [ ^ self].
Probably fails since can't return from block ?
And I believe it needs two suggestions : * A shortcut (because I really liked doing Cmd+r Cmd+s in Pharo 1.3, but Cmd+r does sometimes something else now, such as rename method) * And maybe a better place (it appears in the refactoring submenu, not the main edit menu).
Thierry
On May 21, 2012, at 11:09 AM, Goubier Thierry wrote:
Le 18/05/2012 01:01, Ted F.A. van Gaalen a écrit :
Pharo 1.4 Nautilus can't find source code auto format option. also not in the settings browser but maybe I haven't been looking good enough.. anyone? thanks Ted
I added it myself because I like that functionality. But I still loose the Cmd+r shortcut, since it's used for something else.
in NautilusRefactoring class>> sourceCodeRefactoringMenu:
(aBuilder item: #'Format') action: [ | source tree formatted morph | morph := target sourceTextArea. source := morph text asString. tree := RBParser parseMethod: source onError: [ :msg :pos | ^ target ]. formatted := tree formattedCode. formatted = source ifTrue: [ ^ self]. morph editString: formatted; hasUnacceptedEdits: true ]; parent: #'Source code refactoring'; order: 50.
Thierry -- Thierry Goubier CEA list Laboratoire des Fondations des Systèmes Temps Réel Embarqués 91191 Gif sur Yvette Cedex France Phone/Fax: +33 (0) 1 69 08 32 92 / 83 95
-- Thierry Goubier CEA list Laboratoire des Fondations des Systèmes Temps Réel Embarqués 91191 Gif sur Yvette Cedex France Phone/Fax: +33 (0) 1 69 08 32 92 / 83 95