@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,968 @@
1
+ {
2
+ "language": "lua",
3
+ "completions": [
4
+ {
5
+ "label": "print",
6
+ "kind": 1,
7
+ "detail": "Print values to stdout",
8
+ "documentation": { "value": "Receives any number of arguments and prints their values to stdout, converting each with `tostring`.\n\n```lua\nprint(\"Hello, world!\")\nprint(\"x =\", x, \"y =\", y)\n```" },
9
+ "insertText": "print(${1:value})",
10
+ "insertTextRules": 4,
11
+ "sortText": "00_print"
12
+ },
13
+ {
14
+ "label": "type",
15
+ "kind": 1,
16
+ "detail": "Return type of a value as a string",
17
+ "documentation": { "value": "Returns the type of its argument as a string. Possible results are `\"nil\"`, `\"number\"`, `\"string\"`, `\"boolean\"`, `\"table\"`, `\"function\"`, `\"thread\"`, and `\"userdata\"`.\n\n```lua\nprint(type(42)) -- \"number\"\nprint(type(\"hello\")) -- \"string\"\nprint(type(nil)) -- \"nil\"\n```" },
18
+ "insertText": "type(${1:v})",
19
+ "insertTextRules": 4,
20
+ "sortText": "00_type"
21
+ },
22
+ {
23
+ "label": "tostring",
24
+ "kind": 1,
25
+ "detail": "Convert a value to a string",
26
+ "documentation": { "value": "Receives a value of any type and converts it to a string in a human-readable format. If the metatable has a `__tostring` metamethod, it is called with the value as argument.\n\n```lua\ntostring(123) -- \"123\"\ntostring(true) -- \"true\"\ntostring(nil) -- \"nil\"\n```" },
27
+ "insertText": "tostring(${1:v})",
28
+ "insertTextRules": 4,
29
+ "sortText": "00_tostring"
30
+ },
31
+ {
32
+ "label": "tonumber",
33
+ "kind": 1,
34
+ "detail": "Convert a value to a number",
35
+ "documentation": { "value": "Tries to convert its argument to a number. If the argument is already a number or a convertible string, returns the number; otherwise returns `nil`. An optional base (2–36) specifies the base for interpretation.\n\n```lua\ntonumber(\"42\") -- 42\ntonumber(\"0xff\") -- 255\ntonumber(\"1010\", 2) -- 10\n```" },
36
+ "insertText": "tonumber(${1:e}${2:, ${3:base}})",
37
+ "insertTextRules": 4,
38
+ "sortText": "00_tonumber"
39
+ },
40
+ {
41
+ "label": "pairs",
42
+ "kind": 1,
43
+ "detail": "Iterate over all key-value pairs in a table",
44
+ "documentation": { "value": "Returns an iterator function, the table, and `nil`, so that the construction `for k, v in pairs(t) do ... end` iterates over all key–value pairs of table `t`.\n\n```lua\nfor k, v in pairs(myTable) do\n print(k, v)\nend\n```" },
45
+ "insertText": "pairs(${1:t})",
46
+ "insertTextRules": 4,
47
+ "sortText": "00_pairs"
48
+ },
49
+ {
50
+ "label": "ipairs",
51
+ "kind": 1,
52
+ "detail": "Iterate over integer-keyed elements of a table",
53
+ "documentation": { "value": "Returns an iterator function, the table, and `0`, so that the construction `for i, v in ipairs(t) do ... end` iterates over the integer keys 1, 2, ... of table `t`.\n\n```lua\nlocal fruits = {\"apple\", \"banana\", \"cherry\"}\nfor i, v in ipairs(fruits) do\n print(i, v)\nend\n```" },
54
+ "insertText": "ipairs(${1:t})",
55
+ "insertTextRules": 4,
56
+ "sortText": "00_ipairs"
57
+ },
58
+ {
59
+ "label": "next",
60
+ "kind": 1,
61
+ "detail": "Get next key-value pair from a table",
62
+ "documentation": { "value": "Allows a program to traverse all fields of a table. Its first argument is a table and its second argument is an index. Returns the next index and its value. When called with `nil` as second argument, returns the first index.\n\n```lua\nlocal k, v = next(t) -- first pair\nlocal k2, v2 = next(t, k) -- next pair\n```" },
63
+ "insertText": "next(${1:table}${2:, ${3:index}})",
64
+ "insertTextRules": 4,
65
+ "sortText": "00_next"
66
+ },
67
+ {
68
+ "label": "select",
69
+ "kind": 1,
70
+ "detail": "Select from argument list",
71
+ "documentation": { "value": "If `index` is a number, returns all arguments after argument number `index`. If `index` is `\"#\"`, returns the total number of extra arguments received.\n\n```lua\nselect(2, \"a\", \"b\", \"c\") -- \"b\", \"c\"\nselect(\"#\", \"a\", \"b\", \"c\") -- 3\n```" },
72
+ "insertText": "select(${1:index}, ${2:...})",
73
+ "insertTextRules": 4,
74
+ "sortText": "00_select"
75
+ },
76
+ {
77
+ "label": "unpack",
78
+ "kind": 1,
79
+ "detail": "Unpack elements from a table (Lua 5.1/LuaJIT)",
80
+ "documentation": { "value": "Returns the elements from the given list. In Lua 5.1 and LuaJIT this is a global function. In Lua 5.2+ it has been moved to `table.unpack`.\n\n```lua\nlocal a, b, c = unpack({10, 20, 30})\n-- a=10, b=20, c=30\n```\n\n**Note:** Use `table.unpack` in Lua 5.2+." },
81
+ "insertText": "unpack(${1:list}${2:, ${3:i}${4:, ${5:j}}})",
82
+ "insertTextRules": 4,
83
+ "sortText": "00_unpack"
84
+ },
85
+ {
86
+ "label": "pcall",
87
+ "kind": 1,
88
+ "detail": "Protected call — catch errors",
89
+ "documentation": { "value": "Calls function `f` with the given arguments in protected mode. If there are no errors, returns `true` plus results. If there is an error, returns `false` plus the error object.\n\n```lua\nlocal ok, result = pcall(function()\n return riskyOperation()\nend)\nif not ok then\n print(\"Error:\", result)\nend\n```" },
90
+ "insertText": "pcall(${1:f}${2:, ${3:args}})",
91
+ "insertTextRules": 4,
92
+ "sortText": "00_pcall"
93
+ },
94
+ {
95
+ "label": "xpcall",
96
+ "kind": 1,
97
+ "detail": "Protected call with error handler",
98
+ "documentation": { "value": "Similar to `pcall`, but sets a message handler `msgh` for errors. Any error inside `f` is not propagated; instead, `xpcall` catches the error, calls `msgh` with the original error, and returns the status code plus the result from `msgh`.\n\n```lua\nlocal ok, result = xpcall(riskyFunc, function(err)\n return debug.traceback(err, 2)\nend)\n```\n\n**Note:** In Lua 5.1, `xpcall` does not accept arguments for the called function. Lua 5.2+ and LuaJIT 2.1 support extra arguments." },
99
+ "insertText": "xpcall(${1:f}, ${2:msgh}${3:, ${4:args}})",
100
+ "insertTextRules": 4,
101
+ "sortText": "00_xpcall"
102
+ },
103
+ {
104
+ "label": "error",
105
+ "kind": 1,
106
+ "detail": "Raise an error",
107
+ "documentation": { "value": "Raises an error with `message` as the error object. `level` specifies where the error points (1 = current function, 2 = caller, etc., 0 = no position info).\n\n```lua\nerror(\"something went wrong\")\nerror(\"invalid argument\", 2)\nerror({code = 404, msg = \"not found\"})\n```" },
108
+ "insertText": "error(${1:message}${2:, ${3:level}})",
109
+ "insertTextRules": 4,
110
+ "sortText": "00_error"
111
+ },
112
+ {
113
+ "label": "assert",
114
+ "kind": 1,
115
+ "detail": "Assert a condition, raising error if false/nil",
116
+ "documentation": { "value": "Calls `error` if the value of its argument `v` is false (i.e., `nil` or `false`); otherwise returns all its arguments.\n\n```lua\nassert(type(x) == \"number\", \"x must be a number\")\nlocal f = assert(io.open(filename, \"r\"))\n```" },
117
+ "insertText": "assert(${1:v}${2:, ${3:message}})",
118
+ "insertTextRules": 4,
119
+ "sortText": "00_assert"
120
+ },
121
+ {
122
+ "label": "require",
123
+ "kind": 1,
124
+ "detail": "Load a module",
125
+ "documentation": { "value": "Loads the given module. Searches for a loader using `package.searchers` (Lua 5.2+) or `package.loaders` (Lua 5.1). Caches results in `package.loaded`.\n\n```lua\nlocal json = require(\"cjson\")\nlocal utils = require(\"mylib.utils\")\n```" },
126
+ "insertText": "require(\"${1:modname}\")",
127
+ "insertTextRules": 4,
128
+ "sortText": "00_require"
129
+ },
130
+ {
131
+ "label": "dofile",
132
+ "kind": 1,
133
+ "detail": "Execute a Lua file",
134
+ "documentation": { "value": "Opens the named file and executes its contents as a Lua chunk. Returns any values returned by the chunk. In case of errors, propagates them to the caller.\n\n```lua\ndofile(\"config.lua\")\nlocal result = dofile(\"script.lua\")\n```" },
135
+ "insertText": "dofile(\"${1:filename}\")",
136
+ "insertTextRules": 4,
137
+ "sortText": "00_dofile"
138
+ },
139
+ {
140
+ "label": "loadfile",
141
+ "kind": 1,
142
+ "detail": "Load a Lua file as a chunk without executing",
143
+ "documentation": { "value": "Loads a chunk from file `filename` without running it. Returns the compiled chunk as a function, or `nil` plus error message on failure.\n\n```lua\nlocal chunk, err = loadfile(\"script.lua\")\nif chunk then chunk() end\n```\n\n**Lua 5.2+:** Accepts optional `mode` and `env` parameters." },
144
+ "insertText": "loadfile(\"${1:filename}\")",
145
+ "insertTextRules": 4,
146
+ "sortText": "00_loadfile"
147
+ },
148
+ {
149
+ "label": "load",
150
+ "kind": 1,
151
+ "detail": "Load a chunk from a string or function",
152
+ "documentation": { "value": "Loads a chunk. If `chunk` is a string, loads that string. If it is a function, calls it repeatedly to get pieces. Returns the compiled chunk as a function.\n\n```lua\nlocal fn = load(\"return 2 + 2\")\nprint(fn()) -- 4\n```\n\n**Lua 5.1:** Use `loadstring` for strings. Lua 5.2+ unified into `load`." },
153
+ "insertText": "load(${1:chunk}${2:, ${3:chunkname}${4:, ${5:mode}${6:, ${7:env}}}})",
154
+ "insertTextRules": 4,
155
+ "sortText": "00_load"
156
+ },
157
+ {
158
+ "label": "rawget",
159
+ "kind": 1,
160
+ "detail": "Get a table value without invoking metamethods",
161
+ "documentation": { "value": "Gets the real value of `table[index]` without invoking the `__index` metamethod.\n\n```lua\nlocal v = rawget(t, \"key\")\n```" },
162
+ "insertText": "rawget(${1:table}, ${2:index})",
163
+ "insertTextRules": 4,
164
+ "sortText": "00_rawget"
165
+ },
166
+ {
167
+ "label": "rawset",
168
+ "kind": 1,
169
+ "detail": "Set a table value without invoking metamethods",
170
+ "documentation": { "value": "Sets the real value of `table[index]` to `value` without invoking the `__newindex` metamethod. Returns `table`.\n\n```lua\nrawset(t, \"key\", 42)\n```" },
171
+ "insertText": "rawset(${1:table}, ${2:index}, ${3:value})",
172
+ "insertTextRules": 4,
173
+ "sortText": "00_rawset"
174
+ },
175
+ {
176
+ "label": "rawequal",
177
+ "kind": 1,
178
+ "detail": "Check equality without invoking metamethods",
179
+ "documentation": { "value": "Checks whether `v1` is equal to `v2`, without invoking the `__eq` metamethod.\n\n```lua\nrawequal(a, b)\n```" },
180
+ "insertText": "rawequal(${1:v1}, ${2:v2})",
181
+ "insertTextRules": 4,
182
+ "sortText": "00_rawequal"
183
+ },
184
+ {
185
+ "label": "rawlen",
186
+ "kind": 1,
187
+ "detail": "Get length without invoking metamethods (Lua 5.2+)",
188
+ "documentation": { "value": "Returns the length of the object `v`, which must be a table or a string, without invoking the `__len` metamethod.\n\n```lua\nlocal n = rawlen(t)\n```\n\n**Note:** Available in Lua 5.2+ only. Not available in Lua 5.1 or LuaJIT (unless patched)." },
189
+ "insertText": "rawlen(${1:v})",
190
+ "insertTextRules": 4,
191
+ "sortText": "00_rawlen"
192
+ },
193
+ {
194
+ "label": "setmetatable",
195
+ "kind": 1,
196
+ "detail": "Set the metatable for a table",
197
+ "documentation": { "value": "Sets the metatable for the given table. If `metatable` is `nil`, removes the metatable. If the original metatable has a `__metatable` field, raises an error. Returns `table`.\n\n```lua\nlocal mt = { __index = baseClass }\nsetmetatable(obj, mt)\n```" },
198
+ "insertText": "setmetatable(${1:table}, ${2:metatable})",
199
+ "insertTextRules": 4,
200
+ "sortText": "00_setmetatable"
201
+ },
202
+ {
203
+ "label": "getmetatable",
204
+ "kind": 1,
205
+ "detail": "Get the metatable of an object",
206
+ "documentation": { "value": "Returns the metatable of the given object, or `nil` if it does not have one. If the metatable has a `__metatable` field, returns that value instead.\n\n```lua\nlocal mt = getmetatable(obj)\n```" },
207
+ "insertText": "getmetatable(${1:object})",
208
+ "insertTextRules": 4,
209
+ "sortText": "00_getmetatable"
210
+ },
211
+ {
212
+ "label": "collectgarbage",
213
+ "kind": 1,
214
+ "detail": "Control the garbage collector",
215
+ "documentation": { "value": "Generic interface to the garbage collector. Performs different functions depending on `opt`: `\"collect\"`, `\"stop\"`, `\"restart\"`, `\"count\"`, `\"step\"`, `\"isrunning\"`, `\"incremental\"`, `\"generational\"`.\n\n```lua\ncollectgarbage(\"collect\")\nlocal kb = collectgarbage(\"count\")\n```\n\n**Lua 5.4:** Added `\"incremental\"` and `\"generational\"` options." },
216
+ "insertText": "collectgarbage(\"${1:opt}\"${2:, ${3:arg}})",
217
+ "insertTextRules": 4,
218
+ "sortText": "00_collectgarbage"
219
+ },
220
+ {
221
+ "label": "string.format",
222
+ "kind": 1,
223
+ "detail": "Format a string",
224
+ "documentation": { "value": "Returns a formatted version of its variable number of arguments following the description given in `formatstring`. Similar to C `sprintf`.\n\n```lua\nstring.format(\"%s is %d years old\", name, age)\nstring.format(\"%02x\", 255) -- \"ff\"\nstring.format(\"%.2f\", 3.14159) -- \"3.14\"\n```" },
225
+ "insertText": "string.format(\"${1:fmt}\", ${2:args})",
226
+ "insertTextRules": 4,
227
+ "sortText": "01_string.format"
228
+ },
229
+ {
230
+ "label": "string.find",
231
+ "kind": 1,
232
+ "detail": "Find a pattern in a string",
233
+ "documentation": { "value": "Looks for the first match of `pattern` in `s`. Returns the start and end indices of the match, plus any captures. Returns `nil` if no match.\n\n```lua\nlocal i, j = string.find(\"hello world\", \"world\") -- 7, 11\nlocal s, e, cap = string.find(\"abc123\", \"(%d+)\") -- 4, 6, \"123\"\n```" },
234
+ "insertText": "string.find(${1:s}, \"${2:pattern}\"${3:, ${4:init}${5:, ${6:plain}}})",
235
+ "insertTextRules": 4,
236
+ "sortText": "01_string.find"
237
+ },
238
+ {
239
+ "label": "string.match",
240
+ "kind": 1,
241
+ "detail": "Extract pattern matches from a string",
242
+ "documentation": { "value": "Looks for the first match of `pattern` in `s`. Returns the captures, or the whole match if no captures. Returns `nil` if no match.\n\n```lua\nlocal year, month, day = string.match(\"2026-03-03\", \"(%d+)-(%d+)-(%d+)\")\nlocal word = string.match(\"hello world\", \"%a+\") -- \"hello\"\n```" },
243
+ "insertText": "string.match(${1:s}, \"${2:pattern}\"${3:, ${4:init}})",
244
+ "insertTextRules": 4,
245
+ "sortText": "01_string.match"
246
+ },
247
+ {
248
+ "label": "string.gmatch",
249
+ "kind": 1,
250
+ "detail": "Iterate over all pattern matches",
251
+ "documentation": { "value": "Returns an iterator function that each time returns the next captures from `pattern` over the string `s`.\n\n```lua\nfor word in string.gmatch(\"Hello Lua World\", \"%a+\") do\n print(word)\nend\nfor k, v in string.gmatch(s, \"(%w+)=(%w+)\") do\n t[k] = v\nend\n```" },
252
+ "insertText": "string.gmatch(${1:s}, \"${2:pattern}\")",
253
+ "insertTextRules": 4,
254
+ "sortText": "01_string.gmatch"
255
+ },
256
+ {
257
+ "label": "string.gsub",
258
+ "kind": 1,
259
+ "detail": "Global substitution — replace pattern matches",
260
+ "documentation": { "value": "Returns a copy of `s` in which all (or the first `n`) occurrences of `pattern` have been replaced. `repl` can be a string, table, or function. Returns the result string and the number of substitutions.\n\n```lua\nstring.gsub(\"hello world\", \"(%w+)\", string.upper) -- \"HELLO WORLD\"\nstring.gsub(\"abc\", \"b\", \"B\") -- \"aBc\"\n```" },
261
+ "insertText": "string.gsub(${1:s}, \"${2:pattern}\", ${3:repl}${4:, ${5:n}})",
262
+ "insertTextRules": 4,
263
+ "sortText": "01_string.gsub"
264
+ },
265
+ {
266
+ "label": "string.sub",
267
+ "kind": 1,
268
+ "detail": "Extract a substring",
269
+ "documentation": { "value": "Returns the substring of `s` that starts at `i` and continues until `j` (inclusive). Negative indices count from the end.\n\n```lua\nstring.sub(\"Hello\", 2, 4) -- \"ell\"\nstring.sub(\"Hello\", -3) -- \"llo\"\n```" },
270
+ "insertText": "string.sub(${1:s}, ${2:i}${3:, ${4:j}})",
271
+ "insertTextRules": 4,
272
+ "sortText": "01_string.sub"
273
+ },
274
+ {
275
+ "label": "string.rep",
276
+ "kind": 1,
277
+ "detail": "Repeat a string",
278
+ "documentation": { "value": "Returns a string that is the concatenation of `n` copies of `s`, separated by `sep` (Lua 5.2+).\n\n```lua\nstring.rep(\"ab\", 3) -- \"ababab\"\nstring.rep(\"ab\", 3, \",\") -- \"ab,ab,ab\" (Lua 5.2+)\n```" },
279
+ "insertText": "string.rep(${1:s}, ${2:n}${3:, ${4:sep}})",
280
+ "insertTextRules": 4,
281
+ "sortText": "01_string.rep"
282
+ },
283
+ {
284
+ "label": "string.reverse",
285
+ "kind": 1,
286
+ "detail": "Reverse a string",
287
+ "documentation": { "value": "Returns a string that is the reverse of `s`.\n\n```lua\nstring.reverse(\"hello\") -- \"olleh\"\n```" },
288
+ "insertText": "string.reverse(${1:s})",
289
+ "insertTextRules": 4,
290
+ "sortText": "01_string.reverse"
291
+ },
292
+ {
293
+ "label": "string.upper",
294
+ "kind": 1,
295
+ "detail": "Convert string to uppercase",
296
+ "documentation": { "value": "Returns a copy of `s` with all lowercase letters changed to uppercase. The definition of what a lowercase letter is depends on the current locale.\n\n```lua\nstring.upper(\"hello\") -- \"HELLO\"\n```" },
297
+ "insertText": "string.upper(${1:s})",
298
+ "insertTextRules": 4,
299
+ "sortText": "01_string.upper"
300
+ },
301
+ {
302
+ "label": "string.lower",
303
+ "kind": 1,
304
+ "detail": "Convert string to lowercase",
305
+ "documentation": { "value": "Returns a copy of `s` with all uppercase letters changed to lowercase.\n\n```lua\nstring.lower(\"HELLO\") -- \"hello\"\n```" },
306
+ "insertText": "string.lower(${1:s})",
307
+ "insertTextRules": 4,
308
+ "sortText": "01_string.lower"
309
+ },
310
+ {
311
+ "label": "string.len",
312
+ "kind": 1,
313
+ "detail": "Get string length",
314
+ "documentation": { "value": "Returns the length of the string `s`. The empty string has length 0. Embedded zeros are counted.\n\n```lua\nstring.len(\"hello\") -- 5\n(\"hello\"):len() -- 5\n#\"hello\" -- 5 (idiomatic)\n```" },
315
+ "insertText": "string.len(${1:s})",
316
+ "insertTextRules": 4,
317
+ "sortText": "01_string.len"
318
+ },
319
+ {
320
+ "label": "string.byte",
321
+ "kind": 1,
322
+ "detail": "Get numeric byte values of characters",
323
+ "documentation": { "value": "Returns the internal numeric codes of the characters `s[i]` through `s[j]`.\n\n```lua\nstring.byte(\"A\") -- 65\nstring.byte(\"ABC\", 1, 3) -- 65, 66, 67\n```" },
324
+ "insertText": "string.byte(${1:s}${2:, ${3:i}${4:, ${5:j}}})",
325
+ "insertTextRules": 4,
326
+ "sortText": "01_string.byte"
327
+ },
328
+ {
329
+ "label": "string.char",
330
+ "kind": 1,
331
+ "detail": "Convert numeric codes to a string",
332
+ "documentation": { "value": "Returns a string with characters having the internal numeric codes equal to the arguments.\n\n```lua\nstring.char(65, 66, 67) -- \"ABC\"\nstring.char(72, 101, 108, 108, 111) -- \"Hello\"\n```" },
333
+ "insertText": "string.char(${1:...})",
334
+ "insertTextRules": 4,
335
+ "sortText": "01_string.char"
336
+ },
337
+ {
338
+ "label": "string.dump",
339
+ "kind": 1,
340
+ "detail": "Dump a function as binary string",
341
+ "documentation": { "value": "Returns a string containing a binary representation of the given function, so that a later `load` can return a copy of the function. The function must be a Lua function without upvalues.\n\n```lua\nlocal s = string.dump(function() return 42 end)\nlocal f = load(s)\nprint(f()) -- 42\n```\n\n**Lua 5.3+:** Optional `strip` parameter to strip debug info." },
342
+ "insertText": "string.dump(${1:function}${2:, ${3:strip}})",
343
+ "insertTextRules": 4,
344
+ "sortText": "01_string.dump"
345
+ },
346
+ {
347
+ "label": "table.insert",
348
+ "kind": 1,
349
+ "detail": "Insert an element into a table",
350
+ "documentation": { "value": "Inserts element `value` at position `pos` in `list`, shifting up other elements. The default value for `pos` is `#list+1` (append).\n\n```lua\nlocal t = {1, 2, 3}\ntable.insert(t, 4) -- {1, 2, 3, 4}\ntable.insert(t, 2, 10) -- {1, 10, 2, 3, 4}\n```" },
351
+ "insertText": "table.insert(${1:list}, ${2:value})",
352
+ "insertTextRules": 4,
353
+ "sortText": "02_table.insert"
354
+ },
355
+ {
356
+ "label": "table.remove",
357
+ "kind": 1,
358
+ "detail": "Remove an element from a table",
359
+ "documentation": { "value": "Removes from `list` the element at position `pos`, returning the removed value. Default `pos` is `#list` (last element).\n\n```lua\nlocal t = {1, 2, 3, 4}\nlocal v = table.remove(t) -- v=4, t={1,2,3}\nlocal w = table.remove(t, 1) -- w=1, t={2,3}\n```" },
360
+ "insertText": "table.remove(${1:list}${2:, ${3:pos}})",
361
+ "insertTextRules": 4,
362
+ "sortText": "02_table.remove"
363
+ },
364
+ {
365
+ "label": "table.sort",
366
+ "kind": 1,
367
+ "detail": "Sort a table in-place",
368
+ "documentation": { "value": "Sorts the list elements in-place, from `list[1]` to `list[#list]`. An optional comparison function `comp` can be provided.\n\n```lua\nlocal t = {3, 1, 4, 1, 5}\ntable.sort(t) -- {1, 1, 3, 4, 5}\ntable.sort(t, function(a, b) return a > b end) -- descending\n```" },
369
+ "insertText": "table.sort(${1:list}${2:, ${3:comp}})",
370
+ "insertTextRules": 4,
371
+ "sortText": "02_table.sort"
372
+ },
373
+ {
374
+ "label": "table.concat",
375
+ "kind": 1,
376
+ "detail": "Concatenate table elements into a string",
377
+ "documentation": { "value": "Returns a string made by concatenating `list[i]..list[j]` with `sep` between each element.\n\n```lua\nlocal t = {\"Hello\", \"Lua\", \"World\"}\ntable.concat(t, \" \") -- \"Hello Lua World\"\ntable.concat(t, \", \", 2) -- \"Lua, World\"\n```" },
378
+ "insertText": "table.concat(${1:list}${2:, ${3:sep}${4:, ${5:i}${6:, ${7:j}}}})",
379
+ "insertTextRules": 4,
380
+ "sortText": "02_table.concat"
381
+ },
382
+ {
383
+ "label": "table.move",
384
+ "kind": 1,
385
+ "detail": "Move elements within or between tables (Lua 5.3+)",
386
+ "documentation": { "value": "Moves elements from table `a1` to table `a2`. Equivalent to `a2[t], ... = a1[f], ..., a1[e]` with appropriate destination indexing. Returns `a2`.\n\n```lua\nlocal t = {1, 2, 3, 4, 5}\ntable.move(t, 3, 5, 1) -- {3, 4, 5, 4, 5}\n```\n\n**Note:** Available in Lua 5.3+ only." },
387
+ "insertText": "table.move(${1:a1}, ${2:f}, ${3:e}, ${4:t}${5:, ${6:a2}})",
388
+ "insertTextRules": 4,
389
+ "sortText": "02_table.move"
390
+ },
391
+ {
392
+ "label": "table.pack",
393
+ "kind": 1,
394
+ "detail": "Pack arguments into a table (Lua 5.2+)",
395
+ "documentation": { "value": "Returns a new table with all arguments stored at numeric keys and a field `n` with the total number of arguments.\n\n```lua\nlocal t = table.pack(1, 2, nil, 4)\nprint(t.n) -- 4\n```\n\n**Note:** Available in Lua 5.2+ and LuaJIT with compatibility flag." },
396
+ "insertText": "table.pack(${1:...})",
397
+ "insertTextRules": 4,
398
+ "sortText": "02_table.pack"
399
+ },
400
+ {
401
+ "label": "table.unpack",
402
+ "kind": 1,
403
+ "detail": "Unpack elements from a table (Lua 5.2+)",
404
+ "documentation": { "value": "Returns the elements from the given table. Equivalent to `return list[i], list[i+1], ..., list[j]`.\n\n```lua\nlocal a, b, c = table.unpack({10, 20, 30})\n```\n\n**Note:** In Lua 5.1 this is the global `unpack` function." },
405
+ "insertText": "table.unpack(${1:list}${2:, ${3:i}${4:, ${5:j}}})",
406
+ "insertTextRules": 4,
407
+ "sortText": "02_table.unpack"
408
+ },
409
+ {
410
+ "label": "math.abs",
411
+ "kind": 1,
412
+ "detail": "Absolute value",
413
+ "documentation": { "value": "Returns the absolute value of `x`.\n\n```lua\nmath.abs(-42) -- 42\nmath.abs(3.14) -- 3.14\n```" },
414
+ "insertText": "math.abs(${1:x})",
415
+ "insertTextRules": 4,
416
+ "sortText": "03_math.abs"
417
+ },
418
+ {
419
+ "label": "math.ceil",
420
+ "kind": 1,
421
+ "detail": "Round up to nearest integer",
422
+ "documentation": { "value": "Returns the smallest integral value greater than or equal to `x`.\n\n```lua\nmath.ceil(4.2) -- 5\nmath.ceil(-4.8) -- -4\n```" },
423
+ "insertText": "math.ceil(${1:x})",
424
+ "insertTextRules": 4,
425
+ "sortText": "03_math.ceil"
426
+ },
427
+ {
428
+ "label": "math.floor",
429
+ "kind": 1,
430
+ "detail": "Round down to nearest integer",
431
+ "documentation": { "value": "Returns the largest integral value less than or equal to `x`.\n\n```lua\nmath.floor(4.8) -- 4\nmath.floor(-4.2) -- -5\n```" },
432
+ "insertText": "math.floor(${1:x})",
433
+ "insertTextRules": 4,
434
+ "sortText": "03_math.floor"
435
+ },
436
+ {
437
+ "label": "math.max",
438
+ "kind": 1,
439
+ "detail": "Return the maximum value",
440
+ "documentation": { "value": "Returns the argument with the maximum value, according to the Lua `<` operator.\n\n```lua\nmath.max(1, 5, 3) -- 5\n```" },
441
+ "insertText": "math.max(${1:x}, ${2:...})",
442
+ "insertTextRules": 4,
443
+ "sortText": "03_math.max"
444
+ },
445
+ {
446
+ "label": "math.min",
447
+ "kind": 1,
448
+ "detail": "Return the minimum value",
449
+ "documentation": { "value": "Returns the argument with the minimum value, according to the Lua `<` operator.\n\n```lua\nmath.min(1, 5, 3) -- 1\n```" },
450
+ "insertText": "math.min(${1:x}, ${2:...})",
451
+ "insertTextRules": 4,
452
+ "sortText": "03_math.min"
453
+ },
454
+ {
455
+ "label": "math.sqrt",
456
+ "kind": 1,
457
+ "detail": "Square root",
458
+ "documentation": { "value": "Returns the square root of `x`. Equivalent to `x^0.5`.\n\n```lua\nmath.sqrt(144) -- 12.0\nmath.sqrt(2) -- 1.4142135623731\n```" },
459
+ "insertText": "math.sqrt(${1:x})",
460
+ "insertTextRules": 4,
461
+ "sortText": "03_math.sqrt"
462
+ },
463
+ {
464
+ "label": "math.random",
465
+ "kind": 1,
466
+ "detail": "Generate a pseudo-random number",
467
+ "documentation": { "value": "When called without arguments, returns a uniform pseudo-random real in [0,1). With `m`, returns integer in [1,m]. With `m` and `n`, returns integer in [m,n].\n\n```lua\nmath.random() -- 0.0 to 1.0\nmath.random(6) -- 1 to 6\nmath.random(1, 100) -- 1 to 100\n```\n\n**Lua 5.4:** Uses xoshiro256** algorithm. Older versions use C `rand()`." },
468
+ "insertText": "math.random(${1:m}${2:, ${3:n}})",
469
+ "insertTextRules": 4,
470
+ "sortText": "03_math.random"
471
+ },
472
+ {
473
+ "label": "math.randomseed",
474
+ "kind": 1,
475
+ "detail": "Set random seed",
476
+ "documentation": { "value": "Sets `x` as the seed for the pseudo-random generator.\n\n```lua\nmath.randomseed(os.time())\n```\n\n**Lua 5.4:** If called without arguments, seeds with a system-dependent somewhat-random value." },
477
+ "insertText": "math.randomseed(${1:x})",
478
+ "insertTextRules": 4,
479
+ "sortText": "03_math.randomseed"
480
+ },
481
+ {
482
+ "label": "math.huge",
483
+ "kind": 5,
484
+ "detail": "Positive infinity",
485
+ "documentation": { "value": "The float value `HUGE_VAL`, a value greater than any other numeric value (positive infinity).\n\n```lua\nprint(math.huge) -- inf\nprint(-math.huge) -- -inf\nprint(1 / 0 == math.huge) -- true\n```" },
486
+ "insertText": "math.huge",
487
+ "insertTextRules": 0,
488
+ "sortText": "03_math.huge"
489
+ },
490
+ {
491
+ "label": "math.pi",
492
+ "kind": 5,
493
+ "detail": "The value of π",
494
+ "documentation": { "value": "The value of π (3.14159265358979...).\n\n```lua\nprint(math.pi) -- 3.1415926535898\nlocal circumference = 2 * math.pi * radius\n```" },
495
+ "insertText": "math.pi",
496
+ "insertTextRules": 0,
497
+ "sortText": "03_math.pi"
498
+ },
499
+ {
500
+ "label": "math.sin",
501
+ "kind": 1,
502
+ "detail": "Sine (radians)",
503
+ "documentation": { "value": "Returns the sine of `x` (assumed to be in radians).\n\n```lua\nmath.sin(0) -- 0.0\nmath.sin(math.pi/2) -- 1.0\n```" },
504
+ "insertText": "math.sin(${1:x})",
505
+ "insertTextRules": 4,
506
+ "sortText": "03_math.sin"
507
+ },
508
+ {
509
+ "label": "math.cos",
510
+ "kind": 1,
511
+ "detail": "Cosine (radians)",
512
+ "documentation": { "value": "Returns the cosine of `x` (assumed to be in radians).\n\n```lua\nmath.cos(0) -- 1.0\nmath.cos(math.pi) -- -1.0\n```" },
513
+ "insertText": "math.cos(${1:x})",
514
+ "insertTextRules": 4,
515
+ "sortText": "03_math.cos"
516
+ },
517
+ {
518
+ "label": "math.log",
519
+ "kind": 1,
520
+ "detail": "Logarithm",
521
+ "documentation": { "value": "Returns the logarithm of `x` in the given base. The default for `base` is `e` (natural logarithm).\n\n```lua\nmath.log(math.exp(1)) -- 1.0\nmath.log(1000, 10) -- 3.0 (Lua 5.2+ base parameter)\n```\n\n**Lua 5.1:** Use `math.log10` for base-10. Lua 5.2+ accepts optional base." },
522
+ "insertText": "math.log(${1:x}${2:, ${3:base}})",
523
+ "insertTextRules": 4,
524
+ "sortText": "03_math.log"
525
+ },
526
+ {
527
+ "label": "math.exp",
528
+ "kind": 1,
529
+ "detail": "Exponential function (e^x)",
530
+ "documentation": { "value": "Returns the value e^x (where `e` is the base of natural logarithms).\n\n```lua\nmath.exp(0) -- 1.0\nmath.exp(1) -- 2.718281828...\n```" },
531
+ "insertText": "math.exp(${1:x})",
532
+ "insertTextRules": 4,
533
+ "sortText": "03_math.exp"
534
+ },
535
+ {
536
+ "label": "io.open",
537
+ "kind": 1,
538
+ "detail": "Open a file",
539
+ "documentation": { "value": "Opens a file in the specified mode. Returns a file handle, or `nil` plus an error message. Mode can be `\"r\"` (read), `\"w\"` (write), `\"a\"` (append), with optional `\"b\"` for binary.\n\n```lua\nlocal f = io.open(\"data.txt\", \"r\")\nlocal content = f:read(\"*a\")\nf:close()\n```" },
540
+ "insertText": "io.open(\"${1:filename}\", \"${2:r}\")",
541
+ "insertTextRules": 4,
542
+ "sortText": "04_io.open"
543
+ },
544
+ {
545
+ "label": "io.read",
546
+ "kind": 1,
547
+ "detail": "Read from default input",
548
+ "documentation": { "value": "Reads from the default input file according to the given formats.\n\n```lua\nlocal line = io.read() -- read one line\nlocal all = io.read(\"*a\") -- read entire file\nlocal num = io.read(\"*n\") -- read a number\n```\n\n**Lua 5.3+:** Use `\"a\"`, `\"l\"`, `\"L\"`, `\"n\"` (without `*` prefix)." },
549
+ "insertText": "io.read(\"${1:*l}\")",
550
+ "insertTextRules": 4,
551
+ "sortText": "04_io.read"
552
+ },
553
+ {
554
+ "label": "io.write",
555
+ "kind": 1,
556
+ "detail": "Write to default output",
557
+ "documentation": { "value": "Writes the value of each argument to the default output file.\n\n```lua\nio.write(\"Hello, world!\\n\")\nio.write(string.format(\"Value: %d\\n\", x))\n```" },
558
+ "insertText": "io.write(${1:value})",
559
+ "insertTextRules": 4,
560
+ "sortText": "04_io.write"
561
+ },
562
+ {
563
+ "label": "io.close",
564
+ "kind": 1,
565
+ "detail": "Close a file",
566
+ "documentation": { "value": "Closes `file` or the default output file.\n\n```lua\nio.close(file)\nio.close() -- close default output\n```" },
567
+ "insertText": "io.close(${1:file})",
568
+ "insertTextRules": 4,
569
+ "sortText": "04_io.close"
570
+ },
571
+ {
572
+ "label": "io.lines",
573
+ "kind": 1,
574
+ "detail": "Iterate over lines of a file",
575
+ "documentation": { "value": "Opens the given file name and returns an iterator function that returns a new line from the file each time it is called. The file is automatically closed when the loop ends.\n\n```lua\nfor line in io.lines(\"data.txt\") do\n print(line)\nend\n```" },
576
+ "insertText": "io.lines(\"${1:filename}\")",
577
+ "insertTextRules": 4,
578
+ "sortText": "04_io.lines"
579
+ },
580
+ {
581
+ "label": "os.time",
582
+ "kind": 1,
583
+ "detail": "Get current time or convert a date table",
584
+ "documentation": { "value": "Returns the current time when called without arguments, or a time representing the date and time specified by the given table.\n\n```lua\nlocal now = os.time()\nlocal t = os.time({year=2026, month=3, day=3})\n```" },
585
+ "insertText": "os.time(${1:})",
586
+ "insertTextRules": 4,
587
+ "sortText": "05_os.time"
588
+ },
589
+ {
590
+ "label": "os.date",
591
+ "kind": 1,
592
+ "detail": "Format date/time as a string",
593
+ "documentation": { "value": "Returns a string or table with date and time, formatted according to the given string `format`. If `format` starts with `!`, it is formatted in UTC.\n\n```lua\nos.date(\"%Y-%m-%d %H:%M:%S\") -- \"2026-03-03 12:00:00\"\nos.date(\"%A\") -- \"Tuesday\"\nos.date(\"*t\") -- returns a table\n```" },
594
+ "insertText": "os.date(\"${1:%Y-%m-%d %H:%M:%S}\"${2:, ${3:time}})",
595
+ "insertTextRules": 4,
596
+ "sortText": "05_os.date"
597
+ },
598
+ {
599
+ "label": "os.clock",
600
+ "kind": 1,
601
+ "detail": "Get CPU time used by the program",
602
+ "documentation": { "value": "Returns an approximation of the amount of CPU time used by the program, in seconds.\n\n```lua\nlocal start = os.clock()\n-- ... do work ...\nprint(string.format(\"Elapsed: %.3f s\", os.clock() - start))\n```" },
603
+ "insertText": "os.clock()",
604
+ "insertTextRules": 0,
605
+ "sortText": "05_os.clock"
606
+ },
607
+ {
608
+ "label": "os.execute",
609
+ "kind": 1,
610
+ "detail": "Execute a shell command",
611
+ "documentation": { "value": "Passes `command` to be executed by the operating system shell. Returns `true` (or `nil`), a string describing the exit status, and the exit code.\n\n```lua\nos.execute(\"mkdir mydir\")\nlocal ok, exittype, code = os.execute(\"ls -la\")\n```\n\n**Lua 5.1:** Returns only the exit status number." },
612
+ "insertText": "os.execute(\"${1:command}\")",
613
+ "insertTextRules": 4,
614
+ "sortText": "05_os.execute"
615
+ },
616
+ {
617
+ "label": "os.getenv",
618
+ "kind": 1,
619
+ "detail": "Get an environment variable",
620
+ "documentation": { "value": "Returns the value of the environment variable `varname`, or `nil` if not defined.\n\n```lua\nlocal home = os.getenv(\"HOME\")\nlocal path = os.getenv(\"PATH\")\n```" },
621
+ "insertText": "os.getenv(\"${1:varname}\")",
622
+ "insertTextRules": 4,
623
+ "sortText": "05_os.getenv"
624
+ },
625
+ {
626
+ "label": "os.rename",
627
+ "kind": 1,
628
+ "detail": "Rename a file or directory",
629
+ "documentation": { "value": "Renames the file or directory named `oldname` to `newname`. Returns `true` on success, or `nil` plus error message.\n\n```lua\nos.rename(\"old.txt\", \"new.txt\")\n```" },
630
+ "insertText": "os.rename(\"${1:oldname}\", \"${2:newname}\")",
631
+ "insertTextRules": 4,
632
+ "sortText": "05_os.rename"
633
+ },
634
+ {
635
+ "label": "os.remove",
636
+ "kind": 1,
637
+ "detail": "Remove a file",
638
+ "documentation": { "value": "Deletes the file with the given name. If it fails, returns `nil` plus an error message and error number.\n\n```lua\nos.remove(\"temp.txt\")\n```" },
639
+ "insertText": "os.remove(\"${1:filename}\")",
640
+ "insertTextRules": 4,
641
+ "sortText": "05_os.remove"
642
+ },
643
+ {
644
+ "label": "os.tmpname",
645
+ "kind": 1,
646
+ "detail": "Generate a temporary file name",
647
+ "documentation": { "value": "Returns a string with a file name that can be used for a temporary file.\n\n```lua\nlocal tmpfile = os.tmpname()\n```" },
648
+ "insertText": "os.tmpname()",
649
+ "insertTextRules": 0,
650
+ "sortText": "05_os.tmpname"
651
+ },
652
+ {
653
+ "label": "os.exit",
654
+ "kind": 1,
655
+ "detail": "Terminate the program",
656
+ "documentation": { "value": "Calls the ISO C function `exit` to terminate the host program. If `code` is `true`, the exit status is `EXIT_SUCCESS`; if `false`, it is `EXIT_FAILURE`; if a number, it is used as exit code.\n\n```lua\nos.exit() -- success\nos.exit(1) -- failure\nos.exit(true) -- Lua 5.2+ success\n```\n\n**Lua 5.2+:** Optional `close` parameter to close the Lua state." },
657
+ "insertText": "os.exit(${1:code})",
658
+ "insertTextRules": 4,
659
+ "sortText": "05_os.exit"
660
+ },
661
+ {
662
+ "label": "if",
663
+ "kind": 14,
664
+ "detail": "Conditional keyword",
665
+ "documentation": { "value": "Begins a conditional statement. Must be followed by `then` and closed with `end`.\n\n```lua\nif condition then\n -- code\nelseif other then\n -- code\nelse\n -- code\nend\n```" },
666
+ "insertText": "if",
667
+ "insertTextRules": 0,
668
+ "sortText": "06_if"
669
+ },
670
+ {
671
+ "label": "then",
672
+ "kind": 14,
673
+ "detail": "Conditional body keyword",
674
+ "documentation": { "value": "Follows an `if` or `elseif` condition to begin the conditional body." },
675
+ "insertText": "then",
676
+ "insertTextRules": 0,
677
+ "sortText": "06_then"
678
+ },
679
+ {
680
+ "label": "else",
681
+ "kind": 14,
682
+ "detail": "Else branch keyword",
683
+ "documentation": { "value": "Begins an alternative branch in an `if` statement." },
684
+ "insertText": "else",
685
+ "insertTextRules": 0,
686
+ "sortText": "06_else"
687
+ },
688
+ {
689
+ "label": "elseif",
690
+ "kind": 14,
691
+ "detail": "Else-if branch keyword",
692
+ "documentation": { "value": "Combines an `else` and `if` into a single keyword for chaining conditions." },
693
+ "insertText": "elseif",
694
+ "insertTextRules": 0,
695
+ "sortText": "06_elseif"
696
+ },
697
+ {
698
+ "label": "end",
699
+ "kind": 14,
700
+ "detail": "Block terminator keyword",
701
+ "documentation": { "value": "Closes a block opened by `function`, `if`, `for`, `while`, or `do`." },
702
+ "insertText": "end",
703
+ "insertTextRules": 0,
704
+ "sortText": "06_end"
705
+ },
706
+ {
707
+ "label": "for",
708
+ "kind": 14,
709
+ "detail": "Loop keyword",
710
+ "documentation": { "value": "Begins a numeric or generic `for` loop.\n\n```lua\nfor i = 1, 10 do ... end\nfor k, v in pairs(t) do ... end\n```" },
711
+ "insertText": "for",
712
+ "insertTextRules": 0,
713
+ "sortText": "06_for"
714
+ },
715
+ {
716
+ "label": "while",
717
+ "kind": 14,
718
+ "detail": "While-loop keyword",
719
+ "documentation": { "value": "Begins a while loop.\n\n```lua\nwhile condition do\n -- code\nend\n```" },
720
+ "insertText": "while",
721
+ "insertTextRules": 0,
722
+ "sortText": "06_while"
723
+ },
724
+ {
725
+ "label": "do",
726
+ "kind": 14,
727
+ "detail": "Block start keyword",
728
+ "documentation": { "value": "Begins a block. Used with `while`, `for`, or standalone for scoping.\n\n```lua\ndo\n local x = 10\nend -- x is out of scope\n```" },
729
+ "insertText": "do",
730
+ "insertTextRules": 0,
731
+ "sortText": "06_do"
732
+ },
733
+ {
734
+ "label": "repeat",
735
+ "kind": 14,
736
+ "detail": "Repeat-until loop keyword",
737
+ "documentation": { "value": "Begins a repeat-until loop. The body executes at least once.\n\n```lua\nrepeat\n -- code\nuntil condition\n```" },
738
+ "insertText": "repeat",
739
+ "insertTextRules": 0,
740
+ "sortText": "06_repeat"
741
+ },
742
+ {
743
+ "label": "until",
744
+ "kind": 14,
745
+ "detail": "Repeat-until terminator keyword",
746
+ "documentation": { "value": "Terminates a `repeat` block and specifies the loop condition." },
747
+ "insertText": "until",
748
+ "insertTextRules": 0,
749
+ "sortText": "06_until"
750
+ },
751
+ {
752
+ "label": "function",
753
+ "kind": 14,
754
+ "detail": "Function definition keyword",
755
+ "documentation": { "value": "Defines a function.\n\n```lua\nfunction foo(a, b)\n return a + b\nend\n\nlocal bar = function(x) return x * 2 end\n```" },
756
+ "insertText": "function",
757
+ "insertTextRules": 0,
758
+ "sortText": "06_function"
759
+ },
760
+ {
761
+ "label": "local",
762
+ "kind": 14,
763
+ "detail": "Local variable declaration keyword",
764
+ "documentation": { "value": "Declares a local variable or function, limiting its scope to the enclosing block.\n\n```lua\nlocal x = 10\nlocal function helper() end\n```" },
765
+ "insertText": "local",
766
+ "insertTextRules": 0,
767
+ "sortText": "06_local"
768
+ },
769
+ {
770
+ "label": "return",
771
+ "kind": 14,
772
+ "detail": "Return from function keyword",
773
+ "documentation": { "value": "Returns values from a function. Must be the last statement in a block.\n\n```lua\nreturn x, y\n```" },
774
+ "insertText": "return",
775
+ "insertTextRules": 0,
776
+ "sortText": "06_return"
777
+ },
778
+ {
779
+ "label": "break",
780
+ "kind": 14,
781
+ "detail": "Break out of a loop keyword",
782
+ "documentation": { "value": "Terminates the execution of a `while`, `repeat`, or `for` loop, skipping to the next statement after the loop." },
783
+ "insertText": "break",
784
+ "insertTextRules": 0,
785
+ "sortText": "06_break"
786
+ },
787
+ {
788
+ "label": "goto",
789
+ "kind": 14,
790
+ "detail": "Jump to a label (Lua 5.2+)",
791
+ "documentation": { "value": "Transfers the program control to the statement after the given label. Uses `::label::` syntax for label definitions.\n\n```lua\ngoto continue\n::continue::\n```\n\n**Note:** Available in Lua 5.2+ and LuaJIT 2.x." },
792
+ "insertText": "goto",
793
+ "insertTextRules": 0,
794
+ "sortText": "06_goto"
795
+ },
796
+ {
797
+ "label": "in",
798
+ "kind": 14,
799
+ "detail": "Generic for-loop keyword",
800
+ "documentation": { "value": "Used in generic `for` loops to specify the iterator.\n\n```lua\nfor k, v in pairs(t) do ... end\n```" },
801
+ "insertText": "in",
802
+ "insertTextRules": 0,
803
+ "sortText": "06_in"
804
+ },
805
+ {
806
+ "label": "and",
807
+ "kind": 14,
808
+ "detail": "Logical AND operator",
809
+ "documentation": { "value": "Logical conjunction. Returns its first argument if it is false or nil; otherwise returns its second argument.\n\n```lua\nlocal x = a and b -- short-circuit evaluation\n```" },
810
+ "insertText": "and",
811
+ "insertTextRules": 0,
812
+ "sortText": "06_and"
813
+ },
814
+ {
815
+ "label": "or",
816
+ "kind": 14,
817
+ "detail": "Logical OR operator",
818
+ "documentation": { "value": "Logical disjunction. Returns its first argument if it is not false/nil; otherwise returns its second argument.\n\n```lua\nlocal x = a or default_value\n```" },
819
+ "insertText": "or",
820
+ "insertTextRules": 0,
821
+ "sortText": "06_or"
822
+ },
823
+ {
824
+ "label": "not",
825
+ "kind": 14,
826
+ "detail": "Logical NOT operator",
827
+ "documentation": { "value": "Logical negation. Returns `true` if the argument is false or nil, otherwise returns `false`.\n\n```lua\nif not done then ... end\n```" },
828
+ "insertText": "not",
829
+ "insertTextRules": 0,
830
+ "sortText": "06_not"
831
+ },
832
+ {
833
+ "label": "nil",
834
+ "kind": 14,
835
+ "detail": "Nil value keyword",
836
+ "documentation": { "value": "The type `nil` has one single value, `nil`, whose main property is to be different from any other value. It represents the absence of a useful value." },
837
+ "insertText": "nil",
838
+ "insertTextRules": 0,
839
+ "sortText": "06_nil"
840
+ },
841
+ {
842
+ "label": "true",
843
+ "kind": 14,
844
+ "detail": "Boolean true keyword",
845
+ "documentation": { "value": "The boolean value `true`." },
846
+ "insertText": "true",
847
+ "insertTextRules": 0,
848
+ "sortText": "06_true"
849
+ },
850
+ {
851
+ "label": "false",
852
+ "kind": 14,
853
+ "detail": "Boolean false keyword",
854
+ "documentation": { "value": "The boolean value `false`. Together with `nil`, it is considered false in conditional tests; all other values are true." },
855
+ "insertText": "false",
856
+ "insertTextRules": 0,
857
+ "sortText": "06_false"
858
+ },
859
+ {
860
+ "label": "function definition",
861
+ "kind": 15,
862
+ "detail": "Define a named function",
863
+ "documentation": { "value": "Snippet for a named function definition.\n\n```lua\nfunction name(args)\n -- body\nend\n```" },
864
+ "insertText": "function ${1:name}(${2:args})\n\t${3:-- body}\nend",
865
+ "insertTextRules": 4,
866
+ "sortText": "07_function_definition"
867
+ },
868
+ {
869
+ "label": "local function",
870
+ "kind": 15,
871
+ "detail": "Define a local function",
872
+ "documentation": { "value": "Snippet for a local function definition.\n\n```lua\nlocal function name(args)\n -- body\nend\n```" },
873
+ "insertText": "local function ${1:name}(${2:args})\n\t${3:-- body}\nend",
874
+ "insertTextRules": 4,
875
+ "sortText": "07_local_function"
876
+ },
877
+ {
878
+ "label": "for i = ...",
879
+ "kind": 15,
880
+ "detail": "Numeric for loop",
881
+ "documentation": { "value": "Snippet for a numeric `for` loop.\n\n```lua\nfor i = 1, 10 do\n -- body\nend\n```" },
882
+ "insertText": "for ${1:i} = ${2:1}, ${3:10}${4:, ${5:1}} do\n\t${6:-- body}\nend",
883
+ "insertTextRules": 4,
884
+ "sortText": "07_for_numeric"
885
+ },
886
+ {
887
+ "label": "for k, v in pairs",
888
+ "kind": 15,
889
+ "detail": "Generic for loop with pairs()",
890
+ "documentation": { "value": "Snippet to iterate over all key-value pairs in a table.\n\n```lua\nfor k, v in pairs(t) do\n -- body\nend\n```" },
891
+ "insertText": "for ${1:k}, ${2:v} in pairs(${3:t}) do\n\t${4:-- body}\nend",
892
+ "insertTextRules": 4,
893
+ "sortText": "07_for_pairs"
894
+ },
895
+ {
896
+ "label": "for i, v in ipairs",
897
+ "kind": 15,
898
+ "detail": "Generic for loop with ipairs()",
899
+ "documentation": { "value": "Snippet to iterate over integer-keyed elements of a table.\n\n```lua\nfor i, v in ipairs(t) do\n -- body\nend\n```" },
900
+ "insertText": "for ${1:i}, ${2:v} in ipairs(${3:t}) do\n\t${4:-- body}\nend",
901
+ "insertTextRules": 4,
902
+ "sortText": "07_for_ipairs"
903
+ },
904
+ {
905
+ "label": "while loop",
906
+ "kind": 15,
907
+ "detail": "While loop",
908
+ "documentation": { "value": "Snippet for a `while` loop.\n\n```lua\nwhile condition do\n -- body\nend\n```" },
909
+ "insertText": "while ${1:condition} do\n\t${2:-- body}\nend",
910
+ "insertTextRules": 4,
911
+ "sortText": "07_while_loop"
912
+ },
913
+ {
914
+ "label": "repeat until",
915
+ "kind": 15,
916
+ "detail": "Repeat-until loop",
917
+ "documentation": { "value": "Snippet for a `repeat-until` loop. The body runs at least once.\n\n```lua\nrepeat\n -- body\nuntil condition\n```" },
918
+ "insertText": "repeat\n\t${1:-- body}\nuntil ${2:condition}",
919
+ "insertTextRules": 4,
920
+ "sortText": "07_repeat_until"
921
+ },
922
+ {
923
+ "label": "if then end",
924
+ "kind": 15,
925
+ "detail": "If-then-end block",
926
+ "documentation": { "value": "Snippet for a simple `if` block.\n\n```lua\nif condition then\n -- body\nend\n```" },
927
+ "insertText": "if ${1:condition} then\n\t${2:-- body}\nend",
928
+ "insertTextRules": 4,
929
+ "sortText": "07_if_then_end"
930
+ },
931
+ {
932
+ "label": "if else",
933
+ "kind": 15,
934
+ "detail": "If-else block",
935
+ "documentation": { "value": "Snippet for an `if-else` block.\n\n```lua\nif condition then\n -- then body\nelse\n -- else body\nend\n```" },
936
+ "insertText": "if ${1:condition} then\n\t${2:-- then body}\nelse\n\t${3:-- else body}\nend",
937
+ "insertTextRules": 4,
938
+ "sortText": "07_if_else"
939
+ },
940
+ {
941
+ "label": "module pattern",
942
+ "kind": 15,
943
+ "detail": "Lua module pattern",
944
+ "documentation": { "value": "Creates a module using the standard Lua module pattern (returning a table).\n\n```lua\nlocal M = {}\n\nfunction M.myFunc()\n -- ...\nend\n\nreturn M\n```" },
945
+ "insertText": "local ${1:M} = {}\n\nfunction ${1:M}.${2:name}(${3:args})\n\t${4:-- body}\nend\n\nreturn ${1:M}",
946
+ "insertTextRules": 4,
947
+ "sortText": "07_module_pattern"
948
+ },
949
+ {
950
+ "label": "class with metatables",
951
+ "kind": 15,
952
+ "detail": "OOP class pattern using metatables",
953
+ "documentation": { "value": "Creates a class-like structure using metatables and `__index`.\n\n```lua\nlocal MyClass = {}\nMyClass.__index = MyClass\n\nfunction MyClass.new(value)\n local self = setmetatable({}, MyClass)\n self.value = value\n return self\nend\n\nfunction MyClass:getValue()\n return self.value\nend\n```" },
954
+ "insertText": "local ${1:MyClass} = {}\n${1:MyClass}.__index = ${1:MyClass}\n\nfunction ${1:MyClass}.new(${2:args})\n\tlocal self = setmetatable({}, ${1:MyClass})\n\t${3:-- initialize}\n\treturn self\nend\n\nfunction ${1:MyClass}:${4:method}(${5:})\n\t${6:-- body}\nend\n\nreturn ${1:MyClass}",
955
+ "insertTextRules": 4,
956
+ "sortText": "07_class_metatables"
957
+ },
958
+ {
959
+ "label": "coroutine pattern",
960
+ "kind": 15,
961
+ "detail": "Coroutine creation and resumption pattern",
962
+ "documentation": { "value": "Creates and uses a coroutine.\n\n```lua\nlocal co = coroutine.create(function()\n for i = 1, 5 do\n coroutine.yield(i)\n end\nend)\n\nwhile coroutine.status(co) ~= \"dead\" do\n local ok, value = coroutine.resume(co)\n if ok then print(value) end\nend\n```" },
963
+ "insertText": "local ${1:co} = coroutine.create(function(${2:})\n\t${3:coroutine.yield(${4:value})}\nend)\n\nlocal ${5:ok}, ${6:value} = coroutine.resume(${1:co})",
964
+ "insertTextRules": 4,
965
+ "sortText": "07_coroutine_pattern"
966
+ }
967
+ ]
968
+ }