34

One of the few things I haven't figured out how to do in XCode that I could do in Visual Studio is list the parameters of a function. I've Googled this a few times now, and still haven't found an answer.

If I start typing out, for example round( I get a list of the parameters and its return type. However, if I already typed out the code

x = round(y);

and I cursor over to it, I don't know how to show parameter info without retyping it. Anyone know how the hotkey for this?

Mr. Smith
  • 4,288
  • 7
  • 40
  • 82

3 Answers3

35

Just discovered Option + Escape by browsing through the XCode Preferences Hotkeys section. It actually lists the parameter info in a tooltip (no other hotkey I've seen so far does this!), but isn't quite as friendly as Visual Studio's Ctrl+Shift+Space function. For instance, the text selection cursor (caret) must be on the function name (not on a parameter to that function).

Having explored the XCode hotkeys exhaustively, I'm going to assume that this is the best it gets in XCode.

Mr. Smith
  • 4,288
  • 7
  • 40
  • 82
  • The answer by Bijou (http://stackoverflow.com/a/14573747/424210) sounds more like the answer that Mr.Smith was looking for. He found a shortcut that displays function documentation inline without the auto-complete provided by Option + Esc. His is similar to *ctrl+J* in Intellij. – Clay Jul 21 '16 at 18:40
  • 6
    Xcode 9 -- Option+Escape just bring up suggestion of the function name, not the parameters list :( – Mike Keskinov Nov 16 '17 at 18:14
  • The shortcut that this answer is referring to is called **Show Completion List**. There is also **Show Completions**, default `crtl + Space` , which appears to do the same thing. Default for **Show Completions** doesn't work in Vim mode since it uses escape. Need to do both with your cursor in a place where another param could be inserted, e.g. right after a `,`. If you're at the end of params you have to manually add `, ` before completions will show. (Xcode 14). – RyanM Dec 01 '22 at 23:01
  • 1
    Also it's lame that xcode doesn't insert a selected completion in the correct order – RyanM Dec 01 '22 at 23:03
  • @RyanM This is so weird! And why do **named argments** need an order?!? – user1944491 Apr 21 '23 at 19:05
12

Control + Command + Shift + / is the keyboard equivalent of Option + click mentioned in other answers

Bijou Trouvaille
  • 8,794
  • 4
  • 39
  • 42
  • 15
    Could they make it anymore convoluted and finger twisting! Ugh. – spring Jan 29 '13 at 00:40
  • 3
    @skinnyTOD I can see your point, but it is the price apple chose to pay for them being coherent. I'm just discovering this myself, so I can comment little on it, but in essence each modifier is semantically significant. Command key signifies the main functions, Control is for more specific ones, while shift and alt are modifiers. So for example Control + Command + J is navigate to symbol Control + Command + Option + J will do so in the assistant window, add shift, and xcode will ask you where you want it to be. – Bijou Trouvaille Jan 29 '13 at 03:20
  • What is it named in keybinding? I wanted to update the shortcut but was unable to find it. – Alif Hasnain Jun 20 '22 at 11:31
7

Command + click the function will navigate you to the function definition, while Option + click brings up tooltip of function definition.

Raptor
  • 53,206
  • 45
  • 230
  • 366
  • 4
    I don't really want to navigate away from the page, I just want to bring up the tooltip. In Visual Studio, this could be done by cursoring to the function and hitting (I think) Shift+Space. – Mr. Smith Nov 19 '12 at 08:56
  • Option + click brings up tooltip – Raptor Nov 19 '12 at 08:58
  • 1
    Option+Click brings up a tooltip, but it's not very helpful. All it ever shows me is where the variable/function is defined. For example, with the round function, all it says is `"Declared in math.h"`. – Mr. Smith Nov 19 '12 at 09:02
  • because `round` function is not part of Xcode documentation (i.e. iOS SDK & Mac OS SDK), thus there is no documentation. – Raptor Nov 19 '12 at 09:26
  • 3
    Neither are functions that I write myself; those two hotkeys simply do not accomplish what I'm requesting. – Mr. Smith Nov 19 '12 at 09:33