New feature: Auto-completion

74 views
Skip to first unread message

Rasmus Andersson

unread,
Jan 1, 2011, 5:55:09 PM1/1/11
to kod...@googlegroups.com
https://github.com/rsms/kod/compare/8875a3e...dc55f2c

This will serve as a universal base auto-completion and will be
override-able by text parsers in the future to allow custom
suggestions. It uses an approach similar to that of TextMate where the
collection of known words are the words in the current document. When
requesting to complete a partial word, a list of known words with a
matching prefix is returned, ranked using both frequency and distance
from the cursor.

Protip: Completion is bound to the ESC key by default in OS X.

Big thanks to @irskep for helping out with this.

--
Rasmus Andersson

Agos

unread,
Jan 1, 2011, 8:28:25 PM1/1/11
to kod...@googlegroups.com

Steve Conover

unread,
Jan 1, 2011, 8:40:43 PM1/1/11
to kod...@googlegroups.com
<applause>

> --
> You received this message because you are subscribed to the Google
> Groups "Kod.app" group. To unsubscribe from this group, send email to
> kod-app+u...@googlegroups.com (More info at http://groups.google.com/group/kod-app)
>

aristidesfl

unread,
Jan 1, 2011, 9:52:32 PM1/1/11
to kod...@googlegroups.com
rsms

Have you considered the support for autocompletion with auto popup list like in Coda / Espresso? (or even X Code with the right configuration)
Is it in the plans or you don't think supporting it?

I ask this because it is a missing feature that makes a lot of people, including me, stay away from textmate.
I think standards are great, but they are not always the best solution. IMHO apple screwed this one (or at least it doesn't make sense for a programers editor), since the ESC key is really hard to press.

Rasmus Andersson

unread,
Jan 2, 2011, 3:13:00 AM1/2/11
to kod...@googlegroups.com

It does show suggestions in a pop-up list and IMHO the ESC key is one
of the easiest keys to hit -- it's at the top left of your keyboard.

>
> --
> You received this message because you are subscribed to the Google
> Groups "Kod.app" group. To unsubscribe from this group, send email to
> kod-app+u...@googlegroups.com (More info at
> http://groups.google.com/group/kod-app)
>

--
Rasmus Andersson

Agos

unread,
Jan 2, 2011, 6:34:03 AM1/2/11
to kod...@googlegroups.com
Well Esc requires you to move a hand from the home position. But on the other hand, every time I have to wait for a popup to come out by itself I feel like it takes AGES - yes I know you can configure timing in most IDEs, but it's either too short (annoying) or too long (boooring).

Adam

unread,
Jan 2, 2011, 7:01:39 AM1/2/11
to kod...@googlegroups.com
What you can do is to change the "Caps Lock" key to escape. Using http://pqrs.org/macosx/keyremap4macbook/extra.html this is possible. However this is quite obviously a hack solution.

Andy Lee

unread,
Jan 2, 2011, 9:50:43 AM1/2/11
to kod...@googlegroups.com
On Jan 1, 2011, at 5:55 PM, Rasmus Andersson wrote:
> Protip: Completion is bound to the ESC key by default in OS X.

Thanks, that was new to me -- I don't think I've ever used auto-completion in a non-coding context, and when I have used it, it's been with Control-. in Xcode. Control-, brings up a menu, which I keep forgetting I can do; usually Control-. gets me what I want just fine.

On Jan 2, 2011, at 6:34 AM, Agos wrote:
> Well Esc requires you to move a hand from the home position.

I discovered that Command-. also brings up the popup and I find it more comfortable to hit. It's even slightly more universal. In Mail, Command-. brings up the popup but ESC doesn't.

The reason I guessed Command-. is that historically on the Mac it's been a synonym for ESC as a way of saying "Cancel". Try it in an open panel, for example.

On Jan 2, 2011, at 7:01 AM, Adam wrote:
> What you can do is to change the "Caps Lock" key to escape. Using http://pqrs.org/macosx/keyremap4macbook/extra.html this is possible. However this is quite obviously a hack solution.

I wouldn't be able to do that, because I need Caps Lock to be Control. Emacs key bindings would drive me nuts otherwise.

--Andy

aristidesfl

unread,
Jan 2, 2011, 12:42:16 PM1/2/11
to kod...@googlegroups.com
I think the fact the ESC key is at a corner of the keyboard makes it one of the most difficult to press while you are writing, since you have to move your hand a lot. 
Nevertheless that should no problem since its clearly a personal preference and should be able to be customized.

The question is: is there any opposition in implementing the auto popup of the list?


Hugo Wetterberg

unread,
Jan 2, 2011, 1:04:47 PM1/2/11
to kod...@googlegroups.com
I've always thought that auto-popup is extremely obtrusive and a waste of resources. IDEs often do it, but editors don't.

/Hugo

All that a human is made of is gold, / very very little gold.
-Dean Young

Henrik Bj?rnskov

unread,
Jan 2, 2011, 1:46:43 PM1/2/11
to kod...@googlegroups.com
Thats not true. Many vim users including myself remaps the escape key to caps-lock or jj, simply because its too far away and you have to move your hand into a wierd position to hit it while writing code.

aristidesfl

unread,
Jan 3, 2011, 1:24:14 PM1/3/11
to kod...@googlegroups.com
On Sunday, January 2, 2011 7:04:47 PM UTC+1, Hugo Wetterberg wrote:
I've always thought that auto-popup is extremely obtrusive and a waste of resources. IDEs often do it, but editors don't.

/Hugo

That's why is this should be customizable. Some people love it, some don't.

 

Agos

unread,
Jan 3, 2011, 1:52:25 PM1/3/11
to kod...@googlegroups.com
But beware! Customizable is a big danger (see Linux, the past years), and not a value per se but rather an “extreme” measure, especially considering kod's minimal approach to... well, everything.

aristidesfl

unread,
Jan 3, 2011, 2:11:32 PM1/3/11
to kod...@googlegroups.com
Agree completely. 
We should think about solid defaults. 
Have some neat simplistic preferences, 
And then a lot of hidden preferences for those little itches in the back. 

aristidesfl

unread,
Jan 3, 2011, 2:12:35 PM1/3/11
to kod...@googlegroups.com
On Monday, January 3, 2011 7:52:25 PM UTC+1, Agos wrote:
But beware! Customizable is a big danger (see Linux, the past years), and not a value per se but rather an “extreme” measure, especially considering kod's minimal approach to... well, everything.

But what do you mean with (see Linux, the past years)?

Rasmus Andersson

unread,
Jan 3, 2011, 5:08:15 PM1/3/11
to kod...@googlegroups.com
I agree. Having many _visible_ settings and options is generally a bad idea. One of the keys to a good UX is making the user feel in control—the more options you give her, the less secure she feels. At the same time, if you don't provide what she intuitively look for or expect, she'll instead feel frustration (normally judging the interface as "bad").

But with a text editor for programmers it's of course a little more difficult as there are many strong and diverse wills, and often people in this group believe that computers should adapt to them. Most people work in the opposite way (speaking from experience).

With Kod I'm going to avoid excessive settings presented in the GUI (only providing an interface for the most common settings) and provide a vast selection of setting available through scripting/configuration files. In a few days you'll be able to define your settings in your ~/.kod script. At the time of writing this you'll need to use the defaults cli program.

I've started a wiki article documenting the available settings: https://github.com/rsms/kod/wiki/Configuration-and-customization (it's a work in progress)

Sent from my iPhone

On 3 jan 2011, at 19:52, Agos <ara...@gmail.com> wrote:

But beware! Customizable is a big danger (see Linux, the past years), and not a value per se but rather an “extreme” measure, especially considering kod's minimal approach to... well, everything.

--

Agos

unread,
Jan 3, 2011, 5:31:10 PM1/3/11
to kod...@googlegroups.com
You're right, I was a bit vague.
Until recent times, the Linux experience on the desktop was truly horrible: the same customizability that was necessary on the servers just didn't work on home machines. Those hundreds of preferences that VLC sported made it look ugly and complicated, Xorg.conf became a recurring joke, et cetera; luckily this has changed now :)
Reply all
Reply to author
Forward
0 new messages