Visual Studio 代码片段加行
Visual Studio code snippets extra line
我正在使用 Visual Studio(社区 2015)中的代码片段来自动化行 Debug.LogFormat("");
。该代码段正在运行,但它在开头添加了一个额外的空行(输入),因此使用带有 log
tabtab 的代码段将产生以下代码:
// blank line
Debug.LogFormat("");
而不是
Debug.LogFormat("");
这是我使用的代码段的 XML:
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets
xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Unity LogFormat</Title>
<Author>Faas</Author>
<Shortcut>log</Shortcut>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<Declarations>
<Literal>
<ID>Message</ID>
<ToolTip>Message</ToolTip>
<Default></Default>
</Literal>
</Declarations>
<Code Language="CSharp"><![CDATA[Debug.LogFormat("$Message$");]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
我可以通过在 Code
元素中放置 $end$
来解决问题。我不知道根本原因。试试看吧。
<Code Language="csharp"><![CDATA[Debug.LogFormat("$Message$");$end$]]>
查看有关 Code
元素的更多文档 here。
我正在使用 Visual Studio(社区 2015)中的代码片段来自动化行 Debug.LogFormat("");
。该代码段正在运行,但它在开头添加了一个额外的空行(输入),因此使用带有 log
tabtab 的代码段将产生以下代码:
// blank line
Debug.LogFormat("");
而不是
Debug.LogFormat("");
这是我使用的代码段的 XML:
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets
xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Unity LogFormat</Title>
<Author>Faas</Author>
<Shortcut>log</Shortcut>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<Declarations>
<Literal>
<ID>Message</ID>
<ToolTip>Message</ToolTip>
<Default></Default>
</Literal>
</Declarations>
<Code Language="CSharp"><![CDATA[Debug.LogFormat("$Message$");]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
我可以通过在 Code
元素中放置 $end$
来解决问题。我不知道根本原因。试试看吧。
<Code Language="csharp"><![CDATA[Debug.LogFormat("$Message$");$end$]]>
查看有关 Code
元素的更多文档 here。