Override behavior of VW's formatter (in the editor)?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Override behavior of VW's formatter (in the editor)?

Rick Flower
Happy Friday to all of you.. (or Saturday?)

Anyway, I was wondering if there's a way to influence the behavior of
the 'Format' function (under Edit) that is part of the system browser to
change things like :

   o where brackets go (wrapped to next line or not), also where closing
     brackets are placed -- they currently like to hang on the end of the
     line which is harder to follow for very nested code blocks

   o tabs vs. spaces (the old debate!).. I personally like spaces
     (currently I'm using 3 spaces for 1 tab).  This usually doesn't
     bother me much, but for very nested blocks, it makes for some REALLY
     wide lines (lots of indenting).

   o control over wrapping short messages or leave them on the line with
     other messages.  It seems to like to do lines like the ones shown
     below which are OK if each message is long, but for short ones I'd
     prefer to put multiple messages on the same line --  :

        (html textInput)
            tabindex: aTabIndex get;
            value: aValue;
            callback: [ ... ]

        vs.
        (html textInput) tabindex: aTabIndex get; value: aValue;
            callback: [ ... ]

There's probably other little things that I can't remember, but the
above ones are the ones that are biggest for me personally.. I guess I
get some of this from my background doing C/C++ where everyone has
different personal tastes and opinions about how to format source code.
  Perhaps this is not much of an issue for ST'ers?

Reply | Threaded
Open this post in threaded view
|

Re: Override behavior of VW's formatter (in the editor)?

Holger Kleinsorgen-4
Rick Flower wrote:
> Happy Friday to all of you.. (or Saturday?)
>
> Anyway, I was wondering if there's a way to influence the behavior of
> the 'Format' function (under Edit) that is part of the system browser to
> change things like :

Have a look at class RBFormatter. You can create a subclass and modify
its behavior to suit your needs. The formatter is then installed by
sending "RBProgramNode formatterClass: MyRBFormatter."

methods of interest:

#indent (the tab thingy)

#formatMessage:cascade: / #startMessageSendOnNewLine: (single vs multi line)

#acceptBlockNode: (blocks)

Reply | Threaded
Open this post in threaded view
|

Re: Override behavior of VW's formatter (in the editor)?

Karsten Kusche
In reply to this post by Rick Flower
hi,

try this in a workspace:

Refactory.Browser.FormatterConfigurationTool open

good luck playing around with the format-settings :-)

Karsten




Rick Flower wrote:

> Happy Friday to all of you.. (or Saturday?)
>
> Anyway, I was wondering if there's a way to influence the behavior of
> the 'Format' function (under Edit) that is part of the system browser
> to change things like :
>
>   o where brackets go (wrapped to next line or not), also where closing
>     brackets are placed -- they currently like to hang on the end of the
>     line which is harder to follow for very nested code blocks
>
>   o tabs vs. spaces (the old debate!).. I personally like spaces
>     (currently I'm using 3 spaces for 1 tab).  This usually doesn't
>     bother me much, but for very nested blocks, it makes for some REALLY
>     wide lines (lots of indenting).
>
>   o control over wrapping short messages or leave them on the line with
>     other messages.  It seems to like to do lines like the ones shown
>     below which are OK if each message is long, but for short ones I'd
>     prefer to put multiple messages on the same line --  :
>
>        (html textInput)
>            tabindex: aTabIndex get;
>            value: aValue;
>            callback: [ ... ]
>
>        vs.
>        (html textInput) tabindex: aTabIndex get; value: aValue;
>            callback: [ ... ]
>
> There's probably other little things that I can't remember, but the
> above ones are the ones that are biggest for me personally.. I guess I
> get some of this from my background doing C/C++ where everyone has
> different personal tastes and opinions about how to format source
> code.  Perhaps this is not much of an issue for ST'ers?
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Override behavior of VW's formatter (in the editor)?

Runar Jordahl
In reply to this post by Rick Flower
>   o where brackets go (wrapped to next line or not), also where closing
>     brackets are placed -- they currently like to hang on the end of the
>     line which is harder to follow for very nested code blocks
I do not think that moving end brackets down a line improve
readabillity. Keep metohds short and you do not face this problem...
:-) Note that you can double-click at the start (or end) of brackets
to have the full block highlighted.

>   o tabs vs. spaces (the old debate!).. I personally like spaces
>     (currently I'm using 3 spaces for 1 tab).  This usually doesn't
>     bother me much, but for very nested blocks, it makes for some REALLY
>     wide lines (lots of indenting).
I think this can be changed in the settings. See other responses.

>   o control over wrapping short messages or leave them on the line with
>     other messages.  It seems to like to do lines like the ones shown
>     below which are OK if each message is long, but for short ones I'd
>     prefer to put multiple messages on the same line --  :
I made a formatter myself some time ago. The details can be found
here: http://www.cincomsmalltalk.com/userblogs/runarj/blogView?showComments=true&entry=3272276801.
This formatter will do precisely what you want.

Kind regards
Runar Jordahl

Reply | Threaded
Open this post in threaded view
|

Re: Override behavior of VW's formatter (in the editor)?

Diane Savereide


>>   o where brackets go (wrapped to next line or not), also where closing
>>     brackets are placed -- they currently like to hang on the end of the
>>     line which is harder to follow for very nested code blocks
> I do not think that moving end brackets down a line improve
> readabillity. Keep metohds short and you do not face this problem...

I do. Once you get used to seeing your blocks line up, it's impossible to go
back to having them hanging.

> :-) Note that you can double-click at the start (or end) of brackets to
> have the full block highlighted.

Every time you double click on a block to see the contents, you are
illustrating a problem with the formatting. When they line up, you only need
to glance.

Reply | Threaded
Open this post in threaded view
|

Re: Override behavior of VW's formatter (in the editor)?

Rick Flower
Diane Savereide wrote:

>
>
>>>   o where brackets go (wrapped to next line or not), also where closing
>>>     brackets are placed -- they currently like to hang on the end of the
>>>     line which is harder to follow for very nested code blocks
>> I do not think that moving end brackets down a line improve
>> readabillity. Keep metohds short and you do not face this problem...
>
> I do. Once you get used to seeing your blocks line up, it's impossible
> to go back to having them hanging.
>
>> :-) Note that you can double-click at the start (or end) of brackets
>> to have the full block highlighted.
>
> Every time you double click on a block to see the contents, you are
> illustrating a problem with the formatting. When they line up, you only
> need to glance.
>

Thanks everyone.. I was able to use bring up the formatter panel that
Karsten indicated and it looks like it will do more of what I'm after--
albeit with a bit of tweaking!  Thanks!


Reply | Threaded
Open this post in threaded view
|

Re: Override behavior of VW's formatter (in the editor)?

Rick Flower
In reply to this post by Karsten Kusche
Karsten Kusche wrote:
> hi,
>
> try this in a workspace:
>
> Refactory.Browser.FormatterConfigurationTool open

Karsten --

