When using autocomplete to fill in method arguments, most of the time there should be开发者_如何学Go 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 I understand you correctly, the right most answer would be that it should have made too much shortcuts to remember to autocomplete+semicolon, autocomplete+doubledot, autocomplete+parenthesis, etc. etc. while you can just autocomplete then hit a key (semicolon, doubledot, parenthesis, etc., etc.). If you really are ending most of you autocompletes with a semicolon you may then have a look at code completion macros and/or obdev completion dictionnary which includes custom macros.
I haven't seen such a shortcut. I usually just move my cursor manually; using option-right to jump to the end of the last word and then several right key presses to move by character.
A reason this isn't implemented may be because methods and functions are nested often, and that adding semicolons would void the nesting and then take more work to remove than manually adding them after each line.
Is this from a different SDK that you have used?
精彩评论