mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-08-14 21:22:40 +03:00
Add user-defined snippet support to the autocomplete plugin, including language-specific, global, .vscode, and .ecode project snippets. Support JSONC parsing, scopes, hot reload, source-aware ranking, exact prefix replacement, multi-cursor insertion, contextual indentation, variables, transforms, choices, linked placeholders, and tab navigation. Recognize .code-snippets files as JSON and preserve existing LSP snippet completion behavior. Refs SpartanJ/ecode#111
58 lines
1.2 KiB
Plaintext
58 lines
1.2 KiB
Plaintext
{
|
|
"Main Function": {
|
|
"scope": "c,cpp",
|
|
"prefix": ["main", "mainfn"],
|
|
"body": [
|
|
"int main(int argc, char** argv) {",
|
|
"\t${1:(void)argc;}",
|
|
"\t${2:(void)argv;}",
|
|
"\t$0",
|
|
"\treturn 0;",
|
|
"}"
|
|
],
|
|
"description": "Program entry point"
|
|
},
|
|
"Indexed For Loop": {
|
|
"scope": "c,cpp",
|
|
"prefix": ["fori", "for-index"],
|
|
"body": [
|
|
"for (${1:size_t} ${2:i} = 0; $2 < ${3:count}; ++$2) {",
|
|
"\t$0",
|
|
"}"
|
|
],
|
|
"description": "Indexed loop with linked iterator placeholders"
|
|
},
|
|
"Include Header": {
|
|
"scope": "c,cpp",
|
|
"prefix": "inc",
|
|
"body": "#include ${1|<stdio.h>,<stdlib.h>,<string.h>,\"header.h\"|}$0",
|
|
"description": "Include a common system header or a local header"
|
|
},
|
|
"Guard Clause": {
|
|
"scope": "c,cpp",
|
|
"prefix": "guard",
|
|
"body": [
|
|
"if (${1:condition}) {",
|
|
"\t${2:return;}",
|
|
"}",
|
|
"$0"
|
|
],
|
|
"description": "Early-return guard clause"
|
|
},
|
|
"C++ Class": {
|
|
"scope": "cpp",
|
|
"prefix": "class",
|
|
"body": [
|
|
"class ${1:${TM_FILENAME_BASE}} {",
|
|
" public:",
|
|
"\t$1(${2});",
|
|
"\t~$1();",
|
|
"",
|
|
" private:",
|
|
"\t$0",
|
|
"};"
|
|
],
|
|
"description": "Class named after the current file with linked placeholders"
|
|
}
|
|
}
|