[TxMt] Re: TextMate Code Completion

Dirk van Oosterbosch, IR labs labs at ixopusada.com
Thu Dec 7 11:51:47 UTC 2006


First off: it's great that this subject comes up, for indeed:  
(automatic) code completion is also the TOP1 item on *my* TextMate  
wishlist.
But let me grab the opportunity of blatantly list some of the  
features I would request for such code completion.

On 6-dec-2006, at 22:41, thomas Aylott wrote:
> I think we should come up with a brick simple library that will let  
> you do completions.
> Then the hardcode d00ds can get on with extending and perfecting  
> the completion library.
> While everyone actually gets the chance to use it.

I'm not sure if I got you right, thomas. I think that a flat  
(Library) file is the not the solution swe're looking for here – 
other than just a temporary one too keep the svn manageable ;)–. I  
think the system for our code completion should be much more complex  
and *context-aware* than that. Like the filename-filepath-completion- 
for-textmate you showed; that didn't work with a flat library file,  
or did it?


On 7-dec-2006, at 0:39, Jacob Rus wrote:
>  I don't think it should just be alphabetical; for instance,  
> functions already used in the current document should come sooner  
> than others.

Indeed, or even better: that it has the learning behavior –like  
the ⎋ completion in TextMate already has now– : frequently (or  
previously) used completions will show up first.

@Ed Singleton:
That would be great!
I think python would be a good case to start building such a smart  
system, because of its extensive introspection. Take a look at  
ipython (the alternative interactive python interpreter), if you  
haven't already.
Good code completion systems would strongly work with the context in  
which the completion is requested. And luckily for us TextMate  
already has a great scope (context) system. For code completions that  
would imply that only the functions, methods or properties show up  
that object or context is susceptible to.

Or it could be even more context aware, for instance that it also  
takes into account in which code block you are working.
E.g. (seen in Xcode) Inside the method doSomethingWithFoo: of class  
Bar, we call a totally different class Baz, which happen to have the  
same method doSomethingWithFoo. Then before you type anything more  
than `[Baz ` it already show doSomethingWithFoo as the first completion.

So ordering the completions is a big issue, possible of saving us  
hours and hours.

As the final feature to list I also want to mention that I would be a  
fan of *SubWordCompletion*. (This used to be a feature of Xcode, but  
they removed it, unfortunately). With SubWordCompletion I mean that  
it can also complete on *parts* of completion terms, without leaving  
the completion modus, with the possibility to narrow down on the  
completion term fast. An example:
You're looking for NSNumberFormatterRoundDown.
Then typing `NSNum ⇥ F ⇥ R ⇥ D ⇥` should be enough to make the  
complete NSNumberFormatterRoundDown.
This would the breakdown of the steps in the interface:
1. You type NSNum
It completes to NSNumber
2. type ⇥
It stays in completion mode, showing you all possible continuations  
of NSNumber...  (Hit ⇥ again or hit enter to exit completion mode  
and use NSNumber)
3. type F
it completes to NSNumberFormatter
4. type ⇥
you see NSNumberFormatter... and still stays in completion mode
5. type R
it completes to NSNumberFormatterRound
6. type ⇥
you see the 9 possible endings of NSNumberFormatterRound...
7. type D
it completes to NSNumberFormatterRoundDown
8. type ⇥
presto!


I recognize that most of these features will not be simple to  
implement, but please forgive me for being an idealist instead of a  
pragmatist.
Best,
dirk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20061207/6a394570/attachment.html>


More information about the textmate mailing list