Visual Studio中的C++代码段支持?

Jer*_*ell 12 c++ visual-studio code-snippets

我正在用本机C++(而不是C++/CLR)编写代码.我知道在片段管理器和片段选择器接口方面没有内置的C++支持,但是我发现了一个名为"snippy"的实用程序,它可以生成C++片段.这是程序生成的c ++代码段:

<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <Title>MySnippet</Title>
      <Shortcut>MySnippet</Shortcut>
      <Description>Just a test snippet</Description>
      <Author>Me</Author>
      <SnippetTypes>
        <SnippetType>Expansion</SnippetType>
      </SnippetTypes>
    </Header>
    <Snippet>
      <Declarations>
        <Literal Editable="true">
          <ID>literal1</ID>
          <ToolTip>just a placeholder</ToolTip>
          <Default>
          </Default>
          <Function>
          </Function>
        </Literal>
      </Declarations>
      <Code Language="cpp"><![CDATA[cout << "$literal1$" << std::endl;]]></Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>
Run Code Online (Sandbox Code Playgroud)

如果在Visual C++中有支持,即使在有限的容量中,对于C++片段,如何将它们添加到我的环境中,以及有哪些限制?我只需要支持基本的扩展片段,我可以通过键入快捷键和点击标签来调用它,并支持我可以选中的基本文字(基本上,如果它支持上面的片段,我很好).如果无法做到这一点,是否有支持C++片段的Visual Studio的免费附加组件或扩展?我正在使用Visual Studio 2010和2008,但我现在主要在2010年编写代码.

sea*_*n e 7

视觉协助Snippets特点是不太一样的IDE片段的功能.它有其优点和缺点,但在C++中有效.


Mat*_*ela 6

Visual Studio 2012现在包含C++的代码段功能.


小智 5

很多插件可用于VS2010.我建议使用snip2code,新的,免费且非常有用.我需要一种方法来快速处理我的代码片段并搜索浏览网页......它可以很好地完成工作.