suggestion: Code Assist for undefined temp vars

38 views
Skip to first unread message

Joachim Tuchel

unread,
Oct 16, 2018, 8:01:49 AM10/16/18
to VA Smalltalk
Seth and team,

this is an idea that you might already hove in your pipeline - or maybe the feature is already there and I just missed it.

Whenever I write new code, I am quite chaotic (please don't try to extrapolate from this, let's just say this much is true in any case ;-) ). So I tend to write a few statements and use a temp var. Of course this is not defined yet, so I navigate up to the method temps or the temps of this or an outer context.

Wouldn't it be nice if code assist suggested the names of undefined temp vars in the currently edited method or context? The info must be present, because code assist can add squiggles to the names in the editor...

I also seem to remember we once discussed (here on this group?) that saving a method with undefined temps could/should suggest adding them instead of just complaining.

just an idea / or maybe a question if such a thing is already available in VAST

Joachim

Seth Berman

unread,
Oct 16, 2018, 11:37:12 AM10/16/18
to VA Smalltalk
Hi Joachim,


There are many ways to do this (see How To Active), but my preferred method is to
1. Write a temp variable name
2. Request code assist (Ctrl+Space)
3. Choose the first one (Declare undefined temp I think its called)
4. Usually the inner-most scope is the correct one, but you can choose with the arrow keys or mouse hover
5. I usually just continue typing which will commit the change.

One could do an add all undefined temps automatically on method save...and I'll look into something like this

-- Seth

Richard Sargent

unread,
Oct 16, 2018, 3:41:15 PM10/16/18
to VA Smalltalk
On Tuesday, October 16, 2018 at 8:37:12 AM UTC-7, Seth Berman wrote:
Hi Joachim,


There are many ways to do this (see How To Active), but my preferred method is to
1. Write a temp variable name
2. Request code assist (Ctrl+Space)
3. Choose the first one (Declare undefined temp I think its called)
4. Usually the inner-most scope is the correct one, but you can choose with the arrow keys or mouse hover
5. I usually just continue typing which will commit the change.

One could do an add all undefined temps automatically on method save...and I'll look into something like this

Please don't do this automatically. I would hate to have a mis-typed instance variable reference automatically and silently become a temporary variable reference.

Seth Berman

unread,
Oct 16, 2018, 4:11:44 PM10/16/18
to va-sma...@googlegroups.com
Hi Richard,

I personally would agree...though I would need to try it for awhile.  Like most things in this area...there is no right answer and it’s subjective.  That’s why code assist has the number of options that it actually has.
So my inclination here, if we were to do anything, would be to keep the current behavior the default and add an option for folks who would like that behavior.

- Seth

--
You received this message because you are subscribed to a topic in the Google Groups "VA Smalltalk" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/va-smalltalk/viTjKXqisZs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to va-smalltalk...@googlegroups.com.
To post to this group, send email to va-sma...@googlegroups.com.
Visit this group at https://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
--
-----------------------------------------------------
Seth Berman
President & CEO, Instantiations Inc.
sbe...@instantiations.com


Louis LaBrunda

unread,
Oct 16, 2018, 5:52:04 PM10/16/18
to VA Smalltalk
+1

Lou

Joachim Tuchel

unread,
Oct 17, 2018, 3:36:03 AM10/17/18
to VA Smalltalk
Richard, Seth,

I agree that automatically adding mistyped temps is not a good idea. A prompter on method save that offers a list of undefined temps and teh options to
* correct the spelling
* add a temp

would sure be better.

It's not exactly what I was talking about initialiy, but it is probably even better than just adding code completion support for those who remember they need to add temps... And, I think it is very similar to what VisualWorks has had for a while.


Joachim

Joachim Tuchel

unread,
Oct 17, 2018, 3:42:21 AM10/17/18
to VA Smalltalk
Seth,

so it's been there for a while without me recognizing it. Why am I not surprised to learn about this? ;-)

I will take a closer look at this. The linked document is really interesting, it's incredible how much functionality you've put into Code Assist that is in danger of staying unrecognized "for ages"....

Thanks for pointing me to this. Adding temps is now a fun task...

Joachim
Reply all
Reply to author
Forward
0 new messages