autocomplete in gst REPL

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

autocomplete in gst REPL

Stefan Schmiedl
While I tried out Nico's sample code, I noticed that
the tab-auto-complete in gst's REPL is not as all-knowing
as it could be:

st> error sign<TAB>
signal:               signalOn:             signalWithArguments:
signalClass:          signalWith:           signed:

although error signalingContext is defined in my gst.

Bug or feature?

s.


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: autocomplete in gst REPL

Paolo Bonzini-3
On 07/02/2009 08:34 PM, Stefan Schmiedl wrote:

> While I tried out Nico's sample code, I noticed that
> the tab-auto-complete in gst's REPL is not as all-knowing
> as it could be:
>
> st>  error sign<TAB>
> signal:               signalOn:             signalWithArguments:
> signalClass:          signalWith:           signed:
>
> although error signalingContext is defined in my gst.
>
> Bug or feature?

Half-half.  The completion list is built from the symbol table, which
includes both variables and methods.  Including all methods including
unary methods would have meant having variables too in the completion
list.  I can change it if people prefer so.

Paolo


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: autocomplete in gst REPL

Stefan Schmiedl
On Thu, 02 Jul 2009 22:15:32 +0200
Paolo Bonzini <[hidden email]> wrote:

> On 07/02/2009 08:34 PM, Stefan Schmiedl wrote:
> > While I tried out Nico's sample code, I noticed that
> > the tab-auto-complete in gst's REPL is not as all-knowing
> > as it could be:
> >
> > st>  error sign<TAB>
> > signal:               signalOn:             signalWithArguments:
> > signalClass:          signalWith:           signed:
> >
> > although error signalingContext is defined in my gst.
> >
> > Bug or feature?
>
> Half-half.  The completion list is built from the symbol table, which
> includes both variables and methods.  Including all methods including
> unary methods would have meant having variables too in the completion
> list.  I can change it if people prefer so.

Why do I use autocompletion?
- because I'm spoiled by bash's and vim's completion features
- because I can't remember how exactly something is spelled

In these cases, including all would make sense. Also as a non-intrusive
learning aid ... to this day I do not know whether ObjectMemory has
a method snapshot (for overwriting the image file), because whenever
I typed, snapshot: appeared and I obviously can't be bothered to look
for it. Were all symbols included I'd be much smarter .-)

I also noted that each part of multi-keyword messages is suggested
regardless of whether it is available.

st> Object extend [ abc: abc def: def ghi: ghi [] ]
st> 9 gh<TAB>
st> 9 ghi:

While catching that seems to be non-trivial for me, as the line editor
would have to learn about gst, would it be possible (and desirable)
to suggest multi-keyword messages as one item?

st> 9 abc:<TAB>
st> 9 abc:def:ghi:

Filling out that "template" would be easy enough, since Alt-b ends up
in exactly the right place to start typing.

Thanks,
s.

--
Stefan Schmiedl
EDV-Beratung Schmiedl, Berghangstr. 5, D-93413 Cham
im Büro: 09971 9966 989, am Handy: 0160 9981 6278


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: autocomplete in gst REPL

Nicolas Petton
In reply to this post by Paolo Bonzini-3
Le jeudi 02 juillet 2009 à 22:15 +0200, Paolo Bonzini a écrit :

> On 07/02/2009 08:34 PM, Stefan Schmiedl wrote:
> > While I tried out Nico's sample code, I noticed that
> > the tab-auto-complete in gst's REPL is not as all-knowing
> > as it could be:
> >
> > st>  error sign<TAB>
> > signal:               signalOn:             signalWithArguments:
> > signalClass:          signalWith:           signed:
> >
> > although error signalingContext is defined in my gst.
Ohhh, wait. Since when does gst's REPL have auto completion? I surely
missed something here :)

Nico

> >
> > Bug or feature?
>
> Half-half.  The completion list is built from the symbol table, which
> includes both variables and methods.  Including all methods including
> unary methods would have meant having variables too in the completion
> list.  I can change it if people prefer so.
>
> Paolo
>
>
> _______________________________________________
> help-smalltalk mailing list
> [hidden email]
> http://lists.gnu.org/mailman/listinfo/help-smalltalk

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk

signature.asc (204 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: autocomplete in gst REPL

kaveman
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: autocomplete in gst REPL

Paolo Bonzini-3
In reply to this post by Stefan Schmiedl

> In these cases, including all would make sense. Also as a non-intrusive
> learning aid ... to this day I do not know whether ObjectMemory has
> a method snapshot (for overwriting the image file), because whenever
> I typed, snapshot: appeared and I obviously can't be bothered to look
> for it. Were all symbols included I'd be much smarter .-)

Yes, I can do that.

> While catching that seems to be non-trivial for me, as the line editor
> would have to learn about gst,

Yes, exactly.  You would need to apply incremental parsing.


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: autocomplete in gst REPL

tumm
In reply to this post by Paolo Bonzini-3
i do a lot of teaching with GST smalltalk and the auto-completion is a
cool tool for making beginners more comfortable with the environment.
So, unless there is some bad memory or runtime hit, I'd vote that:

Dictionary at<TAB>

returns  (at least)

at:
at:put:

Just my $0.02 worth

Regards,
Tim Menzies

On Thu, Jul 2, 2009 at 4:15 PM, Paolo Bonzini<[hidden email]> wrote:

> On 07/02/2009 08:34 PM, Stefan Schmiedl wrote:
>>
>> While I tried out Nico's sample code, I noticed that
>> the tab-auto-complete in gst's REPL is not as all-knowing
>> as it could be:
>>
>> st>  error sign<TAB>
>> signal:               signalOn:             signalWithArguments:
>> signalClass:          signalWith:           signed:
>>
>> although error signalingContext is defined in my gst.
>>
>> Bug or feature?
>
> Half-half.  The completion list is built from the symbol table, which
> includes both variables and methods.  Including all methods including unary
> methods would have meant having variables too in the completion list.  I can
> change it if people prefer so.
>
> Paolo
>
>
> _______________________________________________
> help-smalltalk mailing list
> [hidden email]
> http://lists.gnu.org/mailman/listinfo/help-smalltalk
>



--
there are those who call me... (dr) timm?
morgantown (39.6n, -79w), usa
assoc prof csee, wvu
http://menzies.us

'Hydrogen is a light, odorless gas, which, given enough time, turns
into people.'


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: autocomplete in gst REPL

Stefan Schmiedl
On Thu, 2 Jul 2009 22:45:16 -0400
Tim Menzies <[hidden email]> wrote:

> i do a lot of teaching with GST smalltalk and the auto-completion is a
> cool tool for making beginners more comfortable with the environment.

Especially when they see their self-defined methods pop up in there :-)

> So, unless there is some bad memory or runtime hit, I'd vote that:
>
> Dictionary at<TAB>
>
> returns  (at least)
>
> at:
> at:put:

and since you bring it up, here is what I sent to Paolo late last night:

libgst/input.c

void
_gst_add_symbol_completion (const char *str,
                            int len)
{
  const char *base = str;
  const char *p = str;

  if (completions_enabled < 1)
    return;

  /* Everything goes in ... what can happen? */
  add_completion (str, len);
}

st> aDict at<TAB><TAB>  
at:                          atPutSubpart:
at:ifAbsent:                 atRandom
at:ifAbsentPut:              atSubpart:
at:ifPresent:                atSynonym:put:
at:noCObjectsPut:type:       atime
at:put:                      atimeSec
at:put:type:                 attr
at:splitAndPut:decrementBy:  attrArray
at:type:                     attributeAt:
atAll:                       attributeAt:ifAbsent:
atAll:put:                   attributes
atAllPut:                    attributesArray
atAllSynonyms:put:           attributesDo:
atEnd                        

st> aThing print<TAB><TAB>  
print                              printOn:indent:
print:                             printOn:line:
printAsAttributeOn:                printOn:special:
printByteCodesOn:                  printOn:tag:indent:
printCodePointOn:                  printString
printHeaderOn:                     printString:
printHierarchy                     printStringRadix:
printNl                            printSubclasses:using:
printOn:                           printXmlOn:collection:tag:indent:
printOn:base:                      printedFileName
printOn:in:                        

You'll have to back up into the suggestion though (alt-b comes
in handy).

s.


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: autocomplete in gst REPL

MrGwen
On Friday 03 July 2009 07:05:34 Stefan Schmiedl wrote:

> On Thu, 2 Jul 2009 22:45:16 -0400
>
> Tim Menzies <[hidden email]> wrote:
> > i do a lot of teaching with GST smalltalk and the auto-completion is a
> > cool tool for making beginners more comfortable with the environment.
>
> Especially when they see their self-defined methods pop up in there :-)
>
> > So, unless there is some bad memory or runtime hit, I'd vote that:
> >
> > Dictionary at<TAB>
> >
> > returns  (at least)
> >
> > at:
> > at:put:
>
> and since you bring it up, here is what I sent to Paolo late last night:
>
> libgst/input.c
>
> void
> _gst_add_symbol_completion (const char *str,
>    int len)
> {
>   const char *base = str;
>   const char *p = str;
>
>   if (completions_enabled < 1)
>     return;
>
>   /* Everything goes in ... what can happen? */
>   add_completion (str, len);
> }
>
> st> aDict at<TAB><TAB>
> at:                          atPutSubpart:
> at:ifAbsent:                 atRandom
> at:ifAbsentPut:              atSubpart:
> at:ifPresent:                atSynonym:put:
> at:noCObjectsPut:type:       atime
> at:put:                      atimeSec
> at:put:type:                 attr
> at:splitAndPut:decrementBy:  attrArray
> at:type:                     attributeAt:
> atAll:                       attributeAt:ifAbsent:
> atAll:put:                   attributes
> atAllPut:                    attributesArray
> atAllSynonyms:put:           attributesDo:
> atEnd
>
> st> aThing print<TAB><TAB>
> print                              printOn:indent:
> print:                             printOn:line:
> printAsAttributeOn:                printOn:special:
> printByteCodesOn:                  printOn:tag:indent:
> printCodePointOn:                  printString
> printHeaderOn:                     printString:
> printHierarchy                     printStringRadix:
> printNl                            printSubclasses:using:
> printOn:                           printXmlOn:collection:tag:indent:
> printOn:base:                      printedFileName
> printOn:in:
>
> You'll have to back up into the suggestion though (alt-b comes
> in handy).
>
> s.
>
>
> _______________________________________________
> help-smalltalk mailing list
> [hidden email]
> http://lists.gnu.org/mailman/listinfo/help-smalltalk

My 2 cents why it is not done in Smalltalk we can reuse OCompletion or the
RoelTyper ? It should be easy to do a small binding of readline (or reuse
NCurses)

Cheers,
Gwenael
 
--

VisualGST for GNU Smalltalk : http://visualgst.bioskop.fr/


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: autocomplete in gst REPL

Paolo Bonzini-3

> My 2 cents why it is not done in Smalltalk we can reuse OCompletion or the
> RoelTyper ? It should be easy to do a small binding of readline (or reuse
> NCurses)

Yes, it is possible.  Right now I'm reluctant to do more than the simple
patch Stefan sent.

Paolo


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk