@enjoys/context-engine 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/data/commands/adb.json +322 -0
  2. package/data/commands/alembic.json +301 -0
  3. package/data/commands/artisan.json +277 -0
  4. package/data/commands/atlas.json +426 -0
  5. package/data/commands/auth0.json +648 -0
  6. package/data/commands/bat.json +84 -0
  7. package/data/commands/btop.json +59 -0
  8. package/data/commands/bundle.json +321 -0
  9. package/data/commands/composer.json +507 -0
  10. package/data/commands/dart.json +216 -0
  11. package/data/commands/dbmate.json +257 -0
  12. package/data/commands/docker-compose.json +384 -0
  13. package/data/commands/drizzle-kit.json +217 -0
  14. package/data/commands/expo.json +65 -0
  15. package/data/commands/fastlane.json +243 -0
  16. package/data/commands/fd.json +86 -0
  17. package/data/commands/flutter.json +298 -0
  18. package/data/commands/flyway.json +261 -0
  19. package/data/commands/fzf.json +103 -0
  20. package/data/commands/gem.json +267 -0
  21. package/data/commands/htop.json +56 -0
  22. package/data/commands/jq.json +100 -0
  23. package/data/commands/k9s.json +62 -0
  24. package/data/commands/linux.json +3007 -0
  25. package/data/commands/liquibase.json +399 -0
  26. package/data/commands/manifest.json +619 -0
  27. package/data/commands/minikube.json +60 -0
  28. package/data/commands/ng.json +64 -0
  29. package/data/commands/nuxt.json +60 -0
  30. package/data/commands/nvim.json +91 -0
  31. package/data/commands/php.json +157 -0
  32. package/data/commands/pm2.json +259 -0
  33. package/data/commands/pod.json +175 -0
  34. package/data/commands/prisma.json +257 -0
  35. package/data/commands/rails.json +372 -0
  36. package/data/commands/rake.json +360 -0
  37. package/data/commands/react-native.json +57 -0
  38. package/data/commands/rg.json +103 -0
  39. package/data/commands/rspec.json +257 -0
  40. package/data/commands/ruby.json +108 -0
  41. package/data/commands/screen.json +101 -0
  42. package/data/commands/sequelize.json +342 -0
  43. package/data/commands/snyk.json +442 -0
  44. package/data/commands/sonar-scanner.json +219 -0
  45. package/data/commands/stripe.json +314 -0
  46. package/data/commands/symfony.json +449 -0
  47. package/data/commands/tmux.json +197 -0
  48. package/data/commands/top.json +61 -0
  49. package/data/commands/trivy.json +367 -0
  50. package/data/commands/twilio.json +382 -0
  51. package/data/commands/typeorm.json +262 -0
  52. package/data/commands/vim.json +85 -0
  53. package/data/commands/vue.json +60 -0
  54. package/data/commands/wp.json +857 -0
  55. package/data/commands/xcodebuild.json +141 -0
  56. package/data/commands/yq.json +57 -0
  57. package/data/completion/bash.json +1184 -0
  58. package/data/completion/c.json +1067 -0
  59. package/data/completion/cpp.json +824 -0
  60. package/data/completion/csharp.json +860 -0
  61. package/data/completion/dockerfile.json +536 -0
  62. package/data/completion/go.json +1346 -0
  63. package/data/completion/html.json +806 -0
  64. package/data/completion/java.json +1112 -0
  65. package/data/completion/javascript.json +914 -0
  66. package/data/completion/lua.json +968 -0
  67. package/data/completion/php.json +1535 -0
  68. package/data/completion/python.json +1427 -0
  69. package/data/completion/ruby.json +1531 -0
  70. package/data/completion/rust.json +698 -0
  71. package/data/completion/sql.json +887 -0
  72. package/data/completion/toml.json +428 -0
  73. package/data/completion/typescript.json +338 -0
  74. package/data/completion/yaml.json +563 -0
  75. package/data/defination/bash.json +565 -0
  76. package/data/defination/c.json +865 -0
  77. package/data/defination/cpp.json +348 -0
  78. package/data/defination/csharp.json +144 -0
  79. package/data/defination/dockerfile.json +113 -0
  80. package/data/defination/go.json +561 -0
  81. package/data/defination/html.json +559 -0
  82. package/data/defination/java.json +184 -0
  83. package/data/defination/javascript.json +265 -0
  84. package/data/defination/lua.json +181 -0
  85. package/data/defination/php.json +726 -0
  86. package/data/defination/python.json +717 -0
  87. package/data/defination/ruby.json +670 -0
  88. package/data/defination/rust.json +207 -0
  89. package/data/defination/sql.json +473 -0
  90. package/data/defination/toml.json +251 -0
  91. package/data/defination/typescript.json +29 -0
  92. package/data/defination/yaml.json +197 -0
  93. package/data/hover/bash.json +245 -0
  94. package/data/hover/c.json +265 -0
  95. package/data/hover/cpp.json +210 -0
  96. package/data/hover/csharp.json +290 -0
  97. package/data/hover/dockerfile.json +145 -0
  98. package/data/hover/go.json +580 -0
  99. package/data/hover/html.json +250 -0
  100. package/data/hover/java.json +395 -0
  101. package/data/hover/javascript.json +330 -0
  102. package/data/hover/lua.json +265 -0
  103. package/data/hover/php.json +300 -0
  104. package/data/hover/python.json +380 -0
  105. package/data/hover/ruby.json +265 -0
  106. package/data/hover/rust.json +275 -0
  107. package/data/hover/sql.json +230 -0
  108. package/data/hover/toml.json +145 -0
  109. package/data/hover/typescript.json +120 -0
  110. package/data/hover/yaml.json +165 -0
  111. package/data/manifest.json +242 -0
  112. package/package.json +1 -1
@@ -0,0 +1,1067 @@
1
+ {
2
+ "language": "c",
3
+ "completions": [
4
+ {
5
+ "label": "printf",
6
+ "kind": 1,
7
+ "detail": "Print formatted output to stdout",
8
+ "documentation": { "value": "Writes formatted output to stdout.\n\n```c\nprintf(\"Hello %s, age %d\\n\", name, age);\nprintf(\"%.2f\\n\", 3.14159);\n```" },
9
+ "insertText": "printf(\"${1:format}\", ${2:args})",
10
+ "insertTextRules": 4,
11
+ "sortText": "00_printf"
12
+ },
13
+ {
14
+ "label": "scanf",
15
+ "kind": 1,
16
+ "detail": "Read formatted input from stdin",
17
+ "documentation": { "value": "Reads formatted input from stdin.\n\n```c\nint n;\nscanf(\"%d\", &n);\nchar name[50];\nscanf(\"%49s\", name);\n```" },
18
+ "insertText": "scanf(\"${1:format}\", ${2:&var})",
19
+ "insertTextRules": 4,
20
+ "sortText": "00_scanf"
21
+ },
22
+ {
23
+ "label": "fprintf",
24
+ "kind": 1,
25
+ "detail": "Print formatted output to a stream",
26
+ "documentation": { "value": "Writes formatted output to a file stream.\n\n```c\nFILE *fp = fopen(\"log.txt\", \"w\");\nfprintf(fp, \"Error code: %d\\n\", code);\nfprintf(stderr, \"Error: %s\\n\", msg);\n```" },
27
+ "insertText": "fprintf(${1:stream}, \"${2:format}\", ${3:args})",
28
+ "insertTextRules": 4,
29
+ "sortText": "00_fprintf"
30
+ },
31
+ {
32
+ "label": "fscanf",
33
+ "kind": 1,
34
+ "detail": "Read formatted input from a stream",
35
+ "documentation": { "value": "Reads formatted input from a file stream.\n\n```c\nFILE *fp = fopen(\"data.txt\", \"r\");\nint x;\nfscanf(fp, \"%d\", &x);\n```" },
36
+ "insertText": "fscanf(${1:stream}, \"${2:format}\", ${3:&var})",
37
+ "insertTextRules": 4,
38
+ "sortText": "00_fscanf"
39
+ },
40
+ {
41
+ "label": "sprintf",
42
+ "kind": 1,
43
+ "detail": "Print formatted output to a string",
44
+ "documentation": { "value": "Writes formatted output to a character string buffer.\n\n```c\nchar buf[256];\nsprintf(buf, \"Name: %s, Score: %d\", name, score);\n```" },
45
+ "insertText": "sprintf(${1:buf}, \"${2:format}\", ${3:args})",
46
+ "insertTextRules": 4,
47
+ "sortText": "00_sprintf"
48
+ },
49
+ {
50
+ "label": "snprintf",
51
+ "kind": 1,
52
+ "detail": "Print formatted output to a string with size limit",
53
+ "documentation": { "value": "Writes formatted output to a buffer with a maximum size to prevent overflow.\n\n```c\nchar buf[64];\nsnprintf(buf, sizeof(buf), \"Value: %d\", val);\n```" },
54
+ "insertText": "snprintf(${1:buf}, ${2:size}, \"${3:format}\", ${4:args})",
55
+ "insertTextRules": 4,
56
+ "sortText": "00_snprintf"
57
+ },
58
+ {
59
+ "label": "fopen",
60
+ "kind": 1,
61
+ "detail": "Open a file",
62
+ "documentation": { "value": "Opens a file and returns a FILE pointer.\n\n```c\nFILE *fp = fopen(\"data.txt\", \"r\");\nif (fp == NULL) {\n perror(\"fopen\");\n return 1;\n}\n```\nModes: \"r\" read, \"w\" write, \"a\" append, \"rb\" binary read, \"wb\" binary write." },
63
+ "insertText": "fopen(\"${1:filename}\", \"${2:r}\")",
64
+ "insertTextRules": 4,
65
+ "sortText": "00_fopen"
66
+ },
67
+ {
68
+ "label": "fclose",
69
+ "kind": 1,
70
+ "detail": "Close a file",
71
+ "documentation": { "value": "Closes an open file stream and flushes the buffer.\n\n```c\nfclose(fp);\n```" },
72
+ "insertText": "fclose(${1:fp})",
73
+ "insertTextRules": 4,
74
+ "sortText": "00_fclose"
75
+ },
76
+ {
77
+ "label": "fread",
78
+ "kind": 1,
79
+ "detail": "Read binary data from a file",
80
+ "documentation": { "value": "Reads binary data from a file stream.\n\n```c\nchar buf[1024];\nsize_t n = fread(buf, 1, sizeof(buf), fp);\n```" },
81
+ "insertText": "fread(${1:ptr}, ${2:size}, ${3:count}, ${4:stream})",
82
+ "insertTextRules": 4,
83
+ "sortText": "00_fread"
84
+ },
85
+ {
86
+ "label": "fwrite",
87
+ "kind": 1,
88
+ "detail": "Write binary data to a file",
89
+ "documentation": { "value": "Writes binary data to a file stream.\n\n```c\nfwrite(data, sizeof(int), count, fp);\n```" },
90
+ "insertText": "fwrite(${1:ptr}, ${2:size}, ${3:count}, ${4:stream})",
91
+ "insertTextRules": 4,
92
+ "sortText": "00_fwrite"
93
+ },
94
+ {
95
+ "label": "fgets",
96
+ "kind": 1,
97
+ "detail": "Read a line from a stream",
98
+ "documentation": { "value": "Reads a line from a file stream into a buffer.\n\n```c\nchar line[256];\nwhile (fgets(line, sizeof(line), fp) != NULL) {\n printf(\"%s\", line);\n}\n```" },
99
+ "insertText": "fgets(${1:buf}, ${2:size}, ${3:stream})",
100
+ "insertTextRules": 4,
101
+ "sortText": "00_fgets"
102
+ },
103
+ {
104
+ "label": "fputs",
105
+ "kind": 1,
106
+ "detail": "Write a string to a stream",
107
+ "documentation": { "value": "Writes a string to a file stream without a trailing newline.\n\n```c\nfputs(\"Hello, World!\\n\", fp);\n```" },
108
+ "insertText": "fputs(${1:str}, ${2:stream})",
109
+ "insertTextRules": 4,
110
+ "sortText": "00_fputs"
111
+ },
112
+ {
113
+ "label": "fseek",
114
+ "kind": 1,
115
+ "detail": "Set file position indicator",
116
+ "documentation": { "value": "Sets the file position indicator for a stream.\n\n```c\nfseek(fp, 0, SEEK_SET); // beginning\nfseek(fp, 0, SEEK_END); // end\nfseek(fp, offset, SEEK_CUR); // relative\n```" },
117
+ "insertText": "fseek(${1:stream}, ${2:offset}, ${3:SEEK_SET})",
118
+ "insertTextRules": 4,
119
+ "sortText": "00_fseek"
120
+ },
121
+ {
122
+ "label": "ftell",
123
+ "kind": 1,
124
+ "detail": "Get current file position",
125
+ "documentation": { "value": "Returns the current file position indicator.\n\n```c\nlong pos = ftell(fp);\n```" },
126
+ "insertText": "ftell(${1:stream})",
127
+ "insertTextRules": 4,
128
+ "sortText": "00_ftell"
129
+ },
130
+ {
131
+ "label": "rewind",
132
+ "kind": 1,
133
+ "detail": "Reset file position to beginning",
134
+ "documentation": { "value": "Resets the file position to the beginning of the file.\n\n```c\nrewind(fp);\n```" },
135
+ "insertText": "rewind(${1:stream})",
136
+ "insertTextRules": 4,
137
+ "sortText": "00_rewind"
138
+ },
139
+ {
140
+ "label": "feof",
141
+ "kind": 1,
142
+ "detail": "Check end-of-file indicator",
143
+ "documentation": { "value": "Tests the end-of-file indicator for a stream.\n\n```c\nwhile (!feof(fp)) {\n fgets(line, sizeof(line), fp);\n}\n```" },
144
+ "insertText": "feof(${1:stream})",
145
+ "insertTextRules": 4,
146
+ "sortText": "00_feof"
147
+ },
148
+ {
149
+ "label": "fflush",
150
+ "kind": 1,
151
+ "detail": "Flush a stream",
152
+ "documentation": { "value": "Flushes the output buffer of a stream.\n\n```c\nfflush(stdout);\nfflush(fp);\n```" },
153
+ "insertText": "fflush(${1:stream})",
154
+ "insertTextRules": 4,
155
+ "sortText": "00_fflush"
156
+ },
157
+ {
158
+ "label": "perror",
159
+ "kind": 1,
160
+ "detail": "Print error message",
161
+ "documentation": { "value": "Prints a descriptive error message to stderr based on errno.\n\n```c\nFILE *fp = fopen(\"missing.txt\", \"r\");\nif (!fp) {\n perror(\"fopen\");\n}\n```" },
162
+ "insertText": "perror(\"${1:msg}\")",
163
+ "insertTextRules": 4,
164
+ "sortText": "00_perror"
165
+ },
166
+ {
167
+ "label": "malloc",
168
+ "kind": 1,
169
+ "detail": "Allocate memory",
170
+ "documentation": { "value": "Allocates a block of uninitialized memory on the heap.\n\n```c\nint *arr = (int *)malloc(n * sizeof(int));\nif (arr == NULL) {\n perror(\"malloc\");\n exit(1);\n}\nfree(arr);\n```" },
171
+ "insertText": "malloc(${1:size})",
172
+ "insertTextRules": 4,
173
+ "sortText": "00_malloc"
174
+ },
175
+ {
176
+ "label": "calloc",
177
+ "kind": 1,
178
+ "detail": "Allocate and zero-initialize memory",
179
+ "documentation": { "value": "Allocates memory for an array and initializes all bytes to zero.\n\n```c\nint *arr = (int *)calloc(n, sizeof(int));\nif (!arr) {\n perror(\"calloc\");\n exit(1);\n}\nfree(arr);\n```" },
180
+ "insertText": "calloc(${1:count}, ${2:size})",
181
+ "insertTextRules": 4,
182
+ "sortText": "00_calloc"
183
+ },
184
+ {
185
+ "label": "realloc",
186
+ "kind": 1,
187
+ "detail": "Reallocate memory block",
188
+ "documentation": { "value": "Resizes a previously allocated memory block.\n\n```c\nint *tmp = (int *)realloc(arr, new_size * sizeof(int));\nif (!tmp) {\n perror(\"realloc\");\n free(arr);\n exit(1);\n}\narr = tmp;\n```" },
189
+ "insertText": "realloc(${1:ptr}, ${2:new_size})",
190
+ "insertTextRules": 4,
191
+ "sortText": "00_realloc"
192
+ },
193
+ {
194
+ "label": "free",
195
+ "kind": 1,
196
+ "detail": "Free allocated memory",
197
+ "documentation": { "value": "Deallocates previously allocated memory.\n\n```c\nfree(ptr);\nptr = NULL;\n```" },
198
+ "insertText": "free(${1:ptr})",
199
+ "insertTextRules": 4,
200
+ "sortText": "00_free"
201
+ },
202
+ {
203
+ "label": "exit",
204
+ "kind": 1,
205
+ "detail": "Terminate the program",
206
+ "documentation": { "value": "Terminates the calling process with the given exit status.\n\n```c\nexit(EXIT_SUCCESS);\nexit(EXIT_FAILURE);\n```" },
207
+ "insertText": "exit(${1:EXIT_SUCCESS})",
208
+ "insertTextRules": 4,
209
+ "sortText": "00_exit"
210
+ },
211
+ {
212
+ "label": "abort",
213
+ "kind": 1,
214
+ "detail": "Abort the program abnormally",
215
+ "documentation": { "value": "Causes abnormal program termination by raising SIGABRT.\n\n```c\nabort();\n```" },
216
+ "insertText": "abort()",
217
+ "insertTextRules": 4,
218
+ "sortText": "00_abort"
219
+ },
220
+ {
221
+ "label": "atoi",
222
+ "kind": 1,
223
+ "detail": "Convert string to integer",
224
+ "documentation": { "value": "Converts a string to an integer. No error handling — prefer strtol.\n\n```c\nint n = atoi(\"42\");\n```" },
225
+ "insertText": "atoi(${1:str})",
226
+ "insertTextRules": 4,
227
+ "sortText": "00_atoi"
228
+ },
229
+ {
230
+ "label": "atof",
231
+ "kind": 1,
232
+ "detail": "Convert string to double",
233
+ "documentation": { "value": "Converts a string to a double. No error handling — prefer strtod.\n\n```c\ndouble d = atof(\"3.14\");\n```" },
234
+ "insertText": "atof(${1:str})",
235
+ "insertTextRules": 4,
236
+ "sortText": "00_atof"
237
+ },
238
+ {
239
+ "label": "strtol",
240
+ "kind": 1,
241
+ "detail": "Convert string to long integer",
242
+ "documentation": { "value": "Converts a string to a long integer with error detection.\n\n```c\nchar *end;\nlong val = strtol(\"123abc\", &end, 10);\nif (*end != '\\0') {\n printf(\"Trailing chars: %s\\n\", end);\n}\n```" },
243
+ "insertText": "strtol(${1:str}, ${2:&endptr}, ${3:10})",
244
+ "insertTextRules": 4,
245
+ "sortText": "00_strtol"
246
+ },
247
+ {
248
+ "label": "strtod",
249
+ "kind": 1,
250
+ "detail": "Convert string to double",
251
+ "documentation": { "value": "Converts a string to a double with error detection.\n\n```c\nchar *end;\ndouble val = strtod(\"3.14xyz\", &end);\n```" },
252
+ "insertText": "strtod(${1:str}, ${2:&endptr})",
253
+ "insertTextRules": 4,
254
+ "sortText": "00_strtod"
255
+ },
256
+ {
257
+ "label": "rand",
258
+ "kind": 1,
259
+ "detail": "Generate pseudo-random number",
260
+ "documentation": { "value": "Returns a pseudo-random integer in [0, RAND_MAX].\n\n```c\nsrand(time(NULL));\nint r = rand() % 100; // 0-99\n```" },
261
+ "insertText": "rand()",
262
+ "insertTextRules": 4,
263
+ "sortText": "00_rand"
264
+ },
265
+ {
266
+ "label": "srand",
267
+ "kind": 1,
268
+ "detail": "Seed the random number generator",
269
+ "documentation": { "value": "Seeds the pseudo-random number generator used by rand().\n\n```c\nsrand((unsigned int)time(NULL));\n```" },
270
+ "insertText": "srand(${1:(unsigned int)time(NULL)})",
271
+ "insertTextRules": 4,
272
+ "sortText": "00_srand"
273
+ },
274
+ {
275
+ "label": "qsort",
276
+ "kind": 1,
277
+ "detail": "Sort an array",
278
+ "documentation": { "value": "Sorts an array using a comparison function.\n\n```c\nint cmp(const void *a, const void *b) {\n return (*(int *)a - *(int *)b);\n}\nqsort(arr, n, sizeof(int), cmp);\n```" },
279
+ "insertText": "qsort(${1:base}, ${2:nmemb}, ${3:size}, ${4:compar})",
280
+ "insertTextRules": 4,
281
+ "sortText": "00_qsort"
282
+ },
283
+ {
284
+ "label": "bsearch",
285
+ "kind": 1,
286
+ "detail": "Binary search a sorted array",
287
+ "documentation": { "value": "Searches a sorted array for a key using binary search.\n\n```c\nint key = 42;\nint *found = (int *)bsearch(&key, arr, n, sizeof(int), cmp);\n```" },
288
+ "insertText": "bsearch(${1:&key}, ${2:base}, ${3:nmemb}, ${4:size}, ${5:compar})",
289
+ "insertTextRules": 4,
290
+ "sortText": "00_bsearch"
291
+ },
292
+ {
293
+ "label": "abs",
294
+ "kind": 1,
295
+ "detail": "Compute absolute value of an integer",
296
+ "documentation": { "value": "Returns the absolute value of an integer.\n\n```c\nint val = abs(-42); // 42\n```" },
297
+ "insertText": "abs(${1:x})",
298
+ "insertTextRules": 4,
299
+ "sortText": "00_abs"
300
+ },
301
+ {
302
+ "label": "system",
303
+ "kind": 1,
304
+ "detail": "Execute a shell command",
305
+ "documentation": { "value": "Passes a command string to the host command processor.\n\n```c\nsystem(\"ls -la\");\nint ret = system(\"gcc -o out main.c\");\n```" },
306
+ "insertText": "system(\"${1:command}\")",
307
+ "insertTextRules": 4,
308
+ "sortText": "00_system"
309
+ },
310
+ {
311
+ "label": "getenv",
312
+ "kind": 1,
313
+ "detail": "Get environment variable",
314
+ "documentation": { "value": "Returns the value of an environment variable, or NULL if not found.\n\n```c\nconst char *home = getenv(\"HOME\");\nif (home) printf(\"Home: %s\\n\", home);\n```" },
315
+ "insertText": "getenv(\"${1:name}\")",
316
+ "insertTextRules": 4,
317
+ "sortText": "00_getenv"
318
+ },
319
+ {
320
+ "label": "strlen",
321
+ "kind": 1,
322
+ "detail": "Get string length",
323
+ "documentation": { "value": "Returns the length of a null-terminated string (not including the null byte).\n\n```c\nsize_t len = strlen(\"hello\"); // 5\n```" },
324
+ "insertText": "strlen(${1:str})",
325
+ "insertTextRules": 4,
326
+ "sortText": "00_strlen"
327
+ },
328
+ {
329
+ "label": "strcpy",
330
+ "kind": 1,
331
+ "detail": "Copy a string",
332
+ "documentation": { "value": "Copies a string to a destination buffer. Unsafe — prefer strncpy or snprintf.\n\n```c\nchar dest[64];\nstrcpy(dest, \"hello\");\n```" },
333
+ "insertText": "strcpy(${1:dest}, ${2:src})",
334
+ "insertTextRules": 4,
335
+ "sortText": "00_strcpy"
336
+ },
337
+ {
338
+ "label": "strncpy",
339
+ "kind": 1,
340
+ "detail": "Copy a bounded string",
341
+ "documentation": { "value": "Copies up to n characters from src to dest. May not null-terminate if src is longer.\n\n```c\nchar dest[64];\nstrncpy(dest, src, sizeof(dest) - 1);\ndest[sizeof(dest) - 1] = '\\0';\n```" },
342
+ "insertText": "strncpy(${1:dest}, ${2:src}, ${3:n})",
343
+ "insertTextRules": 4,
344
+ "sortText": "00_strncpy"
345
+ },
346
+ {
347
+ "label": "strcat",
348
+ "kind": 1,
349
+ "detail": "Concatenate strings",
350
+ "documentation": { "value": "Appends src to the end of dest. Unsafe — prefer strncat.\n\n```c\nchar buf[128] = \"Hello, \";\nstrcat(buf, \"World!\");\n```" },
351
+ "insertText": "strcat(${1:dest}, ${2:src})",
352
+ "insertTextRules": 4,
353
+ "sortText": "00_strcat"
354
+ },
355
+ {
356
+ "label": "strncat",
357
+ "kind": 1,
358
+ "detail": "Concatenate bounded strings",
359
+ "documentation": { "value": "Appends at most n characters from src to dest, then null-terminates.\n\n```c\nstrncat(dest, src, sizeof(dest) - strlen(dest) - 1);\n```" },
360
+ "insertText": "strncat(${1:dest}, ${2:src}, ${3:n})",
361
+ "insertTextRules": 4,
362
+ "sortText": "00_strncat"
363
+ },
364
+ {
365
+ "label": "strcmp",
366
+ "kind": 1,
367
+ "detail": "Compare two strings",
368
+ "documentation": { "value": "Compares two strings lexicographically. Returns 0 if equal, <0 if s1<s2, >0 if s1>s2.\n\n```c\nif (strcmp(a, b) == 0) {\n printf(\"Strings are equal\\n\");\n}\n```" },
369
+ "insertText": "strcmp(${1:s1}, ${2:s2})",
370
+ "insertTextRules": 4,
371
+ "sortText": "00_strcmp"
372
+ },
373
+ {
374
+ "label": "strncmp",
375
+ "kind": 1,
376
+ "detail": "Compare bounded strings",
377
+ "documentation": { "value": "Compares up to n characters of two strings.\n\n```c\nif (strncmp(line, \"GET \", 4) == 0) {\n // handle GET request\n}\n```" },
378
+ "insertText": "strncmp(${1:s1}, ${2:s2}, ${3:n})",
379
+ "insertTextRules": 4,
380
+ "sortText": "00_strncmp"
381
+ },
382
+ {
383
+ "label": "strchr",
384
+ "kind": 1,
385
+ "detail": "Find first occurrence of character",
386
+ "documentation": { "value": "Returns a pointer to the first occurrence of a character in a string.\n\n```c\nchar *p = strchr(str, ':');\nif (p) printf(\"Found at index %ld\\n\", p - str);\n```" },
387
+ "insertText": "strchr(${1:str}, ${2:ch})",
388
+ "insertTextRules": 4,
389
+ "sortText": "00_strchr"
390
+ },
391
+ {
392
+ "label": "strrchr",
393
+ "kind": 1,
394
+ "detail": "Find last occurrence of character",
395
+ "documentation": { "value": "Returns a pointer to the last occurrence of a character in a string.\n\n```c\nchar *ext = strrchr(filename, '.');\n```" },
396
+ "insertText": "strrchr(${1:str}, ${2:ch})",
397
+ "insertTextRules": 4,
398
+ "sortText": "00_strrchr"
399
+ },
400
+ {
401
+ "label": "strstr",
402
+ "kind": 1,
403
+ "detail": "Find substring",
404
+ "documentation": { "value": "Finds the first occurrence of a substring within a string.\n\n```c\nchar *p = strstr(haystack, \"needle\");\nif (p) printf(\"Found at index %ld\\n\", p - haystack);\n```" },
405
+ "insertText": "strstr(${1:haystack}, ${2:needle})",
406
+ "insertTextRules": 4,
407
+ "sortText": "00_strstr"
408
+ },
409
+ {
410
+ "label": "memcpy",
411
+ "kind": 1,
412
+ "detail": "Copy memory block",
413
+ "documentation": { "value": "Copies n bytes from src to dest. Regions must not overlap (use memmove instead).\n\n```c\nmemcpy(dest, src, n * sizeof(int));\n```" },
414
+ "insertText": "memcpy(${1:dest}, ${2:src}, ${3:n})",
415
+ "insertTextRules": 4,
416
+ "sortText": "00_memcpy"
417
+ },
418
+ {
419
+ "label": "memmove",
420
+ "kind": 1,
421
+ "detail": "Move memory block (overlap-safe)",
422
+ "documentation": { "value": "Copies n bytes from src to dest, handling overlapping regions safely.\n\n```c\nmemmove(arr + 1, arr, (n - 1) * sizeof(int));\n```" },
423
+ "insertText": "memmove(${1:dest}, ${2:src}, ${3:n})",
424
+ "insertTextRules": 4,
425
+ "sortText": "00_memmove"
426
+ },
427
+ {
428
+ "label": "memset",
429
+ "kind": 1,
430
+ "detail": "Fill memory with a byte value",
431
+ "documentation": { "value": "Fills n bytes of memory with the specified byte value.\n\n```c\nmemset(buf, 0, sizeof(buf));\nmemset(arr, -1, n * sizeof(int));\n```" },
432
+ "insertText": "memset(${1:ptr}, ${2:value}, ${3:n})",
433
+ "insertTextRules": 4,
434
+ "sortText": "00_memset"
435
+ },
436
+ {
437
+ "label": "memcmp",
438
+ "kind": 1,
439
+ "detail": "Compare memory blocks",
440
+ "documentation": { "value": "Compares n bytes of two memory blocks.\n\n```c\nif (memcmp(buf1, buf2, n) == 0) {\n printf(\"Buffers are equal\\n\");\n}\n```" },
441
+ "insertText": "memcmp(${1:ptr1}, ${2:ptr2}, ${3:n})",
442
+ "insertTextRules": 4,
443
+ "sortText": "00_memcmp"
444
+ },
445
+ {
446
+ "label": "sqrt",
447
+ "kind": 1,
448
+ "detail": "Compute square root",
449
+ "documentation": { "value": "Returns the square root of x. Requires linking with -lm.\n\n```c\n#include <math.h>\ndouble r = sqrt(25.0); // 5.0\n```" },
450
+ "insertText": "sqrt(${1:x})",
451
+ "insertTextRules": 4,
452
+ "sortText": "00_sqrt"
453
+ },
454
+ {
455
+ "label": "pow",
456
+ "kind": 1,
457
+ "detail": "Raise to power",
458
+ "documentation": { "value": "Returns base raised to the power of exp.\n\n```c\ndouble val = pow(2.0, 10.0); // 1024.0\n```" },
459
+ "insertText": "pow(${1:base}, ${2:exp})",
460
+ "insertTextRules": 4,
461
+ "sortText": "00_pow"
462
+ },
463
+ {
464
+ "label": "fabs",
465
+ "kind": 1,
466
+ "detail": "Absolute value of a double",
467
+ "documentation": { "value": "Returns the absolute value of a floating-point number.\n\n```c\ndouble d = fabs(-3.14); // 3.14\n```" },
468
+ "insertText": "fabs(${1:x})",
469
+ "insertTextRules": 4,
470
+ "sortText": "00_fabs"
471
+ },
472
+ {
473
+ "label": "ceil",
474
+ "kind": 1,
475
+ "detail": "Round up to nearest integer",
476
+ "documentation": { "value": "Returns the smallest integer not less than x.\n\n```c\ndouble c = ceil(2.3); // 3.0\n```" },
477
+ "insertText": "ceil(${1:x})",
478
+ "insertTextRules": 4,
479
+ "sortText": "00_ceil"
480
+ },
481
+ {
482
+ "label": "floor",
483
+ "kind": 1,
484
+ "detail": "Round down to nearest integer",
485
+ "documentation": { "value": "Returns the largest integer not greater than x.\n\n```c\ndouble f = floor(2.9); // 2.0\n```" },
486
+ "insertText": "floor(${1:x})",
487
+ "insertTextRules": 4,
488
+ "sortText": "00_floor"
489
+ },
490
+ {
491
+ "label": "round",
492
+ "kind": 1,
493
+ "detail": "Round to nearest integer",
494
+ "documentation": { "value": "Rounds x to the nearest integer, halfway cases away from zero.\n\n```c\ndouble r = round(2.5); // 3.0\n```" },
495
+ "insertText": "round(${1:x})",
496
+ "insertTextRules": 4,
497
+ "sortText": "00_round"
498
+ },
499
+ {
500
+ "label": "sin",
501
+ "kind": 1,
502
+ "detail": "Compute sine",
503
+ "documentation": { "value": "Returns the sine of x (in radians).\n\n```c\ndouble s = sin(M_PI / 2); // 1.0\n```" },
504
+ "insertText": "sin(${1:x})",
505
+ "insertTextRules": 4,
506
+ "sortText": "00_sin"
507
+ },
508
+ {
509
+ "label": "cos",
510
+ "kind": 1,
511
+ "detail": "Compute cosine",
512
+ "documentation": { "value": "Returns the cosine of x (in radians).\n\n```c\ndouble c = cos(0.0); // 1.0\n```" },
513
+ "insertText": "cos(${1:x})",
514
+ "insertTextRules": 4,
515
+ "sortText": "00_cos"
516
+ },
517
+ {
518
+ "label": "tan",
519
+ "kind": 1,
520
+ "detail": "Compute tangent",
521
+ "documentation": { "value": "Returns the tangent of x (in radians).\n\n```c\ndouble t = tan(M_PI / 4); // ~1.0\n```" },
522
+ "insertText": "tan(${1:x})",
523
+ "insertTextRules": 4,
524
+ "sortText": "00_tan"
525
+ },
526
+ {
527
+ "label": "log",
528
+ "kind": 1,
529
+ "detail": "Compute natural logarithm",
530
+ "documentation": { "value": "Returns the natural logarithm (base e) of x.\n\n```c\ndouble l = log(M_E); // 1.0\n```" },
531
+ "insertText": "log(${1:x})",
532
+ "insertTextRules": 4,
533
+ "sortText": "00_log"
534
+ },
535
+ {
536
+ "label": "log10",
537
+ "kind": 1,
538
+ "detail": "Compute base-10 logarithm",
539
+ "documentation": { "value": "Returns the base-10 logarithm of x.\n\n```c\ndouble l = log10(1000.0); // 3.0\n```" },
540
+ "insertText": "log10(${1:x})",
541
+ "insertTextRules": 4,
542
+ "sortText": "00_log10"
543
+ },
544
+ {
545
+ "label": "exp",
546
+ "kind": 1,
547
+ "detail": "Compute exponential (e^x)",
548
+ "documentation": { "value": "Returns e raised to the power x.\n\n```c\ndouble e = exp(1.0); // ~2.71828\n```" },
549
+ "insertText": "exp(${1:x})",
550
+ "insertTextRules": 4,
551
+ "sortText": "00_exp"
552
+ },
553
+ {
554
+ "label": "if",
555
+ "kind": 14,
556
+ "detail": "if statement",
557
+ "documentation": { "value": "Conditional execution.\n\n```c\nif (condition) {\n // code\n}\n```" },
558
+ "insertText": "if (${1:condition}) {\n\t${2}\n}",
559
+ "insertTextRules": 4,
560
+ "sortText": "01_if"
561
+ },
562
+ {
563
+ "label": "else",
564
+ "kind": 14,
565
+ "detail": "else clause",
566
+ "documentation": { "value": "Alternative branch of an if statement.\n\n```c\nif (x > 0) {\n // positive\n} else {\n // non-positive\n}\n```" },
567
+ "insertText": "else {\n\t${1}\n}",
568
+ "insertTextRules": 4,
569
+ "sortText": "01_else"
570
+ },
571
+ {
572
+ "label": "for",
573
+ "kind": 14,
574
+ "detail": "for loop",
575
+ "documentation": { "value": "Loop with initialization, condition, and increment.\n\n```c\nfor (int i = 0; i < n; i++) {\n // body\n}\n```" },
576
+ "insertText": "for (${1:int i = 0}; ${2:i < n}; ${3:i++}) {\n\t${4}\n}",
577
+ "insertTextRules": 4,
578
+ "sortText": "01_for"
579
+ },
580
+ {
581
+ "label": "while",
582
+ "kind": 14,
583
+ "detail": "while loop",
584
+ "documentation": { "value": "Loop that repeats while a condition is true.\n\n```c\nwhile (condition) {\n // body\n}\n```" },
585
+ "insertText": "while (${1:condition}) {\n\t${2}\n}",
586
+ "insertTextRules": 4,
587
+ "sortText": "01_while"
588
+ },
589
+ {
590
+ "label": "do",
591
+ "kind": 14,
592
+ "detail": "do-while loop",
593
+ "documentation": { "value": "Loop that executes at least once.\n\n```c\ndo {\n // body\n} while (condition);\n```" },
594
+ "insertText": "do {\n\t${1}\n} while (${2:condition});",
595
+ "insertTextRules": 4,
596
+ "sortText": "01_do"
597
+ },
598
+ {
599
+ "label": "switch",
600
+ "kind": 14,
601
+ "detail": "switch statement",
602
+ "documentation": { "value": "Multi-way branch based on an integer expression.\n\n```c\nswitch (val) {\n case 1: break;\n default: break;\n}\n```" },
603
+ "insertText": "switch (${1:expr}) {\n\tcase ${2:value}:\n\t\t${3}\n\t\tbreak;\n\tdefault:\n\t\tbreak;\n}",
604
+ "insertTextRules": 4,
605
+ "sortText": "01_switch"
606
+ },
607
+ {
608
+ "label": "case",
609
+ "kind": 14,
610
+ "detail": "case label in switch",
611
+ "documentation": { "value": "A case label inside a switch statement.\n\n```c\ncase 1:\n printf(\"one\\n\");\n break;\n```" },
612
+ "insertText": "case ${1:value}:\n\t${2}\n\tbreak;",
613
+ "insertTextRules": 4,
614
+ "sortText": "01_case"
615
+ },
616
+ {
617
+ "label": "break",
618
+ "kind": 14,
619
+ "detail": "Break out of loop or switch",
620
+ "documentation": { "value": "Exits the nearest enclosing loop or switch statement." },
621
+ "insertText": "break;",
622
+ "insertTextRules": 4,
623
+ "sortText": "01_break"
624
+ },
625
+ {
626
+ "label": "continue",
627
+ "kind": 14,
628
+ "detail": "Skip to next loop iteration",
629
+ "documentation": { "value": "Skips the rest of the current loop iteration and continues with the next." },
630
+ "insertText": "continue;",
631
+ "insertTextRules": 4,
632
+ "sortText": "01_continue"
633
+ },
634
+ {
635
+ "label": "return",
636
+ "kind": 14,
637
+ "detail": "Return from function",
638
+ "documentation": { "value": "Returns a value from a function.\n\n```c\nreturn 0;\nreturn result;\n```" },
639
+ "insertText": "return ${1:0};",
640
+ "insertTextRules": 4,
641
+ "sortText": "01_return"
642
+ },
643
+ {
644
+ "label": "typedef",
645
+ "kind": 14,
646
+ "detail": "Create a type alias",
647
+ "documentation": { "value": "Defines a new name for an existing type.\n\n```c\ntypedef unsigned long ulong;\ntypedef struct Node Node;\n```" },
648
+ "insertText": "typedef ${1:type} ${2:alias};",
649
+ "insertTextRules": 4,
650
+ "sortText": "01_typedef"
651
+ },
652
+ {
653
+ "label": "struct",
654
+ "kind": 14,
655
+ "detail": "Define a structure",
656
+ "documentation": { "value": "Defines a composite data type.\n\n```c\nstruct Point {\n int x;\n int y;\n};\n```" },
657
+ "insertText": "struct ${1:Name} {\n\t${2}\n};",
658
+ "insertTextRules": 4,
659
+ "sortText": "01_struct"
660
+ },
661
+ {
662
+ "label": "enum",
663
+ "kind": 14,
664
+ "detail": "Define an enumeration",
665
+ "documentation": { "value": "Defines a set of named integer constants.\n\n```c\nenum Color { RED, GREEN, BLUE };\n```" },
666
+ "insertText": "enum ${1:Name} {\n\t${2:VALUE1},\n\t${3:VALUE2}\n};",
667
+ "insertTextRules": 4,
668
+ "sortText": "01_enum"
669
+ },
670
+ {
671
+ "label": "union",
672
+ "kind": 14,
673
+ "detail": "Define a union",
674
+ "documentation": { "value": "Defines a type where all members share the same memory.\n\n```c\nunion Data {\n int i;\n float f;\n char str[20];\n};\n```" },
675
+ "insertText": "union ${1:Name} {\n\t${2}\n};",
676
+ "insertTextRules": 4,
677
+ "sortText": "01_union"
678
+ },
679
+ {
680
+ "label": "sizeof",
681
+ "kind": 14,
682
+ "detail": "Get size of type or variable",
683
+ "documentation": { "value": "Returns the size in bytes of a type or expression.\n\n```c\nsize_t s = sizeof(int); // typically 4\nsize_t a = sizeof(arr) / sizeof(arr[0]); // array length\n```" },
684
+ "insertText": "sizeof(${1:type})",
685
+ "insertTextRules": 4,
686
+ "sortText": "01_sizeof"
687
+ },
688
+ {
689
+ "label": "static",
690
+ "kind": 14,
691
+ "detail": "Static storage duration / internal linkage",
692
+ "documentation": { "value": "Gives a variable static storage or restricts a function/variable to file scope.\n\n```c\nstatic int counter = 0;\nstatic void helper(void) { }\n```" },
693
+ "insertText": "static ",
694
+ "insertTextRules": 4,
695
+ "sortText": "01_static"
696
+ },
697
+ {
698
+ "label": "extern",
699
+ "kind": 14,
700
+ "detail": "External linkage declaration",
701
+ "documentation": { "value": "Declares a variable or function defined in another translation unit.\n\n```c\nextern int global_count;\nextern void init(void);\n```" },
702
+ "insertText": "extern ${1:type} ${2:name};",
703
+ "insertTextRules": 4,
704
+ "sortText": "01_extern"
705
+ },
706
+ {
707
+ "label": "const",
708
+ "kind": 14,
709
+ "detail": "Constant qualifier",
710
+ "documentation": { "value": "Declares a read-only variable.\n\n```c\nconst int MAX = 100;\nconst char *msg = \"hello\";\n```" },
711
+ "insertText": "const ${1:type} ${2:name} = ${3:value};",
712
+ "insertTextRules": 4,
713
+ "sortText": "01_const"
714
+ },
715
+ {
716
+ "label": "volatile",
717
+ "kind": 14,
718
+ "detail": "Volatile qualifier",
719
+ "documentation": { "value": "Tells the compiler not to optimize access to this variable — it may change unexpectedly.\n\n```c\nvolatile int flag = 0;\n```" },
720
+ "insertText": "volatile ${1:type} ${2:name};",
721
+ "insertTextRules": 4,
722
+ "sortText": "01_volatile"
723
+ },
724
+ {
725
+ "label": "inline",
726
+ "kind": 14,
727
+ "detail": "Inline function hint",
728
+ "documentation": { "value": "Suggests to the compiler to inline a function for performance.\n\n```c\nstatic inline int max(int a, int b) {\n return a > b ? a : b;\n}\n```" },
729
+ "insertText": "inline ",
730
+ "insertTextRules": 4,
731
+ "sortText": "01_inline"
732
+ },
733
+ {
734
+ "label": "goto",
735
+ "kind": 14,
736
+ "detail": "Jump to a label",
737
+ "documentation": { "value": "Unconditional jump to a labeled statement. Often used for cleanup in C.\n\n```c\nif (error)\n goto cleanup;\ncleanup:\n free(ptr);\n```" },
738
+ "insertText": "goto ${1:label};",
739
+ "insertTextRules": 4,
740
+ "sortText": "01_goto"
741
+ },
742
+ {
743
+ "label": "#include",
744
+ "kind": 14,
745
+ "detail": "Include a header file",
746
+ "documentation": { "value": "Includes a header file.\n\n```c\n#include <stdio.h>\n#include \"myheader.h\"\n```" },
747
+ "insertText": "#include <${1:header}.h>",
748
+ "insertTextRules": 4,
749
+ "sortText": "02_include"
750
+ },
751
+ {
752
+ "label": "#define",
753
+ "kind": 14,
754
+ "detail": "Define a macro",
755
+ "documentation": { "value": "Defines a preprocessor macro.\n\n```c\n#define PI 3.14159\n#define MAX(a, b) ((a) > (b) ? (a) : (b))\n```" },
756
+ "insertText": "#define ${1:NAME} ${2:value}",
757
+ "insertTextRules": 4,
758
+ "sortText": "02_define"
759
+ },
760
+ {
761
+ "label": "#ifdef",
762
+ "kind": 14,
763
+ "detail": "Conditional compilation (if defined)",
764
+ "documentation": { "value": "Compiles the following code only if the macro is defined.\n\n```c\n#ifdef DEBUG\n printf(\"Debug mode\\n\");\n#endif\n```" },
765
+ "insertText": "#ifdef ${1:MACRO}\n${2}\n#endif",
766
+ "insertTextRules": 4,
767
+ "sortText": "02_ifdef"
768
+ },
769
+ {
770
+ "label": "#ifndef",
771
+ "kind": 14,
772
+ "detail": "Conditional compilation (if not defined)",
773
+ "documentation": { "value": "Compiles the following code only if the macro is NOT defined. Commonly used as include guards.\n\n```c\n#ifndef MY_HEADER_H\n#define MY_HEADER_H\n// declarations\n#endif\n```" },
774
+ "insertText": "#ifndef ${1:MACRO}\n#define ${1:MACRO}\n${2}\n#endif",
775
+ "insertTextRules": 4,
776
+ "sortText": "02_ifndef"
777
+ },
778
+ {
779
+ "label": "#endif",
780
+ "kind": 14,
781
+ "detail": "End conditional compilation",
782
+ "documentation": { "value": "Ends a conditional compilation block started by #if, #ifdef, or #ifndef." },
783
+ "insertText": "#endif",
784
+ "insertTextRules": 4,
785
+ "sortText": "02_endif"
786
+ },
787
+ {
788
+ "label": "#if",
789
+ "kind": 14,
790
+ "detail": "Conditional compilation (expression)",
791
+ "documentation": { "value": "Compiles the following code if the expression evaluates to true.\n\n```c\n#if defined(__linux__)\n // Linux-specific code\n#elif defined(_WIN32)\n // Windows-specific code\n#endif\n```" },
792
+ "insertText": "#if ${1:expression}\n${2}\n#endif",
793
+ "insertTextRules": 4,
794
+ "sortText": "02_if"
795
+ },
796
+ {
797
+ "label": "#elif",
798
+ "kind": 14,
799
+ "detail": "Else-if in conditional compilation",
800
+ "documentation": { "value": "Provides an alternative condition in a preprocessing conditional.\n\n```c\n#if defined(__linux__)\n // ...\n#elif defined(_WIN32)\n // ...\n#endif\n```" },
801
+ "insertText": "#elif ${1:expression}",
802
+ "insertTextRules": 4,
803
+ "sortText": "02_elif"
804
+ },
805
+ {
806
+ "label": "#pragma",
807
+ "kind": 14,
808
+ "detail": "Compiler pragma directive",
809
+ "documentation": { "value": "Provides implementation-defined instructions to the compiler.\n\n```c\n#pragma once\n#pragma pack(push, 1)\n#pragma warning(disable: 4996)\n```" },
810
+ "insertText": "#pragma ${1:once}",
811
+ "insertTextRules": 4,
812
+ "sortText": "02_pragma"
813
+ },
814
+ {
815
+ "label": "main function",
816
+ "kind": 15,
817
+ "detail": "Main entry point with argc/argv",
818
+ "documentation": { "value": "Standard main function entry point.\n\n```c\nint main(int argc, char *argv[]) {\n return 0;\n}\n```" },
819
+ "insertText": "int main(int argc, char *argv[]) {\n\t${1}\n\treturn 0;\n}",
820
+ "insertTextRules": 4,
821
+ "sortText": "03_main"
822
+ },
823
+ {
824
+ "label": "struct definition",
825
+ "kind": 27,
826
+ "detail": "Define a typedef struct",
827
+ "documentation": { "value": "Creates a typedef'd struct.\n\n```c\ntypedef struct {\n int x;\n int y;\n} Point;\n```" },
828
+ "insertText": "typedef struct {\n\t${2:int member};\n} ${1:Name};",
829
+ "insertTextRules": 4,
830
+ "sortText": "03_struct_def"
831
+ },
832
+ {
833
+ "label": "for loop",
834
+ "kind": 27,
835
+ "detail": "Standard indexed for loop",
836
+ "documentation": { "value": "Standard for loop iterating from 0 to n.\n\n```c\nfor (int i = 0; i < n; i++) {\n // body\n}\n```" },
837
+ "insertText": "for (int ${1:i} = 0; ${1:i} < ${2:n}; ${1:i}++) {\n\t${3}\n}",
838
+ "insertTextRules": 4,
839
+ "sortText": "03_for_loop"
840
+ },
841
+ {
842
+ "label": "while loop",
843
+ "kind": 27,
844
+ "detail": "While loop snippet",
845
+ "documentation": { "value": "A while loop template.\n\n```c\nwhile (condition) {\n // body\n}\n```" },
846
+ "insertText": "while (${1:condition}) {\n\t${2}\n}",
847
+ "insertTextRules": 4,
848
+ "sortText": "03_while_loop"
849
+ },
850
+ {
851
+ "label": "switch case",
852
+ "kind": 27,
853
+ "detail": "Switch-case snippet",
854
+ "documentation": { "value": "A switch-case template.\n\n```c\nswitch (expr) {\n case VAL1:\n break;\n case VAL2:\n break;\n default:\n break;\n}\n```" },
855
+ "insertText": "switch (${1:expr}) {\n\tcase ${2:VAL1}:\n\t\t${3}\n\t\tbreak;\n\tcase ${4:VAL2}:\n\t\t${5}\n\t\tbreak;\n\tdefault:\n\t\t${6}\n\t\tbreak;\n}",
856
+ "insertTextRules": 4,
857
+ "sortText": "03_switch_case"
858
+ },
859
+ {
860
+ "label": "malloc+free pattern",
861
+ "kind": 27,
862
+ "detail": "Allocate, use, and free memory",
863
+ "documentation": { "value": "Allocates memory, checks for NULL, and frees it.\n\n```c\nint *arr = (int *)malloc(n * sizeof(int));\nif (!arr) { perror(\"malloc\"); exit(1); }\n// use arr\nfree(arr);\n```" },
864
+ "insertText": "${1:int} *${2:ptr} = (${1:int} *)malloc(${3:n} * sizeof(${1:int}));\nif (!${2:ptr}) {\n\tperror(\"malloc\");\n\texit(EXIT_FAILURE);\n}\n${4:// use ptr}\nfree(${2:ptr});\n${2:ptr} = NULL;",
865
+ "insertTextRules": 4,
866
+ "sortText": "03_malloc_free"
867
+ },
868
+ {
869
+ "label": "file open+close",
870
+ "kind": 27,
871
+ "detail": "Open, read/write, and close a file",
872
+ "documentation": { "value": "Opens a file, checks for errors, performs I/O, and closes it.\n\n```c\nFILE *fp = fopen(\"file.txt\", \"r\");\nif (!fp) { perror(\"fopen\"); return 1; }\n// read/write\nfclose(fp);\n```" },
873
+ "insertText": "FILE *${1:fp} = fopen(\"${2:filename}\", \"${3:r}\");\nif (!${1:fp}) {\n\tperror(\"fopen\");\n\treturn ${4:1};\n}\n${5:// read/write operations}\nfclose(${1:fp});",
874
+ "insertTextRules": 4,
875
+ "sortText": "03_file_open_close"
876
+ },
877
+ {
878
+ "label": "header guard",
879
+ "kind": 27,
880
+ "detail": "Include guard for header files",
881
+ "documentation": { "value": "Standard include guard pattern.\n\n```c\n#ifndef MY_HEADER_H\n#define MY_HEADER_H\n// declarations\n#endif /* MY_HEADER_H */\n```" },
882
+ "insertText": "#ifndef ${1:HEADER}_H\n#define ${1:HEADER}_H\n\n${2:// declarations}\n\n#endif /* ${1:HEADER}_H */",
883
+ "insertTextRules": 4,
884
+ "sortText": "03_header_guard"
885
+ },
886
+ {
887
+ "label": "function definition",
888
+ "kind": 27,
889
+ "detail": "Function definition snippet",
890
+ "documentation": { "value": "Template for defining a function.\n\n```c\nint my_func(int param) {\n return 0;\n}\n```" },
891
+ "insertText": "${1:int} ${2:func_name}(${3:void}) {\n\t${4}\n\treturn ${5:0};\n}",
892
+ "insertTextRules": 4,
893
+ "sortText": "03_func_def"
894
+ },
895
+ {
896
+ "label": "enum definition",
897
+ "kind": 27,
898
+ "detail": "Typedef enum definition",
899
+ "documentation": { "value": "Creates a typedef'd enum.\n\n```c\ntypedef enum {\n STATE_INIT,\n STATE_RUNNING,\n STATE_DONE\n} State;\n```" },
900
+ "insertText": "typedef enum {\n\t${2:VALUE1},\n\t${3:VALUE2}\n} ${1:EnumName};",
901
+ "insertTextRules": 4,
902
+ "sortText": "03_enum_def"
903
+ },
904
+ {
905
+ "label": "linked list node",
906
+ "kind": 27,
907
+ "detail": "Singly linked list node struct",
908
+ "documentation": { "value": "Defines a singly linked list node.\n\n```c\ntypedef struct Node {\n int data;\n struct Node *next;\n} Node;\n```" },
909
+ "insertText": "typedef struct ${1:Node} {\n\t${2:int data};\n\tstruct ${1:Node} *next;\n} ${1:Node};",
910
+ "insertTextRules": 4,
911
+ "sortText": "03_linked_list"
912
+ },
913
+ {
914
+ "label": "do-while loop",
915
+ "kind": 27,
916
+ "detail": "Do-while loop snippet",
917
+ "documentation": { "value": "A do-while loop that runs at least once.\n\n```c\ndo {\n // body\n} while (condition);\n```" },
918
+ "insertText": "do {\n\t${1}\n} while (${2:condition});",
919
+ "insertTextRules": 4,
920
+ "sortText": "03_do_while"
921
+ },
922
+ {
923
+ "label": "if-else",
924
+ "kind": 27,
925
+ "detail": "If-else snippet",
926
+ "documentation": { "value": "An if-else block.\n\n```c\nif (condition) {\n // true\n} else {\n // false\n}\n```" },
927
+ "insertText": "if (${1:condition}) {\n\t${2}\n} else {\n\t${3}\n}",
928
+ "insertTextRules": 4,
929
+ "sortText": "03_if_else"
930
+ },
931
+ {
932
+ "label": "puts",
933
+ "kind": 1,
934
+ "detail": "Write a string to stdout with newline",
935
+ "documentation": { "value": "Writes a string to stdout and appends a newline.\n\n```c\nputs(\"Hello, World!\");\n```" },
936
+ "insertText": "puts(\"${1:str}\")",
937
+ "insertTextRules": 4,
938
+ "sortText": "00_puts"
939
+ },
940
+ {
941
+ "label": "getchar",
942
+ "kind": 1,
943
+ "detail": "Read a character from stdin",
944
+ "documentation": { "value": "Reads the next character from stdin.\n\n```c\nint ch = getchar();\n```" },
945
+ "insertText": "getchar()",
946
+ "insertTextRules": 4,
947
+ "sortText": "00_getchar"
948
+ },
949
+ {
950
+ "label": "putchar",
951
+ "kind": 1,
952
+ "detail": "Write a character to stdout",
953
+ "documentation": { "value": "Writes a character to stdout.\n\n```c\nputchar('A');\n```" },
954
+ "insertText": "putchar(${1:ch})",
955
+ "insertTextRules": 4,
956
+ "sortText": "00_putchar"
957
+ },
958
+ {
959
+ "label": "strtok",
960
+ "kind": 1,
961
+ "detail": "Tokenize a string",
962
+ "documentation": { "value": "Splits a string into tokens based on delimiter characters.\n\n```c\nchar str[] = \"one,two,three\";\nchar *tok = strtok(str, \",\");\nwhile (tok) {\n printf(\"%s\\n\", tok);\n tok = strtok(NULL, \",\");\n}\n```" },
963
+ "insertText": "strtok(${1:str}, \"${2:delim}\")",
964
+ "insertTextRules": 4,
965
+ "sortText": "00_strtok"
966
+ },
967
+ {
968
+ "label": "isalpha",
969
+ "kind": 1,
970
+ "detail": "Check if character is alphabetic",
971
+ "documentation": { "value": "Tests whether a character is an alphabetic letter.\n\n```c\n#include <ctype.h>\nif (isalpha(ch)) { /* ... */ }\n```" },
972
+ "insertText": "isalpha(${1:ch})",
973
+ "insertTextRules": 4,
974
+ "sortText": "00_isalpha"
975
+ },
976
+ {
977
+ "label": "isdigit",
978
+ "kind": 1,
979
+ "detail": "Check if character is a digit",
980
+ "documentation": { "value": "Tests whether a character is a decimal digit.\n\n```c\n#include <ctype.h>\nif (isdigit(ch)) { /* ... */ }\n```" },
981
+ "insertText": "isdigit(${1:ch})",
982
+ "insertTextRules": 4,
983
+ "sortText": "00_isdigit"
984
+ },
985
+ {
986
+ "label": "toupper",
987
+ "kind": 1,
988
+ "detail": "Convert character to uppercase",
989
+ "documentation": { "value": "Converts a lowercase letter to uppercase.\n\n```c\nchar upper = toupper('a'); // 'A'\n```" },
990
+ "insertText": "toupper(${1:ch})",
991
+ "insertTextRules": 4,
992
+ "sortText": "00_toupper"
993
+ },
994
+ {
995
+ "label": "tolower",
996
+ "kind": 1,
997
+ "detail": "Convert character to lowercase",
998
+ "documentation": { "value": "Converts an uppercase letter to lowercase.\n\n```c\nchar lower = tolower('Z'); // 'z'\n```" },
999
+ "insertText": "tolower(${1:ch})",
1000
+ "insertTextRules": 4,
1001
+ "sortText": "00_tolower"
1002
+ },
1003
+ {
1004
+ "label": "time",
1005
+ "kind": 1,
1006
+ "detail": "Get current calendar time",
1007
+ "documentation": { "value": "Returns the current calendar time as time_t.\n\n```c\n#include <time.h>\ntime_t now = time(NULL);\nprintf(\"%s\", ctime(&now));\n```" },
1008
+ "insertText": "time(${1:NULL})",
1009
+ "insertTextRules": 4,
1010
+ "sortText": "00_time"
1011
+ },
1012
+ {
1013
+ "label": "clock",
1014
+ "kind": 1,
1015
+ "detail": "Get processor time used",
1016
+ "documentation": { "value": "Returns processor time consumed by the program.\n\n```c\nclock_t start = clock();\n// ... work ...\nclock_t end = clock();\ndouble elapsed = (double)(end - start) / CLOCKS_PER_SEC;\n```" },
1017
+ "insertText": "clock()",
1018
+ "insertTextRules": 4,
1019
+ "sortText": "00_clock"
1020
+ },
1021
+ {
1022
+ "label": "assert",
1023
+ "kind": 1,
1024
+ "detail": "Runtime assertion",
1025
+ "documentation": { "value": "Aborts the program if the expression is false (in debug builds).\n\n```c\n#include <assert.h>\nassert(ptr != NULL);\nassert(n > 0);\n```" },
1026
+ "insertText": "assert(${1:expression})",
1027
+ "insertTextRules": 4,
1028
+ "sortText": "00_assert"
1029
+ },
1030
+ {
1031
+ "label": "NULL",
1032
+ "kind": 5,
1033
+ "detail": "Null pointer constant",
1034
+ "documentation": { "value": "Null pointer constant, typically defined as `((void *)0)` or `0`.\n\n```c\nint *p = NULL;\nif (p == NULL) { /* ... */ }\n```" },
1035
+ "insertText": "NULL",
1036
+ "insertTextRules": 4,
1037
+ "sortText": "00_NULL"
1038
+ },
1039
+ {
1040
+ "label": "EOF",
1041
+ "kind": 5,
1042
+ "detail": "End-of-file indicator",
1043
+ "documentation": { "value": "End-of-file constant, typically -1. Used to detect end of input.\n\n```c\nint ch;\nwhile ((ch = getchar()) != EOF) {\n putchar(ch);\n}\n```" },
1044
+ "insertText": "EOF",
1045
+ "insertTextRules": 4,
1046
+ "sortText": "00_EOF"
1047
+ },
1048
+ {
1049
+ "label": "FILE",
1050
+ "kind": 6,
1051
+ "detail": "File stream type",
1052
+ "documentation": { "value": "Opaque type for file stream operations defined in stdio.h.\n\n```c\nFILE *fp = fopen(\"data.txt\", \"r\");\n```" },
1053
+ "insertText": "FILE",
1054
+ "insertTextRules": 4,
1055
+ "sortText": "00_FILE"
1056
+ },
1057
+ {
1058
+ "label": "size_t",
1059
+ "kind": 6,
1060
+ "detail": "Unsigned size type",
1061
+ "documentation": { "value": "Unsigned integer type returned by sizeof. Defined in stddef.h / stdlib.h.\n\n```c\nsize_t len = strlen(str);\n```" },
1062
+ "insertText": "size_t",
1063
+ "insertTextRules": 4,
1064
+ "sortText": "00_size_t"
1065
+ }
1066
+ ]
1067
+ }