Code completion for multi-parameter method names in Xcode 4 Code completion for multi-parameter method names in Xcode 4 xcode xcode

Code completion for multi-parameter method names in Xcode 4


It does seems that the behavior you expect is (unfortunately) not implemented in Xcode. However, I've found a partial solution: code completion works when you specify the complete first part of the multi-parameter method, i.e. if you type this (with space at the end)

- tableView:(UITableView *)tableView 

and press ESCAPE key then the code completion dialog will appear and you will be able to keep typing the rest of the method name.

You are probably wondering:

"Oh boy, do I really have to type in this long preamble just to get my code completion?"

Code snippets to the rescue! You just have to type the preamble once and convert it into snippet. I found it's best to configure it the following way, don't forget to add space at the end of code part, it will make things easier.

Ima

How should you use the thing you've just created? In your .m file start typing tabl and Xcode will let you autocomplete the snippet for you. Once the preamble is placed press ESC to reveal the auto-completion list.

This solution is not very robust, since you have to create a snippet for every multi-part method you want to use, but it does save some time and there aren't that many multi-part method names that share the same prefix.


I'm annoyed by this problem for quite a long time. Now I can verify that there is no way to do even in the newest Xcode 5, I submitted a bug report:
Multi-parameter method declaration completion in Xcode

Please dup it if you also want it.


Oh sorry, it does not work that way I mentioned with protocol stubs like you wanted in your update.I use Accessorizer for that, an app in the mac app store to fully implement the declaration of your delegate/protocol methods you want to implement. Hope that help a little bit.

Old post:

I use Tab for this.Example I often have:You want one of many init methods in the code completion.

Then you don't want to scroll down or use to many keystrokes to get to the right method.

Hit i > hit Tab > init is completed.

Hit Escape and then w and then again Tab for all these initWith methods.

You can even use Tab ⇥ / Escape after the first parameter, when there is more than the method with only one parameter.

In your case hit t > Tab > Escape > a and Return , there you got your third method.You can also jump to the previous code completion argument with Shift + Tab .