Coming back to formatting error with brackets

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

Coming back to formatting error with brackets

Long Haired David
I mentioned this some time ago and Mariano wasn't able to reproduce it.

OK, try this one.

the method so far is as follows:

nextTrainNumber

| next |

next :=  (CCIni getNextTrain) asNumber.
 
I have a list called RandomTrainList and if next exceeds the size of this list, it should be reset to 1.

So, the next line I want to add is 

next > self RandomTrainList size ifTrue:[] ifFalse:[].

I partially type the line and it gets reformatted to:

(next > self) RandomTrainList .

David
TotallyObjects

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/8c37c6c4-d54c-43d9-934d-9efdfc8324f5%40googlegroups.com.
David
Totally Objects
Doing Smalltalk since 1989
Reply | Threaded
Open this post in threaded view
|

Re: Coming back to formatting error with brackets

Seth Berman
Hello David,

Just so I'm clear...are we talking about the formatter or the auto-completer?

"I partially type the line and it gets reformatted to..."
makes me thing we are talking about auto-completion, because as far as I know there isn't a "format as you type" feature.
And if there is...then I would want to know what you are using.

Or are you saying that you type "next > self RandomTrainList"
and then select "Format" from somewhere?

- Seth

On Thursday, May 14, 2020 at 10:01:57 AM UTC-4, Totally Objects wrote:
I mentioned this some time ago and Mariano wasn't able to reproduce it.

OK, try this one.

the method so far is as follows:

nextTrainNumber

| next |

next :=  (CCIni getNextTrain) asNumber.
 
I have a list called RandomTrainList and if next exceeds the size of this list, it should be reset to 1.

So, the next line I want to add is 

next > self RandomTrainList size ifTrue:[] ifFalse:[].

I partially type the line and it gets reformatted to:

(next > self) RandomTrainList .

David
TotallyObjects

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/d10e8590-edb8-4716-8079-9882bf536de2%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Coming back to formatting error with brackets

Long Haired David
In reply to this post by Long Haired David
Seth, I am just typing into a standard coding browser under standard 9.2. As far as I am aware, I haven't configured anything, included anything or run anything to change the way typing code in managed.

as you can see in the image, just simply typing the text results in the inline formatting and the spurious brackets being included.

David

On Thursday, May 14, 2020 at 3:01:57 PM UTC+1, Totally Objects wrote:
I mentioned this some time ago and Mariano wasn't able to reproduce it.

OK, try this one.

the method so far is as follows:

nextTrainNumber

| next |

next :=  (CCIni getNextTrain) asNumber.
 
I have a list called RandomTrainList and if next exceeds the size of this list, it should be reset to 1.

So, the next line I want to add is 

next > self RandomTrainList size ifTrue:[] ifFalse:[].

I partially type the line and it gets reformatted to:

(next > self) RandomTrainList .

David
TotallyObjects

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/6afd59f0-6bdb-4834-bc30-2092bdd5e923%40googlegroups.com.

CodeBrowser.png (37K) Download Attachment
David
Totally Objects
Doing Smalltalk since 1989
Reply | Threaded
Open this post in threaded view
|

Re: Coming back to formatting error with brackets

Seth Berman
Hi David,

I don't really know how to explain that if you don't see a code assist box in this scenario.
It's possible that the code assist box somehow shows up behind the text pane and you don't see it..but I'm not sure.

Code Assist will inject parens around expressions where there is ambiguity.
In this case, if it suggests "RandomTrainList", there will be 2 entries in the code assist box.

One for the receiver "self" and one for the receiver "next > self".  It has to offer both because
it can't decide for you which one would be correct.  And there are other scenarios (i.e. ifTrue:ifFalse:)
where it gets incredibly annoying if it doesn't inject the parens since you almost never want to apply
ifTrue:ifFalse to the inner expression...and this is obviously used a lot.

The apparent formatting behavior comes if you select the entry for "next > self", then
it knows that it has to add parens to make that work.

This is outlined in more detail in a section called "Method Suggestions:" in the doc
https://www.instantiations.com/docs/921/wwhelp/wwhimpl/js/html/wwhelp.htm#href=vaast/vaast-3cc.html

- Seth

On Thursday, May 14, 2020 at 4:01:09 PM UTC-4, Totally Objects wrote:
Seth, I am just typing into a standard coding browser under standard 9.2. As far as I am aware, I haven't configured anything, included anything or run anything to change the way typing code in managed.

as you can see in the image, just simply typing the text results in the inline formatting and the spurious brackets being included.

David

On Thursday, May 14, 2020 at 3:01:57 PM UTC+1, Totally Objects wrote:
I mentioned this some time ago and Mariano wasn't able to reproduce it.

OK, try this one.

the method so far is as follows:

nextTrainNumber

| next |

next :=  (CCIni getNextTrain) asNumber.
 
I have a list called RandomTrainList and if next exceeds the size of this list, it should be reset to 1.

So, the next line I want to add is 

next > self RandomTrainList size ifTrue:[] ifFalse:[].

I partially type the line and it gets reformatted to:

(next > self) RandomTrainList .

David
TotallyObjects

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/b884e396-463f-465c-9b9a-d5fa66ef9913%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Coming back to formatting error with brackets

jtuchel
Seth, David,

like I mentioned in this other thread, I get the same result using the code assist more often than I'd like. It seems at least for my thinking, the "ordering" of options in code assist is wrong for many cases. I often end up deleting these wrong brackets.

But this is such a short and quick moment that it is hard to explain. I mostly just press enter when the suggested keyword is the one I am looking for and I forget to think about the icons. I do look at the implemtning classes, but fail to pay attention to this yellow backpointing arrow...

I never had this simply when typing, however. I am absolutely sure this only happens to me when I accept code assist suggestions. From my experience, the code assist suggestions reliably appear in the foreground.

Joachim

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/4b368c0a-b9a7-4656-8a90-50648db07c5d%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Coming back to formatting error with brackets

Seth Berman
Hello Joachim,

"It seems at least for my thinking, the "ordering" of options in code assist is wrong for many cases"
- The point I've been trying to make, I think on other threads too, is that the ordering is going to be wrong in many cases.
Because, the only way it could be right in most cases...is if it could read your mind:)

Just first consider the situation for what it is...and then we can talk about concrete solutions.
In the example in this thread, there is an ambiguous expression when it comes to code completion.

next > self

An intuitive fact: Over many trials with many people...you can expect the ordering to be wrong about 1/2 the time.
That's because the probability that a person wants to apply completion against 'self' is probably the same as the probability that person want to complete (next > self).
Obviously, the tool can't know the correct ordering in this case.

Doc Ref: https://www.instantiations.com/docs/921/wwhelp/wwhimpl/js/html/wwhelp.htm#href=vaast/vaast-3cc.html

Solution 1: Try playing around with "Method Receiver Sort Policy" (and read the description in the doc because it touches on this issue).
Perhaps, you personally, will get to a place where the ordering is right more often than its wrong.

Solution 2: Use the "live filtering support" and get comfortable with the hotkey that quickly inverts the ordering.  By default this is <Ctrl+Shift+I>.  This is described in the "Live Filtering Support:" section right underneath the section from Solution 1.
This is personally the one that I use and is most efficient for me because <Ctrl+Shift+I> is part of my muscle memory and it takes me a split second to invert the order...its not something I even consciously think about anymore.  I know I have to make the choice about the ordering, so I believe this to be the quickest way rather than scrolling through a list until you find the right entry.

Possible Solution 3:  Have an option to remove the precedence stuff altogether leaving you to manually insert parenthesis.  The problem here from my standpoint is there is about a 50-80ms window to hit and all the entries must still be captured....but now merged into a unique set.  Its difficult to do that and still maintain that time constraint.  And personally I would loath having to go back and complete parenthesis all the time...especially since the live filtering is almost 0 effort if you have trained yourself to use it.  But if I could get that to be fast enough, then I would add it as an option

Other solutions?
I'm open...let me know specifically how you think it ought to work.

- Seth

On Friday, May 15, 2020 at 2:02:50 AM UTC-4, Joachim Tuchel wrote:
Seth, David,

like I mentioned in this other thread, I get the same result using the code assist more often than I'd like. It seems at least for my thinking, the "ordering" of options in code assist is wrong for many cases. I often end up deleting these wrong brackets.

