[英]How to position the cursor caret in Xcode code snippets
Is it possible to specify where the cursor should be after inserting a code snippet in xcode 4? 在xcode 4中插入代码片段后,是否可以指定光标所在的位置? Is there a <# #> style marker for this?
这有<##>样式标记吗? I'm having trouble finding good documentation on code snippets.
我无法在代码片段上找到好的文档。
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. 它会显示一个你可以选择的“气泡”,这不是理想的,但它会将光标插入移动到该位置。
Here are a couple examples supplementing @rdougan's helpful answer. 以下是一些补充@ rdougan的有用答案的例子。 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.
这不是OP在问题中提出的问题,但是当我根据标题来到这里时,它正是我所寻找的。
print("<#text#>")
gives you 给你
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.
只需在代码段区域中单击其中一个。
which gives 这使
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.
将弹出一个对话框,您可以在其中为其指定一个简单的快捷方式。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.