Question

Is there a shortcut to quickly show the type of a variable in JetBrains' AppCode? Preferably this would be something akin to Visual Studio, which shows the type of a variable when you hover over it with the mouse.

Was it helpful?

Solution

Alternately, if you hold the command key while hovering, you can hover the variable to have the executive summary info bubble. By then clicking the keyword (not the info-bubble) you can then get 'beamed over' to the code that declares or implements the specific interface. For example, in the following line :

[fa.AoEspec addTileSpec:[AoEtile AoEtileFromString:@"0,0,50,hit"]];

I will get an 'info bubble' for fa (local variable), AoeSpec (a property) AoEtile (a class) AoeTileFromString ... all clickable.

OTHER TIPS

You can press SHIFT-COMMAND I to see the definition of the variable under the cursor. It shows you the line that defines the variable, as well as which file. Pretty handy when looking at code you didn't write.

In AppCode 2.1.x Cmd+Shift+I is not a predefined keyboard shortcut (anymore?!). And the previous mentioned Cmd+MouseOver may not be suitable for keyboard-only-junkies. So here come some alternatives:

  • Cmd+B - to go to the definition (and Cmd+Alt+CursorLeft to go back)
  • Alt+Space or Cmd+y - to show the quick definition window [1]

Maybe this is helpful.

[1] In AppCode 2.1.2 there seems to be a bug I filed with JetBrains that the quick definition window is empty for iVars (these underscore variables that are generate by auto-synthesize from @property fields). But in all other cases quick definition window works fine! And maybe the bug is fixed when you read this...

What works for me in AppCode 2018.2 is control + command + ? when the variable is under the cursor (quick documentation under View). You can see a couple of other useful combinations under the View menu.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top