11

I've just started using code snippets for the first time, i've added a snippet, set the shortcut, but when I type the shortcut and hit Esc - it doesn't show up. What am I doing wrong? I've tried restarting Xcode too but it still doesn't work. Shortcuts to the other code snippers work fine.

1
  • 2
    This happened to me, I tried restarting XCode and all of the suggestions below. Nothing worked so I gave up. 30 mins of coding later, the completion starts working. I have no explanation. Commented Mar 18, 2014 at 12:40

5 Answers 5

19

I had same issue, I was not able to get code snippet while start typing. I figure out while editing code snippet I have not mentioned Completion filed and that was the issue.

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

6

When I worked with the code snippet functionality built into Xcode for the first time, I had trouble finding the right "Completion Scope". You could change it to "All" to find out if it's a mistake in there. But in your case I can see you want to post methods so "Top Level" should be alright. Just keep it in mind for the future.

1 Comment

It worked when I changed it to All - I tried that before and it didn't work, created a new snippet and then it worked, and magically so did this snippet. Very odd!
3

Yes. It seems like an Xcode bug. Actually my Xcode crashed when i changed the scope.

So workaround:

  1. Create new snippet.

  2. Change scope to "All" before clicking on "Done"

  3. Voila it works now.

Comments

1

It doesn't seem working for me on Xcode 6.1. I'm pretty sure about the scope but it is also not working with All scope option set. Though, I've been using snippets with the prior versions of Xcode without any issue.

Comments

1

In Xcode 15.X remember to add your alias into the Completion field otherwise nothing will appear.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.