TextMate Now Has Cocoa Completions

There's a lot to like about TextMate build 1310. There's the Halloween-themed icon, for example, as well as the spider web content background. But the real news is that the Objective-C bundle now autocompletes built-in Cocoa methods, addressing one of the few obvious advantages Xcode's editor had over TextMate.

In typical fashion, this feature was added to the main Objective-C bundle without much fanfare, but here's the item from the release notes:

Objective-C bundle: A partially typed (system) method call can now be completed by pressing ^M, if there are multiple candidates, a menu is shown. The insertion is a snippet so you can tab between the argument placeholders (Joachim Martensson)


There are some scripts in the bundle that go out and index the methods in key frameworks like AppKit, Foundation, Core Data, Core Image, and so. You can almost certainly index more frameworks by adding a few lines to the scripts.

The one advantage Xcode still has here, though, is context-sensitive completions. That is, it will present the completions that apply to type of object you're calling the method on. Whether that matters to you against the backdrop of all the other tools that TextMate offers to Cocoa developers is a personal choice.

You activate the completions by pressing Control-M. If there are multiple completions, a menu appears. You can select an item by mouse, numeric key, arrows keys, or even type-to-select:

TextMate Completions Menu


The Control-M is actually pretty awkward, unless you're used to using your right-hand pinky finger to press the control key. I might try to get used to it, but another option is to just change the key equivalent in the Bundle Editor:

TextMate Cocoa Context


This is separate from the short list of "Cocoa Completions," which is also in the Objective-C bundle. That contains a small batch of the most common class names and methods, activated with the normal Esc-based autocomplete. You can add to this list yourself, again using the Bundle Editor:

TextMate Cocoa Completions


The previous build, 1305, added the ability to get TextMate to display custom nib files as if they were native. It's easier to watch the screencast. Daring Fireball has some nice things, to say about this.

To get automatic notifications for these builds, go to Preferences > Software Update > Watch For: "Cutting-Edge". These builds tend to be just as usable as the official releases.
Design Element
TextMate Now Has Cocoa Completions
Posted Oct 31, 2006 — 15 comments below




 

Jacob Rus — Oct 31, 06 2254

Or far better, is just to make your ⇪ key into a ⌃ key!

Jacob Rus — Oct 31, 06 2255

Or you could have your comment engine just rudely turn my characters into entities :p. That was the caps lock key into the ctrl key, for those unfamiliar with the complete unicode standard.

Scott Stevenson — Oct 31, 06 2256 Scotty the Leopard

Or you could have your comment engine just rudely turn my characters into entities

Done!

Dan Price — Oct 31, 06 2257

On OSX, hitting Esc when typing brings up a list of possible completions. This works in XCode for variables, constants, methods. Anything really.

Dan Price — Oct 31, 06 2258

Ah, I see you already knew that. Sorry. It was rather nifty though - heard about it from Flaming Fireball and have been using it ever since.

XCode still isn't as nice as say, Visual Studio, and looks rather old-fashioned by comparison. I'm hoping the new version in 10.5 will be recitfy this (code expansion etc).

Scott Stevenson — Oct 31, 06 2259 Scotty the Leopard

XCode still isn't as nice as say, Visual Studio

I use Xcode as a data modeler and as a front end to gcc/gdb. I use TextMate for practically everything else.

Dan Price — Oct 31, 06 2260

I use Xcode as a data modeler and as a front end to gcc/gdb. I use TextMate for practically everything else.

I'm not a power-coder. I don't think I would have the patience to copy and paste code back and forth from a text editor and XCode simply for the sake of better text-handling. It's the sort of thing I used to do back in the LightSpeed Pascal days; I don't expect to do it in 2006 :P

Alastair Tse — Oct 31, 06 2261

I'm not a power-coder. I don't think I would have the patience to copy and paste code back and forth from a text editor and XCode simply for the sake of better text-handling.

You don't copy text back and forth, you just not use the Xcode editor for editing text files. That is, you just have TextMate and Xcode open.

On a related note, I once knew a programmer who didn't know how to use vi so she wrote C++ programs in Microsoft Word and cut and pasted them into a terminal. I don't know how long she kept her job for.

Scott Stevenson — Oct 31, 06 2268 Scotty the Leopard

I don't think I would have the patience to copy and paste code back and forth from a text editor and XCode simply for the sake of better text-handling.

Neither do I.

To expand on what Alastair said, Xcode has a feature called "external editor support," meaning you double-click on a file in Xcode and it opens in your editor. You also just drag the whole group of files to the TextMate icon.

TextMate also has a front end to the Xcode build system, so you just hit command-B and watch the process go. I haven't found a way to do debugging with it, though.

Also "better text handling" is quite the understatement. There's a reason it won best developer tool at WWDC. :)

Bill Coleman — Nov 02, 06 2275

XCode still isn't as nice as say, Visual Studio

Gack! I still can't believe he said that!

I use VS 2005 every day. It's a toy compared to XCode. Sure, it looks like it has a lot of pretty features, but many things don't work correctly. Builds take forever, the Visual Designer is a joke, and many times a day I feel like just taking the whole machine and chucking it out the nearest window!

XCode, on the other hand, is a joy to use, appears to handle lots of complex code with aplumb, understands how to make effective use of multiple cores, and has never just gone out to lunch on me.

Tidbit: Microsoft does not use Visual Studio internally for development. Apple does use XCode. It shows.

Joachim Mrtensson — Nov 05, 06 2299

On a related note, I once knew a programmer who didn't know how to use vi so she wrote C++ programs in Microsoft Word and cut and pasted them into a terminal. I don't know how long she kept her job for.
At least that way she would have complete control over the syntax coloring;).

I'm glad that you like the command. It seems like the menu option Allan Odgaard added to tm_dialog, has spured a lot of code completion related work, so it is likely that we will come up with a better key-combination for code-completion than ^M and one that is common to all language bundles

Panagiotis Atmatzidis — Nov 06, 06 2312

I use VS 2005 every day. It's a toy compared to XCode. Sure, it looks like it has a lot of pretty features, but many things don't work correctly. Builds take forever, the Visual Designer is a joke, and many times a day I feel like just taking the whole machine and chucking it out the nearest window!

trolling mode on

If the machine runs Microsoft Windows, I guess the window is the right path!

trolling mode off

Panagiotis Atmatzidis — Nov 06, 06 2313

Bill Coleman said:
Tidbit: Microsoft does not use Visual Studio internally for development. Apple does use XCode. It shows.

Can you prove that? How do you know?

Johannes Huning — Dec 07, 07 5173

I just read your article and I was wondering, why Ctrl+M didn't worked. The Bundle Editor told me, that the current (build 1436) key equivalent is Alt+Esc.

kind regards
Johannes Huning

Scott Stevenson — Dec 07, 07 5180 Scotty the Leopard

@Johannes Huning: The Bundle Editor told me, that the current (build 1436) key equivalent is Alt+Esc
Yes. The key equivalent changed at some point.




 

Comments Temporarily Disabled

I had to temporarily disable comments due to spam. I'll re-enable them soon.





Copyright © Scott Stevenson 2004-2015