Visual Studioで使用するためのカスタムスニペットを作成しました。 VS2013では、期待通りに動作しましたが、VS2015(Community Edition)で使用して以来、コードの前に余分な改行を挿入しています(右のタブを押す/ 2回目に入ります)。スニペットでVS2015に余分な改行が挿入される
これはカスタムスニペット(組み込みのものが正常に動作する)にのみ問題があるようです。誰がこれを引き起こしているのか知っていますか?それは非常に迷惑です。
これは、コードの空の行でスニペットを有効にしている場合にのみ発生します。既存のコードの後に改行した場合、改行は挿入されません。残念ながら、スニペットはステートメントなので、これはあまり役に立ちません。
はここでVSサンプルからほぼ完全にコピーしたスニペット、です:
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/CodeSnippet">
<CodeSnippet Format="1.0.0">
<!-- The header contains information describing the snippet. -->
<Header>
<!-- The Title of the snippet, this will be shown in the snippets manager. -->
<Title>Insert Field Add</Title>
<!-- The description of the snippet. -->
<Description>Inserts a basic field add for a DataObject</Description>
<!-- The author of the snippet. -->
<Author>Thomas Price</Author>
<!-- The set of characters that must be keyed in to insert the snippet. -->
<Shortcut>fadd</Shortcut>
<!-- The set of snippet types we're dealing with - either Expansion or -->
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
</Header>
<!-- Now we have the snippet itself. -->
<Snippet>
<!-- Create any declarations that we use in the snippet. -->
<Declarations>
<Literal>
<ID>FieldName</ID>
<ToolTip>Enter the field name</ToolTip>
<Default>field</Default>
</Literal>
</Declarations>
<!-- Sepecify the code language and the actual snippet content. -->
<Code Language="CSharp" Kind="any">
<![CDATA[$FieldName$ = fields.add($FieldName$, "$FieldName$");]]>
</Code>
</Snippet>
</CodeSnippet>
可能な重複[Visual Studioのコードは、余分な行をスニペット](https://stackoverflow.com/questions/33297458/visual-studio-code-snippets-extra-line) –