代码之家  ›  专栏  ›  技术社区  ›  gingerbreadboy

Visual Studio宏额外写入“标记”

  •  0
  • gingerbreadboy  · 技术社区  · 16 年前

    我想我应该用宏来加速写作 <xsl:choose> 阻碍。

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

    给我(感谢自动完成)

    <xsl:choose>
    
    </xsl:choose>
    

    然而

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

    给予

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

    在编辑器中。

    那个额外的“来自哪里?”?

    干杯

    2 回复  |  直到 16 年前
        1
  •  1
  •   MoJo2600    16 年前

    当您用\退出“”时会发生什么?

    DTE.ActiveDocument.Selection.Text = "<xsl:when test=\"true()\"/>"
    
        2
  •  0
  •   gingerbreadboy    16 年前

    呵呵,这是自动完成功能。当宏键入=符号时,IDE会添加引号并移动光标,然后宏会继续键入我不希望看到的地方。

    哦。

    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()