But this is such a short and quick moment that it is hard to explain. I mostly just press enter when the suggested keyword is the one I am looking for and I forget to think about the icons. I do look at the implemtning classes, but fail to pay attention to this yellow backpointing arrow...

I never had this simply when typing, however. I am absolutely sure this only happens to me when I accept code assist suggestions. From my experience, the code assist suggestions reliably appear in the foreground.

Joachim

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/e177c814-c962-4dbd-84d8-1efc099aa262%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Coming back to formatting error with brackets

Long Haired David
In reply to this post by Seth Berman
Sorry - as you Americans say "my bad". Yes, if I select RandomTrainList from the code assist drop down, it goes wrong but if I continue typing the complete method name it is fine.

I didn't see that as part of the problem! Anyway, I assume from all of this that this is something I will have to live with as it is the only time that it gets in the way. Thanks for all the input.

It does appear that I am only offered the one choice (see the image) (well two but the same method name but one with a colon.) but, again, I am not a deep thinker in these things so maybe I don't understand your answers terribly well.

David

On Thursday, May 14, 2020 at 9:19:50 PM UTC+1, Seth Berman wrote:
Hi David,

I don't really know how to explain that if you don't see a code assist box in this scenario.
It's possible that the code assist box somehow shows up behind the text pane and you don't see it..but I'm not sure.

Code Assist will inject parens around expressions where there is ambiguity.
In this case, if it suggests "RandomTrainList", there will be 2 entries in the code assist box.

One for the receiver "self" and one for the receiver "next > self".  It has to offer both because
it can't decide for you which one would be correct.  And there are other scenarios (i.e. ifTrue:ifFalse:)
where it gets incredibly annoying if it doesn't inject the parens since you almost never want to apply
ifTrue:ifFalse to the inner expression...and this is obviously used a lot.

The apparent formatting behavior comes if you select the entry for "next > self", then
it knows that it has to add parens to make that work.

This is outlined in more detail in a section called "Method Suggestions:" in the doc
<a href="https://www.instantiations.com/docs/921/wwhelp/wwhimpl/js/html/wwhelp.htm#href=vaast/vaast-3cc.html" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.instantiations.com%2Fdocs%2F921%2Fwwhelp%2Fwwhimpl%2Fjs%2Fhtml%2Fwwhelp.htm%23href%3Dvaast%2Fvaast-3cc.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEhpt6303a5iMyhFWiPLBfTtJRJEw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.instantiations.com%2Fdocs%2F921%2Fwwhelp%2Fwwhimpl%2Fjs%2Fhtml%2Fwwhelp.htm%23href%3Dvaast%2Fvaast-3cc.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEhpt6303a5iMyhFWiPLBfTtJRJEw&#39;;return true;">https://www.instantiations.com/docs/921/wwhelp/wwhimpl/js/html/wwhelp.htm#href=vaast/vaast-3cc.html

- Seth

On Thursday, May 14, 2020 at 4:01:09 PM UTC-4, Totally Objects wrote:
Seth, I am just typing into a standard coding browser under standard 9.2. As far as I am aware, I haven't configured anything, included anything or run anything to change the way typing code in managed.

as you can see in the image, just simply typing the text results in the inline formatting and the spurious brackets being included.

David

On Thursday, May 14, 2020 at 3:01:57 PM UTC+1, Totally Objects wrote:
I mentioned this some time ago and Mariano wasn't able to reproduce it.

OK, try this one.

the method so far is as follows:

nextTrainNumber

| next |

next :=  (CCIni getNextTrain) asNumber.
 
I have a list called RandomTrainList and if next exceeds the size of this list, it should be reset to 1.

So, the next line I want to add is 

next > self RandomTrainList size ifTrue:[] ifFalse:[].

I partially type the line and it gets reformatted to:

(next > self) RandomTrainList .

David
TotallyObjects

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/a017559c-26c9-4b44-b5cf-be692369eac1%40googlegroups.com.

drop.png (5K) Download Attachment
David
Totally Objects
Doing Smalltalk since 1989
Reply | Threaded
Open this post in threaded view
|