Since you suggested this to me, I've got a few more questions I'd like
to ask if I could (not sure if you've got any answers though!) :

   o Is there a way to control the amount (or lack thereof) of indents
     between a message and the start of a block?  In the example below,
     I've got the indent set to 3 spaces and would like to not have so
     much indenting after the "table:" and the start of the block --
     right now it seems somewhat unchangeable using the GUI from what I
     can tell -- I've fiddled with all of the settings and nothing seems
     to control that one.

    === Below is what the formatter is capable of doing...
    html table:
          [
          html tableRow:
                [

    === Below is what I'd like to be able to do...
    html table:
    [
       html tableRow:
       [



    o Is there a way to export my settings out to an XML file for later
      re-importing when working with a new image?  That would be a great
      feature to have since I nuke images once in a while and would not
      want to always re-do these settings.

Thanks!

-- Rick

Reply | Threaded
Open this post in threaded view
|

Re: Override behavior of VW's formatter (in the editor)?

Karsten Kusche
Hi Rick,

unfortunately i never really used that tool, i only ran into it some
time ago and remembered it.
I guess everything is stored in RBConfigurableFormatter in shared
variables. i donno if there's a tool for writing that out into a file,
but i guess not.
as for the other formating questions i have no idea, sorry.

good luck
Karsten


Rick Flower wrote:

> Karsten Kusche wrote:
>> hi,
>>
>> try this in a workspace:
>>
>> Refactory.Browser.FormatterConfigurationTool open
>
> Karsten --
>
> Since you suggested this to me, I've got a few more questions I'd like
> to ask if I could (not sure if you've got any answers though!) :
>
>   o Is there a way to control the amount (or lack thereof) of indents
>     between a message and the start of a block?  In the example below,
>     I've got the indent set to 3 spaces and would like to not have so
>     much indenting after the "table:" and the start of the block --
>     right now it seems somewhat unchangeable using the GUI from what I
>     can tell -- I've fiddled with all of the settings and nothing seems
>     to control that one.
>
>    === Below is what the formatter is capable of doing...
>    html table:
>          [
>          html tableRow:
>                [
>
>    === Below is what I'd like to be able to do...
>    html table:
>    [
>       html tableRow:
>       [
>
>
>
>    o Is there a way to export my settings out to an XML file for later
>      re-importing when working with a new image?  That would be a great
>      feature to have since I nuke images once in a while and would not
>      want to always re-do these settings.
>
> Thanks!
>
> -- Rick
>
>

Reply | Threaded
Open this post in threaded view
|

Restarting an image automatically

Carl Gundel
In reply to this post by Rick Flower
What would be the simplest way for an image to launch a fresh copy of itself
and then quit?  I'm thinking of doing this once or twice a day.  A process
would look for quiet periods and invoke a restart just to keep my Seaside
application fresh.  The running image should be able to know its own image
filename and relaunch itself.

-Carl Gundel, author of Liberty BASIC
http://www.libertybasic.com



Reply | Threaded
Open this post in threaded view
|

Re: Restarting an image automatically

Dennis smith-4
Here is the code we use ...


restartAndExit
    | cmd |
    cmd := CEnvironment commandLine inject: '' into: [:s :x |
                    | str |
                    str := '"' , x , '"'.
                    s isNull ifTrue: [str] ifFalse: [s , ' ' , str]].

    WinNTSystemSupport CreateProcess: nil arguments: cmd.

    ObjectMemory quit

If you are unix instead of windows, you will have to replace the
"WinNTSystemSupport" line.


Carl Gundel wrote:

> What would be the simplest way for an image to launch a fresh copy of
> itself and then quit?  I'm thinking of doing this once or twice a
> day.  A process would look for quiet periods and invoke a restart just
> to keep my Seaside application fresh.  The running image should be
> able to know its own image filename and relaunch itself.
>
> -Carl Gundel, author of Liberty BASIC
> http://www.libertybasic.com
>
>
>

--
Dennis Smith                       [hidden email]
Cherniak Software                               +1 905.771.7011
400-10 Commerce Valley Dr E                Fax: +1 905.771.6288
Thornhill, ON Canada L3T 7N7    http://www.CherniakSoftware.com

new offices as of January 22, 2007:

2001 Sheppard Avenue East                          416.798.7948
Suite 509                                  Fax:    416-798-0948
Toronto, Ontario, M2J 4Z8

entrance off Yorkland Boulevard
just south of Sheppard just east of the Don Valley Parkway

(phone numbers to be confirmed)

Reply | Threaded
Open this post in threaded view
|

Show window contents while dragging?

Carl Gundel
In reply to this post by Rick Flower
When running under XP VisualWorks does not update the window contents while
dragging, but it works (if a little sluggish) under Linux.  Is there any way
to make this work for Windows also?

-Carl Gundel, author of Liberty BASIC
http://www.libertybasic.com 


Reply | Threaded
Open this post in threaded view
|

Re: Show window contents while dragging?

Carl Gundel
> When running under XP VisualWorks does not update the window contents
> while dragging, but it works (if a little sluggish) under Linux.  Is there
> any way to make this work for Windows also?

I guess the answer is no then?  What prevents it from working with Windows?

-Carl Gundel
http://www.libertybasic.com 


Reply | Threaded
Open this post in threaded view
|

RE: Show window contents while dragging?

Boris Popov, DeepCove Labs (SNN)
Hack(ish) workaround,

http://www.parcplace.net/list/vwnc-archive/0305/msg00089.html

Long thread about the problem, context and possible long-term solutions,
this is one of many times this issue has been revisited on the list, by
the way,

http://www.parcplace.net/list/vwnc-archive/0512/msg00067.html

Cheers!

-Boris

--
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5
http://tinyurl.com/r7uw4

[hidden email]

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message
header. Unless otherwise indicated, it contains information that is
private and confidential. If you have received it in error, please
notify the sender and delete the entire message including any
attachments.

Thank you.

> -----Original Message-----
> From: Carl Gundel [mailto:[hidden email]]
> Sent: Tuesday, March 27, 2007 2:04 PM
> To: VisualWorks Mailing List
> Subject: Re: Show window contents while dragging?
>
> > When running under XP VisualWorks does not update the window
contents

> > while dragging, but it works (if a little sluggish) under Linux.  Is
> there
> > any way to make this work for Windows also?
>
> I guess the answer is no then?  What prevents it from working with
> Windows?
>
> -Carl Gundel
> http://www.libertybasic.com
>

Reply | Threaded
Open this post in threaded view
|

Re: Show window contents while dragging?

Carl Gundel
Thanks Boris.


>Hack(ish) workaround,
>
>http://www.parcplace.net/list/vwnc-archive/0305/msg00089.html
>
>Long thread about the problem, context and possible long-term solutions,
>this is one of many times this issue has been revisited on the list, by
>the way,
>
>http://www.parcplace.net/list/vwnc-archive/0512/msg00067.html

> > When running under XP VisualWorks does not update the window
contents

> > while dragging, but it works (if a little sluggish) under Linux.  Is
> there
> > any way to make this work for Windows also?
>
> I guess the answer is no then?  What prevents it from working with
> Windows?
>
> -Carl Gundel
> http://www.libertybasic.com
>