[Pharo-project] Making cr to autocomplete as well as tab (in Pharo 1.3)
Hi, i just found inconvenient that for autocompletion i should press tab all the time while i tend to always hit enter, which instead of pasting suggestion, inserts cr into text. So i hacked a lil piece of code to make autocompletion to insert suggested text when you pressing either tab or cr -- Best regards, Igor Stasenko AKA sig.
Thanks Igor! I always type enter ;-) #Luc 2011/5/5 Igor Stasenko <siguctua@gmail.com>
Hi, i just found inconvenient that for autocompletion i should press tab all the time while i tend to always hit enter, which instead of pasting suggestion, inserts cr into text.
So i hacked a lil piece of code to make autocompletion to insert suggested text when you pressing either tab or cr
-- Best regards, Igor Stasenko AKA sig.
i haven't filed a ticket, because i was not sure what is the motivation why enter cannot serve for autocompletion as well as tab. On 5 May 2011 16:18, Luc Fabresse <luc.fabresse@gmail.com> wrote:
Thanks Igor! I always type enter ;-)
#Luc
2011/5/5 Igor Stasenko <siguctua@gmail.com>
Hi, i just found inconvenient that for autocompletion i should press tab all the time while i tend to always hit enter, which instead of pasting suggestion, inserts cr into text.
So i hacked a lil piece of code to make autocompletion to insert suggested text when you pressing either tab or cr
-- Best regards, Igor Stasenko AKA sig.
-- Best regards, Igor Stasenko AKA sig.
as a side note... most of my students (and some of the teachers, like Nicolás, he) always complains about the "tab" instead "enter" thing :) El 05/05/2011, a las 11:27a.m., Igor Stasenko escribió:
i haven't filed a ticket, because i was not sure what is the motivation why enter cannot serve for autocompletion as well as tab.
On 5 May 2011 16:18, Luc Fabresse <luc.fabresse@gmail.com> wrote:
Thanks Igor! I always type enter ;-)
#Luc
2011/5/5 Igor Stasenko <siguctua@gmail.com>
Hi, i just found inconvenient that for autocompletion i should press tab all the time while i tend to always hit enter, which instead of pasting suggestion, inserts cr into text.
So i hacked a lil piece of code to make autocompletion to insert suggested text when you pressing either tab or cr
-- Best regards, Igor Stasenko AKA sig.
-- Best regards, Igor Stasenko AKA sig.
Le 5 mai 2011 à 21:18, Luc Fabresse <luc.fabresse@gmail.com> a écrit :
Thanks Igor! I always type enter ;-)
#Luc
+1 !!!!!
2011/5/5 Igor Stasenko <siguctua@gmail.com> Hi, i just found inconvenient that for autocompletion i should press tab all the time while i tend to always hit enter, which instead of pasting suggestion, inserts cr into text.
So i hacked a lil piece of code to make autocompletion to insert suggested text when you pressing either tab or cr
-- Best regards, Igor Stasenko AKA sig.
On 5/5/2011 7:53 AM, Igor Stasenko wrote:
Hi, i just found inconvenient that for autocompletion i should press tab all the time while i tend to always hit enter, which instead of pasting suggestion, inserts cr into text.
So i hacked a lil piece of code to make autocompletion to insert suggested text when you pressing either tab or cr
+1 I would love to see this incorporated. It makes autocomplete similar to what I find in other places, like NetBeans, OpenOffice/LibreOffice and such. It makes the context switch between apps effortless instead of requiring a transition period where I go oh yeah, that's how it works here. Thanks. Jimmie
That is really great! Many thanks 2011/5/5 Igor Stasenko <siguctua@gmail.com>:
Hi, i just found inconvenient that for autocompletion i should press tab all the time while i tend to always hit enter, which instead of pasting suggestion, inserts cr into text.
So i hacked a lil piece of code to make autocompletion to insert suggested text when you pressing either tab or cr
-- Best regards, Igor Stasenko AKA sig.
+1. I will commit it to OCompletion and then update ConfigurationOfOCompletion. On Thu, May 5, 2011 at 5:37 PM, Thierry Lebourque <zebourk@gmail.com> wrote:
That is really great! Many thanks
2011/5/5 Igor Stasenko <siguctua@gmail.com>:
Hi, i just found inconvenient that for autocompletion i should press tab all the time while i tend to always hit enter, which instead of pasting suggestion, inserts cr into text.
So i hacked a lil piece of code to make autocompletion to insert suggested text when you pressing either tab or cr
-- Best regards, Igor Stasenko AKA sig.
-- Mariano http://marianopeck.wordpress.com
Hi, This is not great at all. Please read this before going forward. We had this in OCompletion before and then it got changed to not use CR for a reason. The problem is when using fluent APIs that are best read when written on multiple lines. For example, suppose that I want to type something like this in Glamour: ... a tree display: [ ... ] After typing "a tree", the first proposed item is "treeLayout" (see the attached picture). If I press enter to go to the next line "tree" is replaced with "treeLayout" and this is not the behavior I want. The problem is that CR has a useful meaning when typing a piece of text and this makes it not good as a completion character. Tab on the other hand, is only used in Smalltalk at the beginning of an empty line so there is no danger of overloading its functionality in the middle of a text. Now, if you insist, I still believe there is a place for CR. Completion has two modes: 1. one in which I write and the completion offers me something, and 2. one in which I am after I press the down arrow to select some completion item. For 1. you do not want to have CR as a completion character. For 2. it is probably ok because you enter explicitly in a temporary mode and thus you are not typing anymore and this will not induce the conflict. Cheers, Doru On 5 May 2011, at 17:37, Thierry Lebourque wrote:
That is really great! Many thanks
2011/5/5 Igor Stasenko <siguctua@gmail.com>:
Hi, i just found inconvenient that for autocompletion i should press tab all the time while i tend to always hit enter, which instead of pasting suggestion, inserts cr into text.
So i hacked a lil piece of code to make autocompletion to insert suggested text when you pressing either tab or cr
-- Best regards, Igor Stasenko AKA sig.
-- www.tudorgirba.com "Reasonable is what we are accustomed with."
2011/5/5 Tudor Girba <tudor.girba@gmail.com>
Now, if you insist, I still believe there is a place for CR. Completion has two modes: 1. one in which I write and the completion offers me something, and 2. one in which I am after I press the down arrow to select some completion item.
For 1. you do not want to have CR as a completion character. For 2. it is probably ok because you enter explicitly in a temporary mode and thus you are not typing anymore and this will not induce the conflict.
Yes Doru. My problem is always in the second case. Cheers, #Luc
Cheers, Doru
On 5 May 2011, at 17:37, Thierry Lebourque wrote:
That is really great! Many thanks
2011/5/5 Igor Stasenko <siguctua@gmail.com>:
Hi, i just found inconvenient that for autocompletion i should press tab all the time while i tend to always hit enter, which instead of pasting suggestion, inserts cr into text.
So i hacked a lil piece of code to make autocompletion to insert suggested text when you pressing either tab or cr
-- Best regards, Igor Stasenko AKA sig.
-- www.tudorgirba.com
"Reasonable is what we are accustomed with."
On 5 May 2011 18:00, Tudor Girba <tudor.girba@gmail.com> wrote:
Hi,
This is not great at all. Please read this before going forward.
We had this in OCompletion before and then it got changed to not use CR for a reason. The problem is when using fluent APIs that are best read when written on multiple lines. For example, suppose that I want to type something like this in Glamour:
...     a tree         display: [ ... ]
After typing "a tree", the first proposed item is "treeLayout" (see the attached picture). If I press enter to go to the next line "tree" is replaced with "treeLayout" and this is not the behavior I want.
The problem is that CR has a useful meaning when typing a piece of text and this makes it not good as a completion character. Tab on the other hand, is only used in Smalltalk at the beginning of an empty line so there is no danger of overloading its functionality in the middle of a text.
This is not a problem for me, because first i typing the expression and then formatting it properly if necessary. Also, in case as you shown, one could simply type 'space' then 'enter' so discard the suggestion and begin from a new line.
Now, if you insist, I still believe there is a place for CR. Completion has two modes: 1. one in which I write and the completion offers me something, and 2. one in which I am after I press the down arrow to select some completion item.
i agree, a completion should be non-intrusive (by default it should handle enter as carriage return, but if you selected an item (using up/down keys), then it should paste the selection instead). But as i said, i having a habit to use enter, when i see a popup menu and hilighted menu item selected instead of tab.
For 1. you do not want to have CR as a completion character. For 2. it is probably ok because you enter explicitly in a temporary mode and thus you are not typing anymore and this will not induce the conflict.
Cheers, Doru
-- Best regards, Igor Stasenko AKA sig.
+1 Well said Doru Alexandre On 5 May 2011, at 12:00, Tudor Girba wrote:
Hi,
This is not great at all. Please read this before going forward.
We had this in OCompletion before and then it got changed to not use CR for a reason. The problem is when using fluent APIs that are best read when written on multiple lines. For example, suppose that I want to type something like this in Glamour:
... a tree display: [ ... ]
After typing "a tree", the first proposed item is "treeLayout" (see the attached picture). If I press enter to go to the next line "tree" is replaced with "treeLayout" and this is not the behavior I want.
The problem is that CR has a useful meaning when typing a piece of text and this makes it not good as a completion character. Tab on the other hand, is only used in Smalltalk at the beginning of an empty line so there is no danger of overloading its functionality in the middle of a text.
Now, if you insist, I still believe there is a place for CR. Completion has two modes: 1. one in which I write and the completion offers me something, and 2. one in which I am after I press the down arrow to select some completion item.
For 1. you do not want to have CR as a completion character. For 2. it is probably ok because you enter explicitly in a temporary mode and thus you are not typing anymore and this will not induce the conflict.
Cheers, Doru
<example-glamour-fluent-api.png>
On 5 May 2011, at 17:37, Thierry Lebourque wrote:
That is really great! Many thanks
2011/5/5 Igor Stasenko <siguctua@gmail.com>:
Hi, i just found inconvenient that for autocompletion i should press tab all the time while i tend to always hit enter, which instead of pasting suggestion, inserts cr into text.
So i hacked a lil piece of code to make autocompletion to insert suggested text when you pressing either tab or cr
-- Best regards, Igor Stasenko AKA sig.
-- www.tudorgirba.com
"Reasonable is what we are accustomed with."
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
yes I asked romain to bind the auto complete to enter and we removed it. Now probably having one setting would be good. Stef On May 5, 2011, at 6:00 PM, Tudor Girba wrote:
Hi,
This is not great at all. Please read this before going forward.
We had this in OCompletion before and then it got changed to not use CR for a reason. The problem is when using fluent APIs that are best read when written on multiple lines. For example, suppose that I want to type something like this in Glamour:
... a tree display: [ ... ]
After typing "a tree", the first proposed item is "treeLayout" (see the attached picture). If I press enter to go to the next line "tree" is replaced with "treeLayout" and this is not the behavior I want.
The problem is that CR has a useful meaning when typing a piece of text and this makes it not good as a completion character. Tab on the other hand, is only used in Smalltalk at the beginning of an empty line so there is no danger of overloading its functionality in the middle of a text.
Now, if you insist, I still believe there is a place for CR. Completion has two modes: 1. one in which I write and the completion offers me something, and 2. one in which I am after I press the down arrow to select some completion item.
For 1. you do not want to have CR as a completion character. For 2. it is probably ok because you enter explicitly in a temporary mode and thus you are not typing anymore and this will not induce the conflict.
Cheers, Doru
<example-glamour-fluent-api.png>
On 5 May 2011, at 17:37, Thierry Lebourque wrote:
That is really great! Many thanks
2011/5/5 Igor Stasenko <siguctua@gmail.com>:
Hi, i just found inconvenient that for autocompletion i should press tab all the time while i tend to always hit enter, which instead of pasting suggestion, inserts cr into text.
So i hacked a lil piece of code to make autocompletion to insert suggested text when you pressing either tab or cr
-- Best regards, Igor Stasenko AKA sig.
-- www.tudorgirba.com
"Reasonable is what we are accustomed with."
In my opinion, completion should not select anything when activated automatically, it is only suggestion. It is the user who choose to use it or not, by using tab or arrow, for example. If the completion is requested intentionally it should behave as described by Doru. I have used quite a lot of different IDE, and sometimes I find the Pharo completion quite disturbing. But as Stéphane said, it could maybe become a setting. 2011/5/5 Stéphane Ducasse <stephane.ducasse@inria.fr>:
yes I asked romain to bind the auto complete to enter and we removed it. Now probably having one setting would be good.
Stef
On May 5, 2011, at 6:00 PM, Tudor Girba wrote:
Hi,
This is not great at all. Please read this before going forward.
We had this in OCompletion before and then it got changed to not use CR for a reason. The problem is when using fluent APIs that are best read when written on multiple lines. For example, suppose that I want to type something like this in Glamour:
...    a tree        display: [ ... ]
After typing "a tree", the first proposed item is "treeLayout" (see the attached picture). If I press enter to go to the next line "tree" is replaced with "treeLayout" and this is not the behavior I want.
The problem is that CR has a useful meaning when typing a piece of text and this makes it not good as a completion character. Tab on the other hand, is only used in Smalltalk at the beginning of an empty line so there is no danger of overloading its functionality in the middle of a text.
Now, if you insist, I still believe there is a place for CR. Completion has two modes: 1. one in which I write and the completion offers me something, and 2. one in which I am after I press the down arrow to select some completion item.
For 1. you do not want to have CR as a completion character. For 2. it is probably ok because you enter explicitly in a temporary mode and thus you are not typing anymore and this will not induce the conflict.
Cheers, Doru
<example-glamour-fluent-api.png>
On 5 May 2011, at 17:37, Thierry Lebourque wrote:
That is really great! Many thanks
2011/5/5 Igor Stasenko <siguctua@gmail.com>:
Hi, i just found inconvenient that for autocompletion i should press tab all the time while i tend to always hit enter, which instead of pasting suggestion, inserts cr into text.
So i hacked a lil piece of code to make autocompletion to insert suggested text when you pressing either tab or cr
-- Best regards, Igor Stasenko AKA sig.
-- www.tudorgirba.com
"Reasonable is what we are accustomed with."
On 5 May 2011 22:46, Thierry Lebourque <zebourk@gmail.com> wrote:
In my opinion, completion should not select anything when activated automatically, it is only suggestion. It is the user who choose to use it or not, by using tab or arrow, for example. If the completion is requested intentionally it should behave as described by Doru.
Yes, it should not select anything (even if there's only choice), and only if user pressing keys to select an item from drop-down list (like up/down/tab), then selection should be enabled. Otherwise autocompletion should just hang around and not interfere with user's input until he typed mentioned keys, which effectively changes input focus to a menu instead of text editor.
I have used quite a lot of different IDE, and sometimes I find the Pharo completion quite disturbing.
But as Stéphane said, it could maybe become a setting.
2011/5/5 Stéphane Ducasse <stephane.ducasse@inria.fr>:
yes I asked romain to bind the auto complete to enter and we removed it. Now probably having one setting would be good.
Stef
On May 5, 2011, at 6:00 PM, Tudor Girba wrote:
Hi,
This is not great at all. Please read this before going forward.
We had this in OCompletion before and then it got changed to not use CR for a reason. The problem is when using fluent APIs that are best read when written on multiple lines. For example, suppose that I want to type something like this in Glamour:
...    a tree        display: [ ... ]
After typing "a tree", the first proposed item is "treeLayout" (see the attached picture). If I press enter to go to the next line "tree" is replaced with "treeLayout" and this is not the behavior I want.
The problem is that CR has a useful meaning when typing a piece of text and this makes it not good as a completion character. Tab on the other hand, is only used in Smalltalk at the beginning of an empty line so there is no danger of overloading its functionality in the middle of a text.
Now, if you insist, I still believe there is a place for CR. Completion has two modes: 1. one in which I write and the completion offers me something, and 2. one in which I am after I press the down arrow to select some completion item.
For 1. you do not want to have CR as a completion character. For 2. it is probably ok because you enter explicitly in a temporary mode and thus you are not typing anymore and this will not induce the conflict.
Cheers, Doru
<example-glamour-fluent-api.png>
On 5 May 2011, at 17:37, Thierry Lebourque wrote:
That is really great! Many thanks
2011/5/5 Igor Stasenko <siguctua@gmail.com>:
Hi, i just found inconvenient that for autocompletion i should press tab all the time while i tend to always hit enter, which instead of pasting suggestion, inserts cr into text.
So i hacked a lil piece of code to make autocompletion to insert suggested text when you pressing either tab or cr
-- Best regards, Igor Stasenko AKA sig.
-- www.tudorgirba.com
"Reasonable is what we are accustomed with."
-- Best regards, Igor Stasenko AKA sig.
On 5/5/2011 11:00 AM, Tudor Girba wrote:
Hi,
This is not great at all. Please read this before going forward.
We had this in OCompletion before and then it got changed to not use CR for a reason. The problem is when using fluent APIs that are best read when written on multiple lines. For example, suppose that I want to type something like this in Glamour:
... a tree display: [ ... ]
After typing "a tree", the first proposed item is "treeLayout" (see the attached picture). If I press enter to go to the next line "tree" is replaced with "treeLayout" and this is not the behavior I want.
The problem is that CR has a useful meaning when typing a piece of text and this makes it not good as a completion character. Tab on the other hand, is only used in Smalltalk at the beginning of an empty line so there is no danger of overloading its functionality in the middle of a text.
Now, if you insist, I still believe there is a place for CR. Completion has two modes: 1. one in which I write and the completion offers me something, and 2. one in which I am after I press the down arrow to select some completion item.
For 1. you do not want to have CR as a completion character. For 2. it is probably ok because you enter explicitly in a temporary mode and thus you are not typing anymore and this will not induce the conflict.
Cheers, Doru
Hello, As I stated in my reply I like the idea of using CR. But you do raise a valid point and demonstrate a valid situation. My question is... Why isn't OCompletion offering the shortest options first? If it did so, then your situation wouldn't occur. tree would be selected before treeLayout. Is it reasonable to have OCompletion sort the list which is being presented alphabetically or alphabetically within the whatever the preferred priority is? ie: alphabetically within a list of the most recently selected items. It would offer the shortest items first and complete to their end if unique, and when you want more you provide more characters or navigate to the desired item. Always completing to the first alphabetical unique qualified item. Just a few thoughts that if reasonable and doable could make everybody happy. Thanks. Jimmie
On 06 May 2011, at 04:59, Jimmie Houchin wrote:
As I stated in my reply I like the idea of using CR. But you do raise a valid point and demonstrate a valid situation.
When CR was in there before, it was absolutely irritating. I had to put a space before hitting return just to prevent a completion. In my case, it always happened when typing the method header.
My question is... Why isn't OCompletion offering the shortest options first?
OCompletion's ordering is based on your recent activity. See http://www.inf.unisi.ch/phd/robbes/papers/ASE2008-completion.pdf In my opinion, this works really great.
If it did so, then your situation wouldn't occur. tree would be selected before treeLayout.
no, because the situation also occurs when you are typing a new message that does not exist yet. If we want to improve completion, I think we should take a look at XCode's completion. It works *very* nice for completion of keyworded message syntax. Johan
+1 Doru On 6 May 2011, at 10:06, Johan Brichau wrote:
On 06 May 2011, at 04:59, Jimmie Houchin wrote:
As I stated in my reply I like the idea of using CR. But you do raise a valid point and demonstrate a valid situation.
When CR was in there before, it was absolutely irritating. I had to put a space before hitting return just to prevent a completion. In my case, it always happened when typing the method header.
My question is... Why isn't OCompletion offering the shortest options first?
OCompletion's ordering is based on your recent activity. See http://www.inf.unisi.ch/phd/robbes/papers/ASE2008-completion.pdf In my opinion, this works really great.
If it did so, then your situation wouldn't occur. tree would be selected before treeLayout.
no, because the situation also occurs when you are typing a new message that does not exist yet.
If we want to improve completion, I think we should take a look at XCode's completion. It works *very* nice for completion of keyworded message syntax.
Johan
-- www.tudorgirba.com "The coherence of a trip is given by the clearness of the goal."
participants (11)
-
Alexandre Bergel -
Esteban Lorenzano -
Igor Stasenko -
Jimmie Houchin -
Johan Brichau -
Luc Fabresse -
Mariano Martinez Peck -
Serge Stinckwich -
Stéphane Ducasse -
Thierry Lebourque -
Tudor Girba