How to position the cursor caret in Xcode code snippets
Asked Answered
H

2

10

Is it possible to specify where the cursor should be after inserting a code snippet in xcode 4? Is there a <# #> style marker for this? I'm having trouble finding good documentation on code snippets.

Hemoglobin answered 17/9, 2011 at 19:59 Comment(0)
S
14

You can just use <##>. It will show a "bubble" you can select, which isn't ideal, but it does move the cursor caret to that location.

Sycamine answered 20/11, 2011 at 5:11 Comment(0)
C
3

Here are a couple examples supplementing @rdougan's helpful answer. This is not exactly what the OP was asking in the question, but it is what I was looking for when I came here based on the title.

Custom Example

print("<#text#>")

gives you

enter image description here

Standard Example

You can also observe any of the standard code snippets to see how they are made. Just click one of them in the code snippet area.

enter image description here

which gives

enter image description here

Reminder on how to add custom code snippets:

Write your code as normal in the code editor. Then highlight it and drag it into the code snippet window. A dialog box will pop up where you can give it a simple shortcut.

enter image description here

Complect answered 9/6, 2016 at 1:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.