When using autocomplete to fill in method arguments, most of the time there should be a semicolon at the end.
It seems like there must be some keyboard shortcut to put in the semicolon (and maybe a newline) at the end but I can't find it!
Thanks.
edit: Maybe the question isn't clear, when finishing an autocomplete method the cursor looks like this:
someMethod(argument1, argument2 )
^ cursor here
Maybe its just because I'm not used to the macbook keyboard, or because my muscle memory wants to use "end" rather than right-arrow or command right-arrow. But since the IDE is already helping me jump around the code with tab it would be nice to be able to return and have the semicolon get added, or at least move to the right of the close paren.
XCode supports (many) Emacs-style keyboard navigation commands. In particular, you can use ctrl-e to jump the cursor to the end of the line, where you can then place the semicolon.
I know this behavior from eclipse. It autocompletes something then you just hit enter and then the curser is after autocopleted code and then you can type semicolon.
I just saw your question while searching something like that behavior and could not find really something, how can I achieve that.
It is really annoying to move your right hand on arrow keys while you are writing. Not exactly what you are looking for but, helps:
From the preferences of xcode I set a shortcut for "Move to Right End of Line" shift+enter. After auto completion just hit shift+enter, it is better then using arrow keys for me.
One option you have in XCode 4 (tested on 4.5.2) is to bind (Preferences → Key Bindings) the "Fix Next Issue (Navigate Menu)" command to a sensible keystroke.
Note that it's locked as the control-toggled-alternate of the "Jump to Next Issue ("Navigate Menu)" command so you'll have to play with that to find something you like. Personally, I use ctrl+shift+enter for this bind.
printf("hello, world" ) => <key binding> => printf("hello, world");
^ ^
You may also want to take a look at "Fix Previous Issue..." and "Fix All in Scope..." commands.
You can type a semicolon and press CTRL+T to transpose the two characters.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With