I was wondering if Squeak has some automatic indentation function to make codes in disorder become clean and well-indented in a flash, just like what we can do in VIM and MS VISUAL STUDIO.
----- Dig, dig where you are, Down below's well. Let those that walk in darkness shout, Down below's hell. -- Sent from: http://forum.world.st/Squeak-Beginners-f107673.html
Away from my computer, but search for prettyPrint. On Tue, Nov 7, 2017 at 2:20 AM RedTigerFish chihuyu@gmail.com wrote:
I was wondering if Squeak has some automatic indentation function to make codes in disorder become clean and well-indented in a flash, just like what we can do in VIM and MS VISUAL STUDIO.
Dig, dig where you are, Down below's well. Let those that walk in darkness shout, Down below's hell. -- Sent from: http://forum.world.st/Squeak-Beginners-f107673.html _______________________________________________ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
I choose the block of codes which I want indented > right click > more > pretty print.
Nothing happens. Why?
----- Dig, dig where you are, Down below's well. Let those that walk in darkness shout, Down below's hell. -- Sent from: http://forum.world.st/Squeak-Beginners-f107673.html
You don't need to select the code you wish to format, it formats the entire method.
If it is already formatted, pretty print it will appear to have no effect other than making the method dirty (changed).
Not sure what version of Squeak you're using, but there is also a hot-key which invokes the pretty print function in the code pane: Shift+Command+S
On Tue, Nov 7, 2017 at 4:01 PM, RedTigerFish chihuyu@gmail.com wrote:
I choose the block of codes which I want indented > right click > more > pretty print.
Nothing happens. Why?
Dig, dig where you are, Down below's well. Let those that walk in darkness shout, Down below's hell. -- Sent from: http://forum.world.st/Squeak-Beginners-f107673.html _______________________________________________ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
*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.
----- Dig, dig where you are, Down below's well. Let those that walk in darkness shout, Down below's hell. -- Sent from: http://forum.world.st/Squeak-Beginners-f107673.html
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
beginners@lists.squeakfoundation.org