Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show a variable's type in AppCode

Tags:

appcode

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.

like image 865
s73v3r Avatar asked Apr 09 '13 18:04

s73v3r


3 Answers

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...

like image 41
DerWOK Avatar answered Jan 01 '23 09:01

DerWOK


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.

like image 147
YvesLeBorg Avatar answered Jan 01 '23 11:01

YvesLeBorg


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.

like image 33
Richard Brown Avatar answered Jan 01 '23 09:01

Richard Brown