How to point SqueakMap to SqueakSource

Andrew Tween amtween at hotmail.com
Thu Apr 29 00:51:44 UTC 2004


Thanks for your kind comments Avi.

It depends upon what you mean by 'doing indentations'.
Initial indentation (i.e. formatting of a method when it is first
displayed), that's easy.
If you like the formatting of pretty print, then you can make the method
appear pretty printed when it is first selected by changing this method
to....

    Browser>>stylerAboutToStyle:

    stylerAboutToStyle: aTextStyler
         "set up the compilation class in aTextStyler.
         Answer true if styling should go ahead, false otherwise"
         | type |

     Preferences syntaxHighlightingAsYouType ifFalse: [^false].
     (self showingSource | self showingPrettyPrint)
          ifFalse: [^false].
     type := self editSelection.
     (#(newMessage editMessage editClass newClass) includes: type)
ifFalse:[^false].
     aTextStyler classOrMetaClass: (type = #editClass ifFalse:[self
selectedClassOrMetaClass]).
     ^true

The method will apear pretty printing, and then it will be coloured by
Shout.
(There are other #stylerAboutToStyle: implementors so have a look for them
as well)

It is also possible to make Shout work for 'decompile' mode by making the
test :-
        (self showingSource | self showingPrettyPrint | self
showingDecompile)

Alternatively, you may want to implement your own formatting style.
This is also possible.
Look at the SHTextStylerST80 class, it has a #basicFormat: method.
At present, this method does nothing more than parse the method source and
change assignments into ansi, or left arrow, according to the preferences.
But it could easily perform any formatting that you desired.

The third possibility is that you want indentation to be applied as you
type.
This should be happening already, i.e. indentation should be inserted after
a Carriage return.
Anything more complex than that might be difficult. That kind of formatting
needs to be done immediately after each keystroke.
Shout performs its work in a background process (so that typing is not
slowed down for large methods/workspaces).
Bu, if the formatting could be calculated quickly enough, then it sounds
possible.

Or, maybe, you were thinking of something else?
Cheers,
Andy

----- Original Message ----- 
From: "Avi Bryant" <avi at beta4.com>
To: "The general-purpose Squeak developers list"
<squeak-dev at lists.squeakfoundation.org>
Sent: Thursday, April 29, 2004 12:54 AM
Subject: Re: How to point SqueakMap to SqueakSource


>
> On Apr 28, 2004, at 4:44 PM, Andrew Tween wrote:
>
> > I have created a project on SqueakSource (Shout).
>
> I just tried Shout, and it's very cool.  Nice work.  How hard would it
> be to adapt so that it did indentation as well as styling?
>
> Avi
>
>
>


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.667 / Virus Database: 429 - Release Date: 26/04/2004



More information about the Squeak-dev mailing list