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

Reply via email to