开发者

Visual Studio macro writes extra " mark

I thought i'd use a macro to speed up writing <xsl:choose> blocks.

DTE.ActiveDocument.Selection.Text = "<xsl:choose>"
DTE.ActiveDocument.Selection.NewLine()

gives me (thanks to auto complete)

开发者_Python百科
<xsl:choose>

</xsl:choose>

however

DTE.ActiveDocument.Selection.Text = "<xsl:choose>"
DTE.ActiveDocument.Selection.NewLine()
DTE.ActiveDocument.Selection.Text = "<xsl:when test=""true()"">"

gives

<xsl:choose>
  <xsl:when test="true()"></xsl:when>"
</xsl:choose>

in the editor.

Where is that extra " coming from??

Cheers


What happens when you escape the "" with \"

DTE.ActiveDocument.Selection.Text = "<xsl:when test=\"true()\"/>"


Hehe, it's the autocomplete. When the macro types the = symbol the ide adds the quote marks and moves the cursor, then the macro continues typing where i'm not expecting it to be.

D'oh.

DTE.ActiveDocument.Selection.Text = "<xsl:choose>"
DTE.ActiveDocument.Selection.NewLine()
DTE.ActiveDocument.Selection.Text = "<xsl:when test=true()"
DTE.ActiveDocument.Selection.EndOfLine()
DTE.ActiveDocument.Selection.Text = ">"
DTE.ActiveDocument.Selection.NewLine()
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