Re: Coming back to formatting error with brackets

Seth Berman
Hello David,

Not a problem:)
I'm just curious...does 'self' in this context implement RandomTrainList?
Usually, what you see should mean that:
1. The 'self' receiver (which can be statically determined...no type guessing required) does not implement any message starting with RandomTr
2. The (next > self) expression is not fully type resolvable, so its falling back to global selector searching and finds 2 selectors with the prefix RandomTr.
3. Applying any of those selectors will add the parenthesis around the (next > self).

Since you would like to apply #RandomTrainList to 'self'...I'm assuming this is because RandomTrainList is implemented in 'self'?
In which case, I would expect there should be a couple more entries in the code assist popup box.

- Seth

On Friday, May 15, 2020 at 3:24:45 PM UTC-4, Totally Objects wrote:
Sorry - as you Americans say "my bad". Yes, if I select RandomTrainList from the code assist drop down, it goes wrong but if I continue typing the complete method name it is fine.

I didn't see that as part of the problem! Anyway, I assume from all of this that this is something I will have to live with as it is the only time that it gets in the way. Thanks for all the input.

It does appear that I am only offered the one choice (see the image) (well two but the same method name but one with a colon.) but, again, I am not a deep thinker in these things so maybe I don't understand your answers terribly well.

David

On Thursday, May 14, 2020 at 9:19:50 PM UTC+1, Seth Berman wrote:
Hi David,

I don't really know how to explain that if you don't see a code assist box in this scenario.
It's possible that the code assist box somehow shows up behind the text pane and you don't see it..but I'm not sure.

Code Assist will inject parens around expressions where there is ambiguity.
In this case, if it suggests "RandomTrainList", there will be 2 entries in the code assist box.

One for the receiver "self" and one for the receiver "next > self".  It has to offer both because
it can't decide for you which one would be correct.  And there are other scenarios (i.e. ifTrue:ifFalse:)
where it gets incredibly annoying if it doesn't inject the parens since you almost never want to apply
ifTrue:ifFalse to the inner expression...and this is obviously used a lot.

The apparent formatting behavior comes if you select the entry for "next > self", then
it knows that it has to add parens to make that work.

This is outlined in more detail in a section called "Method Suggestions:" in the doc
<a href="https://www.instantiations.com/docs/921/wwhelp/wwhimpl/js/html/wwhelp.htm#href=vaast/vaast-3cc.html" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.instantiations.com%2Fdocs%2F921%2Fwwhelp%2Fwwhimpl%2Fjs%2Fhtml%2Fwwhelp.htm%23href%3Dvaast%2Fvaast-3cc.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEhpt6303a5iMyhFWiPLBfTtJRJEw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.instantiations.com%2Fdocs%2F921%2Fwwhelp%2Fwwhimpl%2Fjs%2Fhtml%2Fwwhelp.htm%23href%3Dvaast%2Fvaast-3cc.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEhpt6303a5iMyhFWiPLBfTtJRJEw&#39;;return true;">https://www.instantiations.com/docs/921/wwhelp/wwhimpl/js/html/wwhelp.htm#href=vaast/vaast-3cc.html

- Seth

On Thursday, May 14, 2020 at 4:01:09 PM UTC-4, Totally Objects wrote:
Seth, I am just typing into a standard coding browser under standard 9.2. As far as I am aware, I haven't configured anything, included anything or run anything to change the way typing code in managed.

as you can see in the image, just simply typing the text results in the inline formatting and the spurious brackets being included.

David

On Thursday, May 14, 2020 at 3:01:57 PM UTC+1, Totally Objects wrote:
I mentioned this some time ago and Mariano wasn't able to reproduce it.

OK, try this one.

the method so far is as follows:

nextTrainNumber

| next |

next :=  (CCIni getNextTrain) asNumber.
 
I have a list called RandomTrainList and if next exceeds the size of this list, it should be reset to 1.

So, the next line I want to add is 

next > self RandomTrainList size ifTrue:[] ifFalse:[].

I partially type the line and it gets reformatted to:

(next > self) RandomTrainList .

David
TotallyObjects

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/639ed667-7885-468a-ace6-f60211fca157%40googlegroups.com.