C/C++ Snippet Extension
v1.0.2
该扩展为 Visual Studio Code 添加了 C/C++ 的代码片段。
This extension for Visual Studio Code adds snippets for C/C++.
用法 Usage
输入代码片段中的部分关键字,例如 "for",然后按下回车键。
Type a part of the keywords in snippet e.g., "for" and press enter.
for // 创建一个 for 循环片段 // Creates a for loop snippet
或者,也可以直接在编辑器中按下 <kbd>
Ctrl</kbd>
+ <kbd>
Space</kbd>
(适用于 Windows、Linux 或 Mac)来访问可用的代码片段。
Alternatively, one can also just press <kbd>
Ctrl</kbd>
+ <kbd>
Space</kbd>
(works on Windows, Linux, or Mac) to access the available snippets in the editor.
更新 Update
现在正在强制使用 UTF-8 格式和 LF 换行符,以及添加了 80 列和 120 列的提示
The current setting enforces the use of UTF-8 encoding and LF line endings, and also adds column hints for 80 and 120 characters.
添加了最新的注释代码片段:
The latest comment code snippets have been added:
增加了额外的列提示,这样你就知道你的代码的复杂度了(推荐与 Better Byte 一起使用)
Added extra column hints so you can be aware of your code complexity (recommended to use with Better Comment)
//struct // 创建一个结构体切分注释 // Creates a structure split comment
/* struct ----------------------------------------------------------------- 80 // ! ----------------------------- 120 */
// 注释缩进 4 个空格的位置 // comment indent 4 space
//4
/**/
// 注释缩进 8 个空格的位置 // comment indent 8 space
//8
/* 08 */
// 注释缩进 12 个空格的位置 // comment indent 12 space
//2
/* - 12 - */
// 注释缩进 16 个空格的位置 // comment indent 16 space
//6
/* --- 16 --- */
// 注释缩进 20 个空格的位置 // comment indent 20 space
//0
/* ----- 20 ----- */
安装 Installation
- 安装 Visual Studio Code 0.10.1 或更高版本;
Install Visual Studio Code 0.10.1 or higher
- 运行 VS Code;
Launch VS Code
- 输入
Ctrl
+Shift
+P
(Windows, Linux) 或 Cmd
+Shift
+P
(OSX);
From the command palette Ctrl
+Shift
+P
(Windows, Linux) or Cmd
+Shift
+P
(OSX)
- 输入
ext install
或者直接选择 Install Extension
;
Type ext install
or just simply select Install Extension
- 选择拓展 - Cpp Snippets Plus;
Choose the extension - Cpp Snippets Plus
- 重启 VS Code。
Relaunch VS Code
欢迎提出改进建议。
Suggestions for improvement are welcome.