Zrobiłem niestandardowy fragment do użycia w Visual Studio. W VS2013 działało to zgodnie z oczekiwaniami, ale od czasu użycia go w VS2015 (wydanie społecznościowe) wstawiono dodatkowy znak nowego wiersza przed kodem (po prawej stronie, gdy wciskam klawisz tab/wpisz drugi raz).Snippet wstawia dodatkowy znak nowej linii w VS2015
To wydaje się być problemem tylko z kodem niestandardowym (wbudowane działają bez zarzutu). Ktoś wie, co może być przyczyną tego? To jest bardzo irytujące.
Może to się zdarzyć tylko wtedy, gdy aktywuję fragment kodu w pustym wierszu kodu. Jeśli zrobię to po istniejącym kodzie, znak nowej linii nie zostanie wstawiony. Niestety, fragment jest oświadczeniem, więc to niewiele pomaga.
Oto urywek, kopiowane niemal całkowicie z próbki 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>
Możliwy duplikat [Visual Studio kod urywki dodatkowy wiersz] (https://stackoverflow.com/questions/33297458/visual-studio-code-snippets-extra-line) –