Delphi 实时模板用括号将选择包围起来
我正在尝试制作一个 Delphi 实时模板(在 D2010 中)以用 () 包围选择。我当前的尝试如下所示:
<code language="Delphi" delimiter="|"><![CDATA[(|selected|)]]>
它几乎可以工作,但会增加额外的空白。如果我有一个像这样的代码行:
if blah = 5 then
并且我只选择了 blah = 5 部分并调用了我的模板,我希望它的结果是这样的:
if (blah = 5) then
但它最终是有
if ( blah = 5) then
什么建议吗?
编辑:这是整个模板:
<?xml version="1.0" encoding="utf-8" ?>
<codetemplate xmlns="http://schemas.borland.com/Delphi/2005/codetemplates"
version="1.0.0">
<template name="(" surround="true" invoke="none">
<description>
Surround selection by parentheses
</description>
<author>
Mark Ford
</author>
<code language="Delphi" delimiter="|"><![CDATA[(|selected|)]]>
</code>
</template>
</codetemplate>
I'm trying to make a Delphi live template (in D2010) to surround a selection with (). My current attempt looks like:
<code language="Delphi" delimiter="|"><![CDATA[(|selected|)]]>
and it almost works but puts in extra whitespace. If I have a code line like:
if blah = 5 then
and I selected just the blah = 5 part and invoked my template I'd like it to come out like:
if (blah = 5) then
but it ends up being
if ( blah = 5) then
Any suggestions?
Edit: Here's the entire template:
<?xml version="1.0" encoding="utf-8" ?>
<codetemplate xmlns="http://schemas.borland.com/Delphi/2005/codetemplates"
version="1.0.0">
<template name="(" surround="true" invoke="none">
<description>
Surround selection by parentheses
</description>
<author>
Mark Ford
</author>
<code language="Delphi" delimiter="|"><![CDATA[(|selected|)]]>
</code>
</template>
</codetemplate>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这似乎是模板中的错误。它已作为 QC #21276 提交。
https:// web.archive.org/web/20171221035806/http://qc.embarcadero.com/wc/qcmain.aspx?d=21276
This appears to be a bug in the templates. It has been submitted as QC #21276.
https://web.archive.org/web/20171221035806/http://qc.embarcadero.com/wc/qcmain.aspx?d=21276