[Newbies] How can Smalltalk codes in Squeak be automatically indented ?

David T. Lewis lewis at mail.msen.com
Fri Nov 10 13:29:54 UTC 2017


On Thu, Nov 09, 2017 at 11:21:35PM -0700, RedTigerFish wrote:
> *1 to: 9 do: [ :i |
>     1 to: i do: [ :j |
>         Transcript
>             show: ('{1} * {2} = {3}' format: {j. i. j * i});
>             show: ' '
>     ].
>     Transcript show: ' '; cr.
> ].*
> 
> The above is well-indented codes. Then I intentionally add more spaces, like
> this
> *1 to: 9 do: [ :i |
>              1 to: i do: [ :j |
>     Transcript
>                  show: ('{1} * {2} = {3}	' format: {j. i. j * i});
>                     show: ' '
>     ].
>             Transcript show: ' '; cr.
> ].*
> 
> 
> Then I use pretty print or pretty print with color, nothing happens.
> 
> I recorded a video to illustrate my issue. 
> 
>  <https://youtu.be/cB0N3L1Ou6w> *Video Link* 
> 
> I do not understand why "pretty print" does not indent anything.
>

Oh, I see now, the video makes your question clear :-)

You are working in a workspace, and the menu option "pretty print" is
doing nothing for your selected code in the workspace.

Indeed, this does seem like a bug, because if pretty printing does not
work in a workspace selection, we should not be presenting the option
in a menu.

I do not know if it would be a good idea to have pretty print for
workspace selections (it is not something that I would think to use),
but either way the menu options should agree with the actual behavior.

Dave
 


More information about the Beginners mailing list