Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>C/C++ Snippet ExtensionNew to Visual Studio Code? Get it now.
C/C++ Snippet Extension

C/C++ Snippet Extension

落羽行歌

|
95 installs
| (0) | Free
Code snippets for C/C++
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

C/C++ 代码片段扩展 (CppSnippetExtension)

v2.0.1 - 重大更新


VS Code Marketplace GitHub Repository License: GPL v3

该扩展为 Visual Studio Code 添加了 C/C++ 代码片段。
This extension adds C/C++ snippets for Visual Studio Code.


✨ 新功能

✅ 强制 UTF-8 + LF
Auto-enforces UTF-8 encoding and LF line endings

✅ 三列标尺 - 40/80/120 列自动显示
Auto column guides at 40/80/120


📖 使用方法

输入代码片段关键字,按 Enter / Tab 插入:

class // 完整类模板 | Complete class template //include // 完整的头文件分组 | Complete header grouping //function // 函数分组 | Function grouping

text


💡 示例

1. 类模板 | Class Template

#pragma region class
    #pragma region class::function
    #pragma region class::function::factory

    #pragma endregion class::function::factory

    #pragma region class::function::constructor

    #pragma endregion class::function::constructor
    ......
    #pragma endregion class::function

    #pragma region class::variable
    #pragma region class::variable::stardard

    #pragma endregion class::variable::stardard
    ......
    #pragma endregion class::variable
#pragma endregion class

2. 头文件分组 | Include Groups

#pragma region include
    #pragma region include::header

    #pragma endregion include::header

    #pragma region include::standard

    #pragma endregion include::standard

    #pragma region include::third

    #pragma endregion include::third

    #pragma region include::project

    #pragma endregion include::project
#pragma endregion include

3. 注释缩进 | Comment Indent

//4 → // | → 4 空格缩进 | 4-space indent
//8 → // - 8 | → 8 空格缩进 | 8-space indent
//12 → // ---- 12 | → 12 空格缩进 | 12-space indent

⚙️ 强制格式设置

开箱即用,无需配置 | Out of the box, no configuration needed

✅ UTF-8 编码 | UTF-8 encoding
✅ LF 换行符 | LF line endings
✅ 标尺 40/80/120 列 | Column guides 40/80/120


📦 安装步骤

  1. 安装 Visual Studio Code 1.50.0+
  2. 打开命令面板:Ctrl+Shift+P → Extensions: Install Extensions
  3. 搜索 "CppSnippetExtension"
  4. 安装并重启 VS Code

📧 反馈与支持

欢迎提交 Issue 或邮件反馈
Welcome to submit Issues or email feedback

📧 2481036245@qq.com


  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft