tags:

views:

86

answers:

2

If I type UITa, then it might show an autocompletion of UITableViewDataSource. So I press enter and that's what I get. But what I wanted was UITableViewDelegate. If this was when we input the file name in the command line of bash, then it would have auto-completed up to UITableViewD, and then I would have to enter a to get an autocompletion for UITableViewDataSource, or e to get UITableViewDelegate.

Is there a way to make Xcode work like that, or another way to avoid this problem?

+4  A: 

In my machine (XCode 3.2.3 on OS X 10.6.4) the auto-completion works exactly as you described you want to behave.

Typing

 NSMut

shows something like

NSMutableArray

Note that NSMut, able, and Array are all displayed in a different color/font in XCode. Typing D here to change the completion to NSMutableDictionary does not work, but hitting Enter or the right arrow key changes the selection up to

NSMutableArray

Hitting D here changes the completion to

NSMutableDictionary

If you want the possible list of auto-completions, just hit the escape key. Hitting escape key is the general way to get the list of completion in any Cocoa app on OS X. In any Cocoa text box you'll get the list of English words which matches the first few letters you typed.

Yuji
My experience is that it works as you describe it, but not always. Sometimes XCode seems to have forgotten some symbols and autocompletes words that are ambiguous.
Codo
I'm talking about how Linux uses autocompletion for file names in the terminal. If there is any ambiguity then you can not proceed with autocompletion until that ambiguity is resolved by typing more letters. If you keep pressing enter in XCode then this is not the case.
awakeFromNib
I see. I guess that's more about the autocompletion of bash, which is also the default shell of OS X ...
Yuji
Yes, so can XCode act like that?
awakeFromNib
Unfortunately, no. The difference is that in XCode, hitting enter chooses whatever completion XCode is currently suggesting. You can still resolve the ambiguity by typing the next letter. You have to be alert not to hit enter key in that situation. It's unfortunate but you need to adapt your habit.
Yuji
+3  A: 

Xcode autocompletion can be inconsistent. Workaround: After typing some characters, hit ESC and Xcode will pop up a scrollable list of completion options. Continue typing to narrow down the list. Use the up/down arrow keys to navigate the list. Hit return to complete using the selected text. This approach can be helpful when Xcode autocompletion is acting flaky.

James Huddleston