Xcode 4 code block completion in C

Discussion in 'Mac Programming' started by Psylancer, Mar 10, 2011.

  1. Psylancer, Mar 10, 2011
    Last edited: Mar 10, 2011

    Psylancer macrumors newbie

    Joined:
    Dec 28, 2006
    #1
    In Xcode 3, in c (or c++) with code sense auto complete turned on, if you typed "for" or "if" or "printf" or some other common C/C++ section of code an autocomplete would pop up and allow you to hit tab to fill out the remainder of the statement. In Xcode 4 I can see many of these blocks in the "Code Snippet" in the new right hand side toolbar, and I can set a keybinding for these. But is there any way to get back the context aware autocomplete? I picked through the documentation, but everything is just touting how awesome the new autocomplete is when its turned on.

    Is what I am referring to called something besides autocomplete?
     
  2. sunkai macrumors newbie

    Joined:
    Nov 24, 2009
    #2
    I've noticed this too.

    +1 for a solution please.
     
  3. jiminaus macrumors 65816

    jiminaus

    Joined:
    Dec 16, 2010
    Location:
    Sydney
    #3
    If I type for, forin, if or ifelse, it does bring up the code snippet in the code completion popup.

    If I click and pause on a code snippet in the library, a popup appears. If I click on the Edit button, I can see what the completion shortcut is. For example, the "GCD: Dispatch Once" code snippet has the completion shortcut of dispatch_once.

    Not all the code snippets have completion shortcuts assigned to them by default, for example, the Reusable UITableView Cell snippet.

    I don't about these being context aware though.
     
  4. Mac Player macrumors regular

    Joined:
    Jan 19, 2006
    #4
    Interesting, some code snippet shortcuts work while others don't. For example "typedef" works but "for" and "dowhile" don't show completions.
     

Share This Page