@enjoys/context-engine 1.0.0 → 1.0.1

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 (105) 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/bundle.json +321 -0
  8. package/data/commands/composer.json +507 -0
  9. package/data/commands/dart.json +216 -0
  10. package/data/commands/dbmate.json +257 -0
  11. package/data/commands/docker-compose.json +384 -0
  12. package/data/commands/drizzle-kit.json +217 -0
  13. package/data/commands/expo.json +65 -0
  14. package/data/commands/fastlane.json +243 -0
  15. package/data/commands/fd.json +86 -0
  16. package/data/commands/flutter.json +298 -0
  17. package/data/commands/flyway.json +261 -0
  18. package/data/commands/fzf.json +103 -0
  19. package/data/commands/gem.json +267 -0
  20. package/data/commands/jq.json +100 -0
  21. package/data/commands/k9s.json +62 -0
  22. package/data/commands/liquibase.json +399 -0
  23. package/data/commands/manifest.json +619 -0
  24. package/data/commands/minikube.json +60 -0
  25. package/data/commands/ng.json +64 -0
  26. package/data/commands/nuxt.json +60 -0
  27. package/data/commands/php.json +157 -0
  28. package/data/commands/pm2.json +259 -0
  29. package/data/commands/pod.json +175 -0
  30. package/data/commands/prisma.json +257 -0
  31. package/data/commands/rails.json +372 -0
  32. package/data/commands/rake.json +360 -0
  33. package/data/commands/react-native.json +57 -0
  34. package/data/commands/rg.json +103 -0
  35. package/data/commands/rspec.json +257 -0
  36. package/data/commands/ruby.json +108 -0
  37. package/data/commands/sequelize.json +342 -0
  38. package/data/commands/snyk.json +442 -0
  39. package/data/commands/sonar-scanner.json +219 -0
  40. package/data/commands/stripe.json +314 -0
  41. package/data/commands/symfony.json +449 -0
  42. package/data/commands/tmux.json +197 -0
  43. package/data/commands/trivy.json +367 -0
  44. package/data/commands/twilio.json +382 -0
  45. package/data/commands/typeorm.json +262 -0
  46. package/data/commands/vue.json +60 -0
  47. package/data/commands/wp.json +857 -0
  48. package/data/commands/xcodebuild.json +141 -0
  49. package/data/commands/yq.json +57 -0
  50. package/data/completion/bash.json +1184 -0
  51. package/data/completion/c.json +1067 -0
  52. package/data/completion/cpp.json +824 -0
  53. package/data/completion/csharp.json +860 -0
  54. package/data/completion/dockerfile.json +536 -0
  55. package/data/completion/go.json +1346 -0
  56. package/data/completion/html.json +806 -0
  57. package/data/completion/java.json +1112 -0
  58. package/data/completion/javascript.json +914 -0
  59. package/data/completion/lua.json +968 -0
  60. package/data/completion/php.json +1535 -0
  61. package/data/completion/python.json +1427 -0
  62. package/data/completion/ruby.json +1531 -0
  63. package/data/completion/rust.json +698 -0
  64. package/data/completion/sql.json +887 -0
  65. package/data/completion/toml.json +428 -0
  66. package/data/completion/typescript.json +338 -0
  67. package/data/completion/yaml.json +563 -0
  68. package/data/defination/bash.json +565 -0
  69. package/data/defination/c.json +865 -0
  70. package/data/defination/cpp.json +348 -0
  71. package/data/defination/csharp.json +144 -0
  72. package/data/defination/dockerfile.json +113 -0
  73. package/data/defination/go.json +561 -0
  74. package/data/defination/html.json +559 -0
  75. package/data/defination/java.json +184 -0
  76. package/data/defination/javascript.json +265 -0
  77. package/data/defination/lua.json +181 -0
  78. package/data/defination/php.json +726 -0
  79. package/data/defination/python.json +717 -0
  80. package/data/defination/ruby.json +670 -0
  81. package/data/defination/rust.json +207 -0
  82. package/data/defination/sql.json +473 -0
  83. package/data/defination/toml.json +251 -0
  84. package/data/defination/typescript.json +29 -0
  85. package/data/defination/yaml.json +197 -0
  86. package/data/hover/bash.json +245 -0
  87. package/data/hover/c.json +265 -0
  88. package/data/hover/cpp.json +210 -0
  89. package/data/hover/csharp.json +290 -0
  90. package/data/hover/dockerfile.json +145 -0
  91. package/data/hover/go.json +580 -0
  92. package/data/hover/html.json +250 -0
  93. package/data/hover/java.json +395 -0
  94. package/data/hover/javascript.json +330 -0
  95. package/data/hover/lua.json +265 -0
  96. package/data/hover/php.json +300 -0
  97. package/data/hover/python.json +380 -0
  98. package/data/hover/ruby.json +265 -0
  99. package/data/hover/rust.json +275 -0
  100. package/data/hover/sql.json +230 -0
  101. package/data/hover/toml.json +145 -0
  102. package/data/hover/typescript.json +120 -0
  103. package/data/hover/yaml.json +165 -0
  104. package/data/manifest.json +242 -0
  105. package/package.json +1 -1
@@ -0,0 +1,1531 @@
1
+ {
2
+ "language": "ruby",
3
+ "completions": [
4
+ {
5
+ "label": "puts",
6
+ "kind": 1,
7
+ "detail": "Write to stdout with newline",
8
+ "documentation": { "value": "Writes the given object(s) to STDOUT followed by a newline.\n\n```ruby\nputs 'Hello, World!'\nputs name\nputs \"Value: #{x}\"\n```" },
9
+ "insertText": "puts ${1:object}",
10
+ "insertTextRules": 4,
11
+ "sortText": "00_puts"
12
+ },
13
+ {
14
+ "label": "print",
15
+ "kind": 1,
16
+ "detail": "Write to stdout without newline",
17
+ "documentation": { "value": "Prints the given object(s) to STDOUT without a trailing newline.\n\n```ruby\nprint 'Hello '\nprint 'World'\n```" },
18
+ "insertText": "print ${1:object}",
19
+ "insertTextRules": 4,
20
+ "sortText": "00_print"
21
+ },
22
+ {
23
+ "label": "p",
24
+ "kind": 1,
25
+ "detail": "Inspect and print object",
26
+ "documentation": { "value": "Prints the `.inspect` output of the given object(s) followed by a newline. Useful for debugging.\n\n```ruby\np [1, 2, 3]\np variable\n```" },
27
+ "insertText": "p ${1:object}",
28
+ "insertTextRules": 4,
29
+ "sortText": "00_p"
30
+ },
31
+ {
32
+ "label": "pp",
33
+ "kind": 1,
34
+ "detail": "Pretty-print object",
35
+ "documentation": { "value": "Pretty-prints the given object(s) with indentation. Requires `pp` in older Ruby versions.\n\n```ruby\npp({ a: 1, b: [2, 3] })\n```" },
36
+ "insertText": "pp ${1:object}",
37
+ "insertTextRules": 4,
38
+ "sortText": "00_pp"
39
+ },
40
+ {
41
+ "label": "printf",
42
+ "kind": 1,
43
+ "detail": "Formatted output to stdout",
44
+ "documentation": { "value": "Prints a formatted string to STDOUT using format specifiers.\n\n```ruby\nprintf(\"%s is %d years old\\n\", name, age)\nprintf(\"%.2f\\n\", 3.14159)\n```" },
45
+ "insertText": "printf(\"${1:format}\", ${2:args})",
46
+ "insertTextRules": 4,
47
+ "sortText": "00_printf"
48
+ },
49
+ {
50
+ "label": "warn",
51
+ "kind": 1,
52
+ "detail": "Write to stderr",
53
+ "documentation": { "value": "Writes the given message(s) to STDERR.\n\n```ruby\nwarn 'Something went wrong'\nwarn 'Deprecation warning:', msg\n```" },
54
+ "insertText": "warn \"${1:message}\"",
55
+ "insertTextRules": 4,
56
+ "sortText": "00_warn"
57
+ },
58
+ {
59
+ "label": "STDOUT.write",
60
+ "kind": 1,
61
+ "detail": "Write bytes to stdout",
62
+ "documentation": { "value": "Writes the given string directly to STDOUT. Returns the number of bytes written.\n\n```ruby\nSTDOUT.write('hello')\n```" },
63
+ "insertText": "STDOUT.write(${1:string})",
64
+ "insertTextRules": 4,
65
+ "sortText": "00_stdout_write"
66
+ },
67
+ {
68
+ "label": "def",
69
+ "kind": 14,
70
+ "detail": "Define a method",
71
+ "documentation": { "value": "Defines a new method.\n\n```ruby\ndef greet(name)\n \"Hello, #{name}!\"\nend\n```" },
72
+ "insertText": "def ${1:method_name}(${2:args})\n ${3:# body}\nend",
73
+ "insertTextRules": 4,
74
+ "sortText": "01_def"
75
+ },
76
+ {
77
+ "label": "class",
78
+ "kind": 14,
79
+ "detail": "Define a class",
80
+ "documentation": { "value": "Defines a new class.\n\n```ruby\nclass MyClass < BaseClass\n def initialize\n end\nend\n```" },
81
+ "insertText": "class ${1:ClassName}\n ${2:# body}\nend",
82
+ "insertTextRules": 4,
83
+ "sortText": "01_class"
84
+ },
85
+ {
86
+ "label": "module",
87
+ "kind": 14,
88
+ "detail": "Define a module",
89
+ "documentation": { "value": "Defines a new module for namespacing or mixins.\n\n```ruby\nmodule MyModule\n def helper\n end\nend\n```" },
90
+ "insertText": "module ${1:ModuleName}\n ${2:# body}\nend",
91
+ "insertTextRules": 4,
92
+ "sortText": "01_module"
93
+ },
94
+ {
95
+ "label": "include",
96
+ "kind": 14,
97
+ "detail": "Include a module as instance methods",
98
+ "documentation": { "value": "Includes a module's methods as instance methods in the current class.\n\n```ruby\nclass MyClass\n include Comparable\nend\n```" },
99
+ "insertText": "include ${1:ModuleName}",
100
+ "insertTextRules": 4,
101
+ "sortText": "01_include"
102
+ },
103
+ {
104
+ "label": "extend",
105
+ "kind": 14,
106
+ "detail": "Extend with module as class methods",
107
+ "documentation": { "value": "Adds a module's methods as class methods to the current class or object.\n\n```ruby\nclass MyClass\n extend ClassMethods\nend\n```" },
108
+ "insertText": "extend ${1:ModuleName}",
109
+ "insertTextRules": 4,
110
+ "sortText": "01_extend"
111
+ },
112
+ {
113
+ "label": "prepend",
114
+ "kind": 14,
115
+ "detail": "Prepend a module",
116
+ "documentation": { "value": "Prepends a module, inserting it before the class in the method lookup chain.\n\n```ruby\nclass MyClass\n prepend Logging\nend\n```" },
117
+ "insertText": "prepend ${1:ModuleName}",
118
+ "insertTextRules": 4,
119
+ "sortText": "01_prepend"
120
+ },
121
+ {
122
+ "label": "require",
123
+ "kind": 14,
124
+ "detail": "Load an external library",
125
+ "documentation": { "value": "Loads the given library or gem. Searches `$LOAD_PATH`.\n\n```ruby\nrequire 'json'\nrequire 'net/http'\n```" },
126
+ "insertText": "require '${1:library}'",
127
+ "insertTextRules": 4,
128
+ "sortText": "01_require"
129
+ },
130
+ {
131
+ "label": "require_relative",
132
+ "kind": 14,
133
+ "detail": "Load a file relative to current file",
134
+ "documentation": { "value": "Loads a file relative to the directory of the current file.\n\n```ruby\nrequire_relative 'helpers/utils'\n```" },
135
+ "insertText": "require_relative '${1:path}'",
136
+ "insertTextRules": 4,
137
+ "sortText": "01_require_relative"
138
+ },
139
+ {
140
+ "label": "attr_accessor",
141
+ "kind": 14,
142
+ "detail": "Define getter and setter",
143
+ "documentation": { "value": "Creates getter and setter methods for the given attribute(s).\n\n```ruby\nclass Person\n attr_accessor :name, :age\nend\n```" },
144
+ "insertText": "attr_accessor :${1:attribute}",
145
+ "insertTextRules": 4,
146
+ "sortText": "01_attr_accessor"
147
+ },
148
+ {
149
+ "label": "attr_reader",
150
+ "kind": 14,
151
+ "detail": "Define getter only",
152
+ "documentation": { "value": "Creates getter methods for the given attribute(s).\n\n```ruby\nclass Person\n attr_reader :name\nend\n```" },
153
+ "insertText": "attr_reader :${1:attribute}",
154
+ "insertTextRules": 4,
155
+ "sortText": "01_attr_reader"
156
+ },
157
+ {
158
+ "label": "attr_writer",
159
+ "kind": 14,
160
+ "detail": "Define setter only",
161
+ "documentation": { "value": "Creates setter methods for the given attribute(s).\n\n```ruby\nclass Person\n attr_writer :name\nend\n```" },
162
+ "insertText": "attr_writer :${1:attribute}",
163
+ "insertTextRules": 4,
164
+ "sortText": "01_attr_writer"
165
+ },
166
+ {
167
+ "label": "begin/rescue/ensure/end",
168
+ "kind": 14,
169
+ "detail": "Exception handling block",
170
+ "documentation": { "value": "Handles exceptions with rescue and optional ensure cleanup.\n\n```ruby\nbegin\n risky_operation\nrescue StandardError => e\n puts e.message\nensure\n cleanup\nend\n```" },
171
+ "insertText": "begin\n ${1:# code}\nrescue ${2:StandardError} => ${3:e}\n ${4:puts e.message}\nensure\n ${5:# cleanup}\nend",
172
+ "insertTextRules": 4,
173
+ "sortText": "01_begin_rescue"
174
+ },
175
+ {
176
+ "label": "raise",
177
+ "kind": 14,
178
+ "detail": "Raise an exception",
179
+ "documentation": { "value": "Raises an exception. Can specify exception class and message.\n\n```ruby\nraise 'Something went wrong'\nraise ArgumentError, 'Invalid input'\nraise CustomError.new('msg')\n```" },
180
+ "insertText": "raise ${1:RuntimeError}, '${2:message}'",
181
+ "insertTextRules": 4,
182
+ "sortText": "01_raise"
183
+ },
184
+ {
185
+ "label": "yield",
186
+ "kind": 14,
187
+ "detail": "Yield to a block",
188
+ "documentation": { "value": "Passes control to the block given to the current method.\n\n```ruby\ndef with_logging\n puts 'Start'\n yield\n puts 'End'\nend\n```" },
189
+ "insertText": "yield${1: ${2:args}}",
190
+ "insertTextRules": 4,
191
+ "sortText": "01_yield"
192
+ },
193
+ {
194
+ "label": "block_given?",
195
+ "kind": 1,
196
+ "detail": "Check if a block was passed",
197
+ "documentation": { "value": "Returns `true` if the current method was called with a block.\n\n```ruby\ndef maybe_yield\n yield if block_given?\nend\n```" },
198
+ "insertText": "block_given?",
199
+ "insertTextRules": 4,
200
+ "sortText": "01_block_given"
201
+ },
202
+ {
203
+ "label": "return",
204
+ "kind": 14,
205
+ "detail": "Return from method",
206
+ "documentation": { "value": "Returns a value from the current method. Implicit return of last expression is idiomatic Ruby.\n\n```ruby\ndef add(a, b)\n return a + b\nend\n```" },
207
+ "insertText": "return ${1:value}",
208
+ "insertTextRules": 4,
209
+ "sortText": "01_return"
210
+ },
211
+ {
212
+ "label": "lambda",
213
+ "kind": 1,
214
+ "detail": "Create a lambda",
215
+ "documentation": { "value": "Creates a lambda (strict Proc). Checks argument count and `return` exits the lambda only.\n\n```ruby\nadd = lambda { |a, b| a + b }\nadd.call(1, 2)\n```" },
216
+ "insertText": "lambda { |${1:args}| ${2:body} }",
217
+ "insertTextRules": 4,
218
+ "sortText": "01_lambda"
219
+ },
220
+ {
221
+ "label": "proc",
222
+ "kind": 1,
223
+ "detail": "Create a proc",
224
+ "documentation": { "value": "Creates a Proc object from a block.\n\n```ruby\ndouble = proc { |x| x * 2 }\ndouble.call(5) # => 10\n```" },
225
+ "insertText": "proc { |${1:args}| ${2:body} }",
226
+ "insertTextRules": 4,
227
+ "sortText": "01_proc"
228
+ },
229
+ {
230
+ "label": "Proc.new",
231
+ "kind": 1,
232
+ "detail": "Create a Proc object",
233
+ "documentation": { "value": "Creates a new Proc object from a block.\n\n```ruby\np = Proc.new { |x| x * 2 }\np.call(5)\n```" },
234
+ "insertText": "Proc.new { |${1:args}| ${2:body} }",
235
+ "insertTextRules": 4,
236
+ "sortText": "01_proc_new"
237
+ },
238
+ {
239
+ "label": "->",
240
+ "kind": 1,
241
+ "detail": "Lambda literal (stabby lambda)",
242
+ "documentation": { "value": "Creates a lambda using the stabby lambda syntax.\n\n```ruby\nadd = ->(a, b) { a + b }\nadd.call(1, 2)\n```" },
243
+ "insertText": "->(${1:args}) { ${2:body} }",
244
+ "insertTextRules": 4,
245
+ "sortText": "01_stabby_lambda"
246
+ },
247
+ {
248
+ "label": "do..end",
249
+ "kind": 14,
250
+ "detail": "Block with do..end",
251
+ "documentation": { "value": "Multi-line block syntax.\n\n```ruby\n[1, 2, 3].each do |item|\n puts item\nend\n```" },
252
+ "insertText": "do |${1:var}|\n ${2:# body}\nend",
253
+ "insertTextRules": 4,
254
+ "sortText": "01_do_end"
255
+ },
256
+ {
257
+ "label": "if",
258
+ "kind": 14,
259
+ "detail": "Conditional if statement",
260
+ "documentation": { "value": "Executes code if the condition is true.\n\n```ruby\nif condition\n # do something\nelsif other\n # alternative\nelse\n # default\nend\n```" },
261
+ "insertText": "if ${1:condition}\n ${2:# body}\nend",
262
+ "insertTextRules": 4,
263
+ "sortText": "02_if"
264
+ },
265
+ {
266
+ "label": "unless",
267
+ "kind": 14,
268
+ "detail": "Negated conditional",
269
+ "documentation": { "value": "Executes code if the condition is false.\n\n```ruby\nunless logged_in?\n redirect_to login_path\nend\n```" },
270
+ "insertText": "unless ${1:condition}\n ${2:# body}\nend",
271
+ "insertTextRules": 4,
272
+ "sortText": "02_unless"
273
+ },
274
+ {
275
+ "label": "case/when",
276
+ "kind": 14,
277
+ "detail": "Case/when expression",
278
+ "documentation": { "value": "Pattern matching with case/when.\n\n```ruby\ncase value\nwhen 1\n 'one'\nwhen 2..5\n 'two to five'\nelse\n 'other'\nend\n```" },
279
+ "insertText": "case ${1:expression}\nwhen ${2:value}\n ${3:# body}\nelse\n ${4:# default}\nend",
280
+ "insertTextRules": 4,
281
+ "sortText": "02_case_when"
282
+ },
283
+ {
284
+ "label": "case/in",
285
+ "kind": 14,
286
+ "detail": "Pattern matching (Ruby 3+)",
287
+ "documentation": { "value": "Structural pattern matching introduced in Ruby 2.7+.\n\n```ruby\ncase data\nin { name: String => name, age: (18..) => age }\n puts \"#{name}, #{age}\"\nin [Integer => x, Integer => y]\n puts x + y\nend\n```" },
288
+ "insertText": "case ${1:expression}\nin ${2:pattern}\n ${3:# body}\nelse\n ${4:# default}\nend",
289
+ "insertTextRules": 4,
290
+ "sortText": "02_case_in"
291
+ },
292
+ {
293
+ "label": "while",
294
+ "kind": 14,
295
+ "detail": "While loop",
296
+ "documentation": { "value": "Executes code while the condition is true.\n\n```ruby\nwhile condition\n # loop body\nend\n```" },
297
+ "insertText": "while ${1:condition}\n ${2:# body}\nend",
298
+ "insertTextRules": 4,
299
+ "sortText": "02_while"
300
+ },
301
+ {
302
+ "label": "until",
303
+ "kind": 14,
304
+ "detail": "Until loop",
305
+ "documentation": { "value": "Executes code until the condition becomes true.\n\n```ruby\nuntil done?\n process_next\nend\n```" },
306
+ "insertText": "until ${1:condition}\n ${2:# body}\nend",
307
+ "insertTextRules": 4,
308
+ "sortText": "02_until"
309
+ },
310
+ {
311
+ "label": "for..in",
312
+ "kind": 14,
313
+ "detail": "For loop",
314
+ "documentation": { "value": "Iterates over a collection. Prefer `.each` in idiomatic Ruby.\n\n```ruby\nfor item in collection\n puts item\nend\n```" },
315
+ "insertText": "for ${1:item} in ${2:collection}\n ${3:# body}\nend",
316
+ "insertTextRules": 4,
317
+ "sortText": "02_for_in"
318
+ },
319
+ {
320
+ "label": "break",
321
+ "kind": 14,
322
+ "detail": "Break out of a loop",
323
+ "documentation": { "value": "Terminates the most internal loop or block.\n\n```ruby\nloop do\n break if condition\nend\n```" },
324
+ "insertText": "break",
325
+ "sortText": "02_break"
326
+ },
327
+ {
328
+ "label": "next",
329
+ "kind": 14,
330
+ "detail": "Skip to next iteration",
331
+ "documentation": { "value": "Skips to the next iteration of a loop or block.\n\n```ruby\n[1, 2, 3].each do |n|\n next if n.even?\n puts n\nend\n```" },
332
+ "insertText": "next",
333
+ "sortText": "02_next"
334
+ },
335
+ {
336
+ "label": "redo",
337
+ "kind": 14,
338
+ "detail": "Restart current iteration",
339
+ "documentation": { "value": "Restarts the current iteration of a loop without re-evaluating the condition.\n\n```ruby\nattempts = 0\nloop do\n attempts += 1\n redo if attempts < 3\n break\nend\n```" },
340
+ "insertText": "redo",
341
+ "sortText": "02_redo"
342
+ },
343
+ {
344
+ "label": "retry",
345
+ "kind": 14,
346
+ "detail": "Retry from begin block",
347
+ "documentation": { "value": "Restarts execution from the beginning of a `begin` block. Used in rescue clauses.\n\n```ruby\nbegin\n connect\nrescue ConnectionError\n retry\nend\n```" },
348
+ "insertText": "retry",
349
+ "sortText": "02_retry"
350
+ },
351
+ {
352
+ "label": "super",
353
+ "kind": 14,
354
+ "detail": "Call parent method",
355
+ "documentation": { "value": "Calls the same method in the parent class. Without arguments, passes the current method's arguments.\n\n```ruby\ndef initialize(name)\n super(name)\nend\n```" },
356
+ "insertText": "super",
357
+ "sortText": "01_super"
358
+ },
359
+ {
360
+ "label": "self",
361
+ "kind": 14,
362
+ "detail": "Reference to current object",
363
+ "documentation": { "value": "Refers to the current object (receiver of the current method).\n\n```ruby\ndef name=(value)\n self.name = value\nend\n```" },
364
+ "insertText": "self",
365
+ "sortText": "01_self"
366
+ },
367
+ {
368
+ "label": "defined?",
369
+ "kind": 14,
370
+ "detail": "Check if expression is defined",
371
+ "documentation": { "value": "Returns a string describing the expression, or `nil` if not defined.\n\n```ruby\ndefined?(foo) # => nil or \"local-variable\"\ndefined?(String) # => \"constant\"\n```" },
372
+ "insertText": "defined?(${1:expression})",
373
+ "insertTextRules": 4,
374
+ "sortText": "01_defined"
375
+ },
376
+ {
377
+ "label": "alias",
378
+ "kind": 14,
379
+ "detail": "Create method alias",
380
+ "documentation": { "value": "Creates an alias for a method.\n\n```ruby\nalias new_name old_name\nalias_method :new_name, :old_name\n```" },
381
+ "insertText": "alias ${1:new_name} ${2:old_name}",
382
+ "insertTextRules": 4,
383
+ "sortText": "01_alias"
384
+ },
385
+ {
386
+ "label": "freeze",
387
+ "kind": 2,
388
+ "detail": "Freeze an object",
389
+ "documentation": { "value": "Prevents further modifications to an object. Returns the frozen object.\n\n```ruby\nstr = 'hello'.freeze\nCONSTANT = [1, 2, 3].freeze\n```" },
390
+ "insertText": "freeze",
391
+ "sortText": "01_freeze"
392
+ },
393
+ {
394
+ "label": "frozen?",
395
+ "kind": 2,
396
+ "detail": "Check if object is frozen",
397
+ "documentation": { "value": "Returns `true` if the object is frozen.\n\n```ruby\n'hello'.freeze.frozen? # => true\n```" },
398
+ "insertText": "frozen?",
399
+ "sortText": "01_frozen"
400
+ },
401
+ {
402
+ "label": ".length",
403
+ "kind": 2,
404
+ "detail": "String/Array length",
405
+ "documentation": { "value": "Returns the number of characters in a string or elements in an array.\n\n```ruby\n'hello'.length # => 5\n[1, 2, 3].length # => 3\n```" },
406
+ "insertText": ".length",
407
+ "sortText": "03_length"
408
+ },
409
+ {
410
+ "label": ".size",
411
+ "kind": 2,
412
+ "detail": "Alias for length",
413
+ "documentation": { "value": "Returns the count of characters (String) or elements (Array/Hash). Alias for `.length`.\n\n```ruby\n'hello'.size # => 5\n[1, 2].size # => 2\n```" },
414
+ "insertText": ".size",
415
+ "sortText": "03_size"
416
+ },
417
+ {
418
+ "label": ".reverse",
419
+ "kind": 2,
420
+ "detail": "Reverse a string or array",
421
+ "documentation": { "value": "Returns a new string/array with elements in reverse order.\n\n```ruby\n'hello'.reverse # => \"olleh\"\n[1, 2, 3].reverse # => [3, 2, 1]\n```" },
422
+ "insertText": ".reverse",
423
+ "sortText": "03_reverse"
424
+ },
425
+ {
426
+ "label": ".upcase",
427
+ "kind": 2,
428
+ "detail": "Convert to uppercase",
429
+ "documentation": { "value": "Returns a copy of the string with all lowercase letters replaced with uppercase.\n\n```ruby\n'hello'.upcase # => \"HELLO\"\n```" },
430
+ "insertText": ".upcase",
431
+ "sortText": "03_upcase"
432
+ },
433
+ {
434
+ "label": ".downcase",
435
+ "kind": 2,
436
+ "detail": "Convert to lowercase",
437
+ "documentation": { "value": "Returns a copy of the string with all uppercase letters replaced with lowercase.\n\n```ruby\n'HELLO'.downcase # => \"hello\"\n```" },
438
+ "insertText": ".downcase",
439
+ "sortText": "03_downcase"
440
+ },
441
+ {
442
+ "label": ".capitalize",
443
+ "kind": 2,
444
+ "detail": "Capitalize first character",
445
+ "documentation": { "value": "Returns a copy with the first character uppercased and the rest lowercased.\n\n```ruby\n'hello world'.capitalize # => \"Hello world\"\n```" },
446
+ "insertText": ".capitalize",
447
+ "sortText": "03_capitalize"
448
+ },
449
+ {
450
+ "label": ".strip",
451
+ "kind": 2,
452
+ "detail": "Remove leading/trailing whitespace",
453
+ "documentation": { "value": "Returns a copy with leading and trailing whitespace removed.\n\n```ruby\n' hello '.strip # => \"hello\"\n```" },
454
+ "insertText": ".strip",
455
+ "sortText": "03_strip"
456
+ },
457
+ {
458
+ "label": ".lstrip",
459
+ "kind": 2,
460
+ "detail": "Remove leading whitespace",
461
+ "documentation": { "value": "Returns a copy with leading whitespace removed.\n\n```ruby\n' hello'.lstrip # => \"hello\"\n```" },
462
+ "insertText": ".lstrip",
463
+ "sortText": "03_lstrip"
464
+ },
465
+ {
466
+ "label": ".rstrip",
467
+ "kind": 2,
468
+ "detail": "Remove trailing whitespace",
469
+ "documentation": { "value": "Returns a copy with trailing whitespace removed.\n\n```ruby\n'hello '.rstrip # => \"hello\"\n```" },
470
+ "insertText": ".rstrip",
471
+ "sortText": "03_rstrip"
472
+ },
473
+ {
474
+ "label": ".chomp",
475
+ "kind": 2,
476
+ "detail": "Remove trailing newline",
477
+ "documentation": { "value": "Returns a new string with the trailing record separator removed (default `\\n`).\n\n```ruby\n\"hello\\n\".chomp # => \"hello\"\n```" },
478
+ "insertText": ".chomp",
479
+ "sortText": "03_chomp"
480
+ },
481
+ {
482
+ "label": ".chop",
483
+ "kind": 2,
484
+ "detail": "Remove last character",
485
+ "documentation": { "value": "Returns a new string with the last character removed.\n\n```ruby\n'hello'.chop # => \"hell\"\n```" },
486
+ "insertText": ".chop",
487
+ "sortText": "03_chop"
488
+ },
489
+ {
490
+ "label": ".gsub",
491
+ "kind": 2,
492
+ "detail": "Global substitution",
493
+ "documentation": { "value": "Returns a copy with all occurrences of the pattern replaced.\n\n```ruby\n'hello'.gsub('l', 'r') # => \"herro\"\n'hello'.gsub(/[aeiou]/, '*') # => \"h*ll*\"\n```" },
494
+ "insertText": ".gsub(${1:pattern}, ${2:replacement})",
495
+ "insertTextRules": 4,
496
+ "sortText": "03_gsub"
497
+ },
498
+ {
499
+ "label": ".sub",
500
+ "kind": 2,
501
+ "detail": "Substitute first occurrence",
502
+ "documentation": { "value": "Returns a copy with the first occurrence of the pattern replaced.\n\n```ruby\n'hello'.sub('l', 'r') # => \"herlo\"\n```" },
503
+ "insertText": ".sub(${1:pattern}, ${2:replacement})",
504
+ "insertTextRules": 4,
505
+ "sortText": "03_sub"
506
+ },
507
+ {
508
+ "label": ".replace",
509
+ "kind": 2,
510
+ "detail": "Replace entire string contents",
511
+ "documentation": { "value": "Replaces the contents of the string with the given other string.\n\n```ruby\ns = 'hello'\ns.replace('world') # s is now \"world\"\n```" },
512
+ "insertText": ".replace(${1:other_string})",
513
+ "insertTextRules": 4,
514
+ "sortText": "03_replace"
515
+ },
516
+ {
517
+ "label": ".split",
518
+ "kind": 2,
519
+ "detail": "Split string into array",
520
+ "documentation": { "value": "Divides the string into substrings based on a delimiter and returns an array.\n\n```ruby\n'a,b,c'.split(',') # => [\"a\", \"b\", \"c\"]\n'hello world'.split # => [\"hello\", \"world\"]\n```" },
521
+ "insertText": ".split(${1:delimiter})",
522
+ "insertTextRules": 4,
523
+ "sortText": "03_split"
524
+ },
525
+ {
526
+ "label": ".chars",
527
+ "kind": 2,
528
+ "detail": "Convert string to character array",
529
+ "documentation": { "value": "Returns an array of characters in the string.\n\n```ruby\n'hello'.chars # => [\"h\", \"e\", \"l\", \"l\", \"o\"]\n```" },
530
+ "insertText": ".chars",
531
+ "sortText": "03_chars"
532
+ },
533
+ {
534
+ "label": ".bytes",
535
+ "kind": 2,
536
+ "detail": "Get byte array",
537
+ "documentation": { "value": "Returns an array of bytes for the string.\n\n```ruby\n'hello'.bytes # => [104, 101, 108, 108, 111]\n```" },
538
+ "insertText": ".bytes",
539
+ "sortText": "03_bytes"
540
+ },
541
+ {
542
+ "label": ".include?",
543
+ "kind": 2,
544
+ "detail": "Check membership",
545
+ "documentation": { "value": "Returns `true` if the string contains the given substring, or the array contains the given element.\n\n```ruby\n'hello'.include?('ell') # => true\n[1, 2, 3].include?(2) # => true\n```" },
546
+ "insertText": ".include?(${1:value})",
547
+ "insertTextRules": 4,
548
+ "sortText": "03_include"
549
+ },
550
+ {
551
+ "label": ".start_with?",
552
+ "kind": 2,
553
+ "detail": "Check string prefix",
554
+ "documentation": { "value": "Returns `true` if the string starts with the given prefix.\n\n```ruby\n'hello'.start_with?('hel') # => true\n```" },
555
+ "insertText": ".start_with?(${1:prefix})",
556
+ "insertTextRules": 4,
557
+ "sortText": "03_start_with"
558
+ },
559
+ {
560
+ "label": ".end_with?",
561
+ "kind": 2,
562
+ "detail": "Check string suffix",
563
+ "documentation": { "value": "Returns `true` if the string ends with the given suffix.\n\n```ruby\n'hello'.end_with?('llo') # => true\n```" },
564
+ "insertText": ".end_with?(${1:suffix})",
565
+ "insertTextRules": 4,
566
+ "sortText": "03_end_with"
567
+ },
568
+ {
569
+ "label": ".match?",
570
+ "kind": 2,
571
+ "detail": "Test regex match",
572
+ "documentation": { "value": "Returns `true` if the string matches the given regex. Faster than `match` as it doesn't create a MatchData object.\n\n```ruby\n'hello'.match?(/\\w+/) # => true\n```" },
573
+ "insertText": ".match?(${1:pattern})",
574
+ "insertTextRules": 4,
575
+ "sortText": "03_match"
576
+ },
577
+ {
578
+ "label": ".scan",
579
+ "kind": 2,
580
+ "detail": "Scan for all matches",
581
+ "documentation": { "value": "Returns an array of all matches of the pattern in the string.\n\n```ruby\n'hello world'.scan(/\\w+/) # => [\"hello\", \"world\"]\n'a1b2c3'.scan(/\\d+/) # => [\"1\", \"2\", \"3\"]\n```" },
582
+ "insertText": ".scan(${1:pattern})",
583
+ "insertTextRules": 4,
584
+ "sortText": "03_scan"
585
+ },
586
+ {
587
+ "label": ".tr",
588
+ "kind": 2,
589
+ "detail": "Transliterate characters",
590
+ "documentation": { "value": "Returns a copy with characters in the first argument replaced by corresponding characters in the second.\n\n```ruby\n'hello'.tr('el', 'ip') # => \"hippo\"\n'hello'.tr('aeiou', '*') # => \"h*ll*\"\n```" },
591
+ "insertText": ".tr('${1:from}', '${2:to}')",
592
+ "insertTextRules": 4,
593
+ "sortText": "03_tr"
594
+ },
595
+ {
596
+ "label": ".squeeze",
597
+ "kind": 2,
598
+ "detail": "Remove consecutive duplicate characters",
599
+ "documentation": { "value": "Returns a new string with runs of the same character replaced by a single character.\n\n```ruby\n'aaabbbccc'.squeeze # => \"abc\"\n'aabbcc'.squeeze('a') # => \"abbcc\"\n```" },
600
+ "insertText": ".squeeze",
601
+ "sortText": "03_squeeze"
602
+ },
603
+ {
604
+ "label": ".center",
605
+ "kind": 2,
606
+ "detail": "Center string in width",
607
+ "documentation": { "value": "Centers the string in a field of the given width, padding with the given character.\n\n```ruby\n'hi'.center(10) # => \" hi \"\n'hi'.center(10, '-') # => \"----hi----\"\n```" },
608
+ "insertText": ".center(${1:width})",
609
+ "insertTextRules": 4,
610
+ "sortText": "03_center"
611
+ },
612
+ {
613
+ "label": ".ljust",
614
+ "kind": 2,
615
+ "detail": "Left-justify string",
616
+ "documentation": { "value": "Left-justifies the string in a field of the given width.\n\n```ruby\n'hi'.ljust(10) # => \"hi \"\n'hi'.ljust(10, '.') # => \"hi........\"\n```" },
617
+ "insertText": ".ljust(${1:width})",
618
+ "insertTextRules": 4,
619
+ "sortText": "03_ljust"
620
+ },
621
+ {
622
+ "label": ".rjust",
623
+ "kind": 2,
624
+ "detail": "Right-justify string",
625
+ "documentation": { "value": "Right-justifies the string in a field of the given width.\n\n```ruby\n'hi'.rjust(10) # => \" hi\"\n'hi'.rjust(10, '0') # => \"00000000hi\"\n```" },
626
+ "insertText": ".rjust(${1:width})",
627
+ "insertTextRules": 4,
628
+ "sortText": "03_rjust"
629
+ },
630
+ {
631
+ "label": ".encode",
632
+ "kind": 2,
633
+ "detail": "Encode string to encoding",
634
+ "documentation": { "value": "Returns a copy of the string transcoded to the given encoding.\n\n```ruby\nstr.encode('UTF-8')\nstr.encode('ASCII', invalid: :replace)\n```" },
635
+ "insertText": ".encode('${1:encoding}')",
636
+ "insertTextRules": 4,
637
+ "sortText": "03_encode"
638
+ },
639
+ {
640
+ "label": ".to_i",
641
+ "kind": 2,
642
+ "detail": "Convert to integer",
643
+ "documentation": { "value": "Converts the string to an integer. Leading whitespace is ignored, trailing non-numeric characters are ignored.\n\n```ruby\n'42'.to_i # => 42\n'0xff'.to_i(16) # => 255\n```" },
644
+ "insertText": ".to_i",
645
+ "sortText": "03_to_i"
646
+ },
647
+ {
648
+ "label": ".to_f",
649
+ "kind": 2,
650
+ "detail": "Convert to float",
651
+ "documentation": { "value": "Converts the string to a floating-point number.\n\n```ruby\n'3.14'.to_f # => 3.14\n```" },
652
+ "insertText": ".to_f",
653
+ "sortText": "03_to_f"
654
+ },
655
+ {
656
+ "label": ".to_sym",
657
+ "kind": 2,
658
+ "detail": "Convert to symbol",
659
+ "documentation": { "value": "Returns the symbol corresponding to the string.\n\n```ruby\n'hello'.to_sym # => :hello\n```" },
660
+ "insertText": ".to_sym",
661
+ "sortText": "03_to_sym"
662
+ },
663
+ {
664
+ "label": ".to_s",
665
+ "kind": 2,
666
+ "detail": "Convert to string",
667
+ "documentation": { "value": "Returns the string representation of the object.\n\n```ruby\n42.to_s # => \"42\"\n:hello.to_s # => \"hello\"\n```" },
668
+ "insertText": ".to_s",
669
+ "sortText": "03_to_s"
670
+ },
671
+ {
672
+ "label": ".push",
673
+ "kind": 2,
674
+ "detail": "Append to array",
675
+ "documentation": { "value": "Appends the given object(s) to the end of the array. Returns the array.\n\n```ruby\narr = [1, 2]\narr.push(3) # => [1, 2, 3]\narr.push(4, 5) # => [1, 2, 3, 4, 5]\n```" },
676
+ "insertText": ".push(${1:element})",
677
+ "insertTextRules": 4,
678
+ "sortText": "04_push"
679
+ },
680
+ {
681
+ "label": ".pop",
682
+ "kind": 2,
683
+ "detail": "Remove last element",
684
+ "documentation": { "value": "Removes and returns the last element of the array.\n\n```ruby\narr = [1, 2, 3]\narr.pop # => 3, arr is [1, 2]\n```" },
685
+ "insertText": ".pop",
686
+ "sortText": "04_pop"
687
+ },
688
+ {
689
+ "label": ".shift",
690
+ "kind": 2,
691
+ "detail": "Remove first element",
692
+ "documentation": { "value": "Removes and returns the first element of the array.\n\n```ruby\narr = [1, 2, 3]\narr.shift # => 1, arr is [2, 3]\n```" },
693
+ "insertText": ".shift",
694
+ "sortText": "04_shift"
695
+ },
696
+ {
697
+ "label": ".unshift",
698
+ "kind": 2,
699
+ "detail": "Prepend to array",
700
+ "documentation": { "value": "Prepends the given object(s) to the front of the array.\n\n```ruby\narr = [2, 3]\narr.unshift(1) # => [1, 2, 3]\n```" },
701
+ "insertText": ".unshift(${1:element})",
702
+ "insertTextRules": 4,
703
+ "sortText": "04_unshift"
704
+ },
705
+ {
706
+ "label": ".first",
707
+ "kind": 2,
708
+ "detail": "Get first element(s)",
709
+ "documentation": { "value": "Returns the first element, or the first `n` elements.\n\n```ruby\n[1, 2, 3].first # => 1\n[1, 2, 3].first(2) # => [1, 2]\n```" },
710
+ "insertText": ".first",
711
+ "sortText": "04_first"
712
+ },
713
+ {
714
+ "label": ".last",
715
+ "kind": 2,
716
+ "detail": "Get last element(s)",
717
+ "documentation": { "value": "Returns the last element, or the last `n` elements.\n\n```ruby\n[1, 2, 3].last # => 3\n[1, 2, 3].last(2) # => [2, 3]\n```" },
718
+ "insertText": ".last",
719
+ "sortText": "04_last"
720
+ },
721
+ {
722
+ "label": ".empty?",
723
+ "kind": 2,
724
+ "detail": "Check if empty",
725
+ "documentation": { "value": "Returns `true` if the string, array, or hash has no elements.\n\n```ruby\n[].empty? # => true\n''.empty? # => true\n{}.empty? # => true\n```" },
726
+ "insertText": ".empty?",
727
+ "sortText": "04_empty"
728
+ },
729
+ {
730
+ "label": ".flatten",
731
+ "kind": 2,
732
+ "detail": "Flatten nested arrays",
733
+ "documentation": { "value": "Returns a new array that is a one-dimensional flattening of the original.\n\n```ruby\n[[1, 2], [3, [4]]].flatten # => [1, 2, 3, 4]\n[[1, [2]], [3]].flatten(1) # => [1, [2], 3]\n```" },
734
+ "insertText": ".flatten",
735
+ "sortText": "04_flatten"
736
+ },
737
+ {
738
+ "label": ".compact",
739
+ "kind": 2,
740
+ "detail": "Remove nil values",
741
+ "documentation": { "value": "Returns a new array with all `nil` elements removed.\n\n```ruby\n[1, nil, 2, nil, 3].compact # => [1, 2, 3]\n```" },
742
+ "insertText": ".compact",
743
+ "sortText": "04_compact"
744
+ },
745
+ {
746
+ "label": ".uniq",
747
+ "kind": 2,
748
+ "detail": "Remove duplicates",
749
+ "documentation": { "value": "Returns a new array with duplicate values removed.\n\n```ruby\n[1, 2, 2, 3, 3].uniq # => [1, 2, 3]\n```" },
750
+ "insertText": ".uniq",
751
+ "sortText": "04_uniq"
752
+ },
753
+ {
754
+ "label": ".sort",
755
+ "kind": 2,
756
+ "detail": "Sort elements",
757
+ "documentation": { "value": "Returns a new array with elements sorted. Uses `<=>` by default.\n\n```ruby\n[3, 1, 2].sort # => [1, 2, 3]\n['b', 'a', 'c'].sort # => [\"a\", \"b\", \"c\"]\n[3, 1, 2].sort { |a, b| b <=> a } # => [3, 2, 1]\n```" },
758
+ "insertText": ".sort",
759
+ "sortText": "04_sort"
760
+ },
761
+ {
762
+ "label": ".sort_by",
763
+ "kind": 2,
764
+ "detail": "Sort by block result",
765
+ "documentation": { "value": "Sorts elements using the values returned by the block.\n\n```ruby\nwords.sort_by { |w| w.length }\nusers.sort_by(&:name)\n```" },
766
+ "insertText": ".sort_by { |${1:el}| ${2:el} }",
767
+ "insertTextRules": 4,
768
+ "sortText": "04_sort_by"
769
+ },
770
+ {
771
+ "label": ".each",
772
+ "kind": 2,
773
+ "detail": "Iterate over elements",
774
+ "documentation": { "value": "Calls the given block once for each element.\n\n```ruby\n[1, 2, 3].each { |n| puts n }\n{ a: 1 }.each { |k, v| puts \"#{k}: #{v}\" }\n```" },
775
+ "insertText": ".each { |${1:el}| ${2:el} }",
776
+ "insertTextRules": 4,
777
+ "sortText": "04_each"
778
+ },
779
+ {
780
+ "label": ".map",
781
+ "kind": 2,
782
+ "detail": "Transform elements",
783
+ "documentation": { "value": "Returns a new array with the results of running the block for every element.\n\n```ruby\n[1, 2, 3].map { |n| n * 2 } # => [2, 4, 6]\n['a', 'b'].map(&:upcase) # => [\"A\", \"B\"]\n```" },
784
+ "insertText": ".map { |${1:el}| ${2:el} }",
785
+ "insertTextRules": 4,
786
+ "sortText": "04_map"
787
+ },
788
+ {
789
+ "label": ".collect",
790
+ "kind": 2,
791
+ "detail": "Transform elements (alias for map)",
792
+ "documentation": { "value": "Alias for `.map`. Returns a new array with block results.\n\n```ruby\n[1, 2, 3].collect { |n| n * 2 } # => [2, 4, 6]\n```" },
793
+ "insertText": ".collect { |${1:el}| ${2:el} }",
794
+ "insertTextRules": 4,
795
+ "sortText": "04_collect"
796
+ },
797
+ {
798
+ "label": ".select",
799
+ "kind": 2,
800
+ "detail": "Filter elements (keep truthy)",
801
+ "documentation": { "value": "Returns a new array/hash containing elements for which the block returns a truthy value.\n\n```ruby\n[1, 2, 3, 4].select { |n| n.even? } # => [2, 4]\n{ a: 1, b: 2 }.select { |k, v| v > 1 } # => { b: 2 }\n```" },
802
+ "insertText": ".select { |${1:el}| ${2:condition} }",
803
+ "insertTextRules": 4,
804
+ "sortText": "04_select"
805
+ },
806
+ {
807
+ "label": ".filter",
808
+ "kind": 2,
809
+ "detail": "Filter elements (alias for select)",
810
+ "documentation": { "value": "Alias for `.select`. Returns elements for which the block returns truthy.\n\n```ruby\n[1, 2, 3, 4].filter(&:odd?) # => [1, 3]\n```" },
811
+ "insertText": ".filter { |${1:el}| ${2:condition} }",
812
+ "insertTextRules": 4,
813
+ "sortText": "04_filter"
814
+ },
815
+ {
816
+ "label": ".reject",
817
+ "kind": 2,
818
+ "detail": "Filter elements (remove truthy)",
819
+ "documentation": { "value": "Returns a new array/hash excluding elements for which the block returns truthy.\n\n```ruby\n[1, 2, 3, 4].reject { |n| n.even? } # => [1, 3]\n```" },
820
+ "insertText": ".reject { |${1:el}| ${2:condition} }",
821
+ "insertTextRules": 4,
822
+ "sortText": "04_reject"
823
+ },
824
+ {
825
+ "label": ".reduce",
826
+ "kind": 2,
827
+ "detail": "Accumulate values",
828
+ "documentation": { "value": "Combines elements by applying a binary operation, accumulating a result.\n\n```ruby\n[1, 2, 3].reduce(0) { |sum, n| sum + n } # => 6\n[1, 2, 3].reduce(:+) # => 6\n```" },
829
+ "insertText": ".reduce(${1:initial}) { |${2:acc}, ${3:el}| ${4:acc} }",
830
+ "insertTextRules": 4,
831
+ "sortText": "04_reduce"
832
+ },
833
+ {
834
+ "label": ".inject",
835
+ "kind": 2,
836
+ "detail": "Accumulate values (alias for reduce)",
837
+ "documentation": { "value": "Alias for `.reduce`. Combines elements by applying a binary operation.\n\n```ruby\n[1, 2, 3].inject(:+) # => 6\n```" },
838
+ "insertText": ".inject(${1:initial}) { |${2:acc}, ${3:el}| ${4:acc} }",
839
+ "insertTextRules": 4,
840
+ "sortText": "04_inject"
841
+ },
842
+ {
843
+ "label": ".find",
844
+ "kind": 2,
845
+ "detail": "Find first matching element",
846
+ "documentation": { "value": "Returns the first element for which the block returns truthy, or `nil` if none.\n\n```ruby\n[1, 2, 3].find { |n| n.even? } # => 2\n```" },
847
+ "insertText": ".find { |${1:el}| ${2:condition} }",
848
+ "insertTextRules": 4,
849
+ "sortText": "04_find"
850
+ },
851
+ {
852
+ "label": ".detect",
853
+ "kind": 2,
854
+ "detail": "Find first matching (alias for find)",
855
+ "documentation": { "value": "Alias for `.find`. Returns the first element for which the block returns truthy.\n\n```ruby\n[1, 2, 3].detect { |n| n > 1 } # => 2\n```" },
856
+ "insertText": ".detect { |${1:el}| ${2:condition} }",
857
+ "insertTextRules": 4,
858
+ "sortText": "04_detect"
859
+ },
860
+ {
861
+ "label": ".any?",
862
+ "kind": 2,
863
+ "detail": "Check if any element matches",
864
+ "documentation": { "value": "Returns `true` if the block returns truthy for any element.\n\n```ruby\n[1, 2, 3].any? { |n| n > 2 } # => true\n[1, 2, 3].any?(Integer) # => true\n```" },
865
+ "insertText": ".any? { |${1:el}| ${2:condition} }",
866
+ "insertTextRules": 4,
867
+ "sortText": "04_any"
868
+ },
869
+ {
870
+ "label": ".all?",
871
+ "kind": 2,
872
+ "detail": "Check if all elements match",
873
+ "documentation": { "value": "Returns `true` if the block returns truthy for every element.\n\n```ruby\n[2, 4, 6].all? { |n| n.even? } # => true\n[2, 4, 6].all?(&:even?) # => true\n```" },
874
+ "insertText": ".all? { |${1:el}| ${2:condition} }",
875
+ "insertTextRules": 4,
876
+ "sortText": "04_all"
877
+ },
878
+ {
879
+ "label": ".none?",
880
+ "kind": 2,
881
+ "detail": "Check if no elements match",
882
+ "documentation": { "value": "Returns `true` if the block returns falsy for every element.\n\n```ruby\n[1, 3, 5].none? { |n| n.even? } # => true\n```" },
883
+ "insertText": ".none? { |${1:el}| ${2:condition} }",
884
+ "insertTextRules": 4,
885
+ "sortText": "04_none"
886
+ },
887
+ {
888
+ "label": ".count",
889
+ "kind": 2,
890
+ "detail": "Count elements",
891
+ "documentation": { "value": "Returns the number of elements. With an argument, counts matching elements. With a block, counts elements for which the block returns truthy.\n\n```ruby\n[1, 2, 3].count # => 3\n[1, 2, 2].count(2) # => 2\n[1, 2, 3].count(&:odd?) # => 2\n```" },
892
+ "insertText": ".count",
893
+ "sortText": "04_count"
894
+ },
895
+ {
896
+ "label": ".min",
897
+ "kind": 2,
898
+ "detail": "Find minimum element",
899
+ "documentation": { "value": "Returns the minimum element using `<=>` or a block.\n\n```ruby\n[3, 1, 2].min # => 1\n```" },
900
+ "insertText": ".min",
901
+ "sortText": "04_min"
902
+ },
903
+ {
904
+ "label": ".max",
905
+ "kind": 2,
906
+ "detail": "Find maximum element",
907
+ "documentation": { "value": "Returns the maximum element using `<=>` or a block.\n\n```ruby\n[3, 1, 2].max # => 3\n```" },
908
+ "insertText": ".max",
909
+ "sortText": "04_max"
910
+ },
911
+ {
912
+ "label": ".min_by",
913
+ "kind": 2,
914
+ "detail": "Find minimum by block",
915
+ "documentation": { "value": "Returns the element for which the block returns the minimum value.\n\n```ruby\nwords.min_by { |w| w.length }\nusers.min_by(&:age)\n```" },
916
+ "insertText": ".min_by { |${1:el}| ${2:el} }",
917
+ "insertTextRules": 4,
918
+ "sortText": "04_min_by"
919
+ },
920
+ {
921
+ "label": ".max_by",
922
+ "kind": 2,
923
+ "detail": "Find maximum by block",
924
+ "documentation": { "value": "Returns the element for which the block returns the maximum value.\n\n```ruby\nwords.max_by { |w| w.length }\nusers.max_by(&:age)\n```" },
925
+ "insertText": ".max_by { |${1:el}| ${2:el} }",
926
+ "insertTextRules": 4,
927
+ "sortText": "04_max_by"
928
+ },
929
+ {
930
+ "label": ".sum",
931
+ "kind": 2,
932
+ "detail": "Sum all elements",
933
+ "documentation": { "value": "Returns the sum of elements. Optionally takes an initial value and a block.\n\n```ruby\n[1, 2, 3].sum # => 6\n[1, 2, 3].sum { |n| n * 2 } # => 12\n```" },
934
+ "insertText": ".sum",
935
+ "sortText": "04_sum"
936
+ },
937
+ {
938
+ "label": ".zip",
939
+ "kind": 2,
940
+ "detail": "Combine arrays element-wise",
941
+ "documentation": { "value": "Merges elements of self with corresponding elements from each argument array.\n\n```ruby\n[1, 2, 3].zip([4, 5, 6]) # => [[1, 4], [2, 5], [3, 6]]\n```" },
942
+ "insertText": ".zip(${1:other_array})",
943
+ "insertTextRules": 4,
944
+ "sortText": "04_zip"
945
+ },
946
+ {
947
+ "label": ".flat_map",
948
+ "kind": 2,
949
+ "detail": "Map and flatten",
950
+ "documentation": { "value": "Returns a new array with the concatenated results of running the block for every element.\n\n```ruby\n[[1, 2], [3, 4]].flat_map { |a| a } # => [1, 2, 3, 4]\nusers.flat_map(&:roles)\n```" },
951
+ "insertText": ".flat_map { |${1:el}| ${2:el} }",
952
+ "insertTextRules": 4,
953
+ "sortText": "04_flat_map"
954
+ },
955
+ {
956
+ "label": ".each_with_index",
957
+ "kind": 2,
958
+ "detail": "Iterate with index",
959
+ "documentation": { "value": "Calls the block with each element and its index.\n\n```ruby\n['a', 'b', 'c'].each_with_index do |el, i|\n puts \"#{i}: #{el}\"\nend\n```" },
960
+ "insertText": ".each_with_index { |${1:el}, ${2:i}| ${3} }",
961
+ "insertTextRules": 4,
962
+ "sortText": "04_each_with_index"
963
+ },
964
+ {
965
+ "label": ".each_with_object",
966
+ "kind": 2,
967
+ "detail": "Iterate with accumulator object",
968
+ "documentation": { "value": "Iterates with an arbitrary object, returning that object. Useful for building hashes or arrays.\n\n```ruby\n[1, 2, 3].each_with_object([]) { |n, arr| arr << n * 2 }\n# => [2, 4, 6]\n```" },
969
+ "insertText": ".each_with_object(${1:object}) { |${2:el}, ${3:obj}| ${4} }",
970
+ "insertTextRules": 4,
971
+ "sortText": "04_each_with_object"
972
+ },
973
+ {
974
+ "label": ".group_by",
975
+ "kind": 2,
976
+ "detail": "Group elements by block result",
977
+ "documentation": { "value": "Groups elements into a hash by the return value of the block.\n\n```ruby\n[1, 2, 3, 4].group_by(&:even?)\n# => { false: [1, 3], true: [2, 4] }\n```" },
978
+ "insertText": ".group_by { |${1:el}| ${2:el} }",
979
+ "insertTextRules": 4,
980
+ "sortText": "04_group_by"
981
+ },
982
+ {
983
+ "label": ".chunk",
984
+ "kind": 2,
985
+ "detail": "Chunk consecutive elements",
986
+ "documentation": { "value": "Enumerates over items, chunking them together based on the return value of the block.\n\n```ruby\n[1, 1, 2, 2, 3].chunk { |n| n }.to_a\n# => [[1, [1, 1]], [2, [2, 2]], [3, [3]]]\n```" },
987
+ "insertText": ".chunk { |${1:el}| ${2:el} }",
988
+ "insertTextRules": 4,
989
+ "sortText": "04_chunk"
990
+ },
991
+ {
992
+ "label": ".tally",
993
+ "kind": 2,
994
+ "detail": "Count occurrences",
995
+ "documentation": { "value": "Counts the occurrences of each element and returns a hash.\n\n```ruby\n['a', 'b', 'a', 'c', 'b', 'a'].tally\n# => { \"a\" => 3, \"b\" => 2, \"c\" => 1 }\n```" },
996
+ "insertText": ".tally",
997
+ "sortText": "04_tally"
998
+ },
999
+ {
1000
+ "label": ".intersection",
1001
+ "kind": 2,
1002
+ "detail": "Array intersection",
1003
+ "documentation": { "value": "Returns a new array containing elements common to all arrays.\n\n```ruby\n[1, 2, 3].intersection([2, 3, 4]) # => [2, 3]\n```" },
1004
+ "insertText": ".intersection(${1:other})",
1005
+ "insertTextRules": 4,
1006
+ "sortText": "04_intersection"
1007
+ },
1008
+ {
1009
+ "label": ".union",
1010
+ "kind": 2,
1011
+ "detail": "Array union",
1012
+ "documentation": { "value": "Returns a new array with elements from both arrays, removing duplicates.\n\n```ruby\n[1, 2, 3].union([3, 4, 5]) # => [1, 2, 3, 4, 5]\n```" },
1013
+ "insertText": ".union(${1:other})",
1014
+ "insertTextRules": 4,
1015
+ "sortText": "04_union"
1016
+ },
1017
+ {
1018
+ "label": ".difference",
1019
+ "kind": 2,
1020
+ "detail": "Array difference",
1021
+ "documentation": { "value": "Returns a new array containing elements not found in the other array(s).\n\n```ruby\n[1, 2, 3, 4].difference([2, 4]) # => [1, 3]\n```" },
1022
+ "insertText": ".difference(${1:other})",
1023
+ "insertTextRules": 4,
1024
+ "sortText": "04_difference"
1025
+ },
1026
+ {
1027
+ "label": ".sample",
1028
+ "kind": 2,
1029
+ "detail": "Random element(s)",
1030
+ "documentation": { "value": "Returns a random element, or `n` random elements.\n\n```ruby\n[1, 2, 3].sample # => 2 (random)\n[1, 2, 3].sample(2) # => [3, 1] (random)\n```" },
1031
+ "insertText": ".sample",
1032
+ "sortText": "04_sample"
1033
+ },
1034
+ {
1035
+ "label": ".shuffle",
1036
+ "kind": 2,
1037
+ "detail": "Randomly reorder elements",
1038
+ "documentation": { "value": "Returns a new array with elements in random order.\n\n```ruby\n[1, 2, 3, 4, 5].shuffle # => [3, 5, 1, 4, 2]\n```" },
1039
+ "insertText": ".shuffle",
1040
+ "sortText": "04_shuffle"
1041
+ },
1042
+ {
1043
+ "label": ".rotate",
1044
+ "kind": 2,
1045
+ "detail": "Rotate array elements",
1046
+ "documentation": { "value": "Returns a new array rotated by the given count.\n\n```ruby\n[1, 2, 3, 4].rotate # => [2, 3, 4, 1]\n[1, 2, 3, 4].rotate(2) # => [3, 4, 1, 2]\n```" },
1047
+ "insertText": ".rotate(${1:count})",
1048
+ "insertTextRules": 4,
1049
+ "sortText": "04_rotate"
1050
+ },
1051
+ {
1052
+ "label": ".combination",
1053
+ "kind": 2,
1054
+ "detail": "Generate combinations",
1055
+ "documentation": { "value": "Yields all combinations of length `n` from the array.\n\n```ruby\n[1, 2, 3].combination(2).to_a\n# => [[1, 2], [1, 3], [2, 3]]\n```" },
1056
+ "insertText": ".combination(${1:n})",
1057
+ "insertTextRules": 4,
1058
+ "sortText": "04_combination"
1059
+ },
1060
+ {
1061
+ "label": ".permutation",
1062
+ "kind": 2,
1063
+ "detail": "Generate permutations",
1064
+ "documentation": { "value": "Yields all permutations of length `n` from the array.\n\n```ruby\n[1, 2, 3].permutation(2).to_a\n# => [[1, 2], [1, 3], [2, 1], [2, 3], [3, 1], [3, 2]]\n```" },
1065
+ "insertText": ".permutation(${1:n})",
1066
+ "insertTextRules": 4,
1067
+ "sortText": "04_permutation"
1068
+ },
1069
+ {
1070
+ "label": ".take",
1071
+ "kind": 2,
1072
+ "detail": "Take first n elements",
1073
+ "documentation": { "value": "Returns the first `n` elements of the array.\n\n```ruby\n[1, 2, 3, 4, 5].take(3) # => [1, 2, 3]\n```" },
1074
+ "insertText": ".take(${1:n})",
1075
+ "insertTextRules": 4,
1076
+ "sortText": "04_take"
1077
+ },
1078
+ {
1079
+ "label": ".drop",
1080
+ "kind": 2,
1081
+ "detail": "Drop first n elements",
1082
+ "documentation": { "value": "Returns the array after dropping the first `n` elements.\n\n```ruby\n[1, 2, 3, 4, 5].drop(2) # => [3, 4, 5]\n```" },
1083
+ "insertText": ".drop(${1:n})",
1084
+ "insertTextRules": 4,
1085
+ "sortText": "04_drop"
1086
+ },
1087
+ {
1088
+ "label": ".slice",
1089
+ "kind": 2,
1090
+ "detail": "Extract sub-array",
1091
+ "documentation": { "value": "Returns a sub-array starting at the given index for the given length.\n\n```ruby\n[1, 2, 3, 4, 5].slice(1, 3) # => [2, 3, 4]\n```" },
1092
+ "insertText": ".slice(${1:start}, ${2:length})",
1093
+ "insertTextRules": 4,
1094
+ "sortText": "04_slice"
1095
+ },
1096
+ {
1097
+ "label": ".dig",
1098
+ "kind": 2,
1099
+ "detail": "Safely access nested values",
1100
+ "documentation": { "value": "Extracts the nested value specified by the sequence of indices/keys. Returns `nil` if any intermediate step is `nil`.\n\n```ruby\ndata = { a: { b: [1, 2, 3] } }\ndata.dig(:a, :b, 1) # => 2\n```" },
1101
+ "insertText": ".dig(${1:keys})",
1102
+ "insertTextRules": 4,
1103
+ "sortText": "04_dig"
1104
+ },
1105
+ {
1106
+ "label": ".join",
1107
+ "kind": 2,
1108
+ "detail": "Join array elements into string",
1109
+ "documentation": { "value": "Converts each element to a string and joins them with the given separator.\n\n```ruby\n['a', 'b', 'c'].join(', ') # => \"a, b, c\"\n[1, 2, 3].join('-') # => \"1-2-3\"\n```" },
1110
+ "insertText": ".join('${1:separator}')",
1111
+ "insertTextRules": 4,
1112
+ "sortText": "04_join"
1113
+ },
1114
+ {
1115
+ "label": ".keys",
1116
+ "kind": 2,
1117
+ "detail": "Get hash keys",
1118
+ "documentation": { "value": "Returns an array of all keys in the hash.\n\n```ruby\n{ a: 1, b: 2 }.keys # => [:a, :b]\n```" },
1119
+ "insertText": ".keys",
1120
+ "sortText": "05_keys"
1121
+ },
1122
+ {
1123
+ "label": ".values",
1124
+ "kind": 2,
1125
+ "detail": "Get hash values",
1126
+ "documentation": { "value": "Returns an array of all values in the hash.\n\n```ruby\n{ a: 1, b: 2 }.values # => [1, 2]\n```" },
1127
+ "insertText": ".values",
1128
+ "sortText": "05_values"
1129
+ },
1130
+ {
1131
+ "label": ".merge",
1132
+ "kind": 2,
1133
+ "detail": "Merge hashes",
1134
+ "documentation": { "value": "Returns a new hash containing the contents of self and the other hash. Duplicate keys use values from the other hash.\n\n```ruby\n{ a: 1 }.merge({ b: 2 }) # => { a: 1, b: 2 }\n{ a: 1 }.merge({ a: 2 }) # => { a: 2 }\n{ a: 1 }.merge({ a: 2 }) { |k, v1, v2| v1 + v2 } # => { a: 3 }\n```" },
1135
+ "insertText": ".merge(${1:other_hash})",
1136
+ "insertTextRules": 4,
1137
+ "sortText": "05_merge"
1138
+ },
1139
+ {
1140
+ "label": ".merge!",
1141
+ "kind": 2,
1142
+ "detail": "Merge hashes in place",
1143
+ "documentation": { "value": "Merges the other hash into self, modifying self in place.\n\n```ruby\nh = { a: 1 }\nh.merge!({ b: 2 }) # h is now { a: 1, b: 2 }\n```" },
1144
+ "insertText": ".merge!(${1:other_hash})",
1145
+ "insertTextRules": 4,
1146
+ "sortText": "05_merge_bang"
1147
+ },
1148
+ {
1149
+ "label": ".fetch",
1150
+ "kind": 2,
1151
+ "detail": "Fetch hash value with default",
1152
+ "documentation": { "value": "Returns the value for the given key. Raises `KeyError` if key is missing and no default is given.\n\n```ruby\nh = { a: 1 }\nh.fetch(:a) # => 1\nh.fetch(:b, 'default') # => \"default\"\nh.fetch(:b) { |k| \"no #{k}\" } # => \"no b\"\n```" },
1153
+ "insertText": ".fetch(${1:key}, ${2:default})",
1154
+ "insertTextRules": 4,
1155
+ "sortText": "05_fetch"
1156
+ },
1157
+ {
1158
+ "label": ".has_key?",
1159
+ "kind": 2,
1160
+ "detail": "Check if hash has key",
1161
+ "documentation": { "value": "Returns `true` if the hash contains the given key.\n\n```ruby\n{ a: 1 }.has_key?(:a) # => true\n```" },
1162
+ "insertText": ".has_key?(${1:key})",
1163
+ "insertTextRules": 4,
1164
+ "sortText": "05_has_key"
1165
+ },
1166
+ {
1167
+ "label": ".has_value?",
1168
+ "kind": 2,
1169
+ "detail": "Check if hash has value",
1170
+ "documentation": { "value": "Returns `true` if the hash contains the given value.\n\n```ruby\n{ a: 1 }.has_value?(1) # => true\n```" },
1171
+ "insertText": ".has_value?(${1:value})",
1172
+ "insertTextRules": 4,
1173
+ "sortText": "05_has_value"
1174
+ },
1175
+ {
1176
+ "label": ".key?",
1177
+ "kind": 2,
1178
+ "detail": "Check key existence (alias)",
1179
+ "documentation": { "value": "Returns `true` if the hash contains the given key. Alias for `has_key?`.\n\n```ruby\n{ a: 1 }.key?(:a) # => true\n```" },
1180
+ "insertText": ".key?(${1:key})",
1181
+ "insertTextRules": 4,
1182
+ "sortText": "05_key"
1183
+ },
1184
+ {
1185
+ "label": ".value?",
1186
+ "kind": 2,
1187
+ "detail": "Check value existence (alias)",
1188
+ "documentation": { "value": "Returns `true` if the hash contains the given value. Alias for `has_value?`.\n\n```ruby\n{ a: 1 }.value?(1) # => true\n```" },
1189
+ "insertText": ".value?(${1:value})",
1190
+ "insertTextRules": 4,
1191
+ "sortText": "05_value"
1192
+ },
1193
+ {
1194
+ "label": ".delete",
1195
+ "kind": 2,
1196
+ "detail": "Delete key from hash",
1197
+ "documentation": { "value": "Removes the key-value pair and returns the value. Returns `nil` if key not found.\n\n```ruby\nh = { a: 1, b: 2 }\nh.delete(:a) # => 1, h is { b: 2 }\n```" },
1198
+ "insertText": ".delete(${1:key})",
1199
+ "insertTextRules": 4,
1200
+ "sortText": "05_delete"
1201
+ },
1202
+ {
1203
+ "label": ".delete_if",
1204
+ "kind": 2,
1205
+ "detail": "Delete elements by condition",
1206
+ "documentation": { "value": "Deletes every key-value pair for which the block returns truthy.\n\n```ruby\n{ a: 1, b: 2, c: 3 }.delete_if { |k, v| v > 1 }\n# => { a: 1 }\n```" },
1207
+ "insertText": ".delete_if { |${1:k}, ${2:v}| ${3:condition} }",
1208
+ "insertTextRules": 4,
1209
+ "sortText": "05_delete_if"
1210
+ },
1211
+ {
1212
+ "label": ".transform_keys",
1213
+ "kind": 2,
1214
+ "detail": "Transform hash keys",
1215
+ "documentation": { "value": "Returns a new hash with keys transformed by the block.\n\n```ruby\n{ a: 1, b: 2 }.transform_keys(&:to_s)\n# => { \"a\" => 1, \"b\" => 2 }\n```" },
1216
+ "insertText": ".transform_keys { |${1:k}| ${2:k} }",
1217
+ "insertTextRules": 4,
1218
+ "sortText": "05_transform_keys"
1219
+ },
1220
+ {
1221
+ "label": ".transform_values",
1222
+ "kind": 2,
1223
+ "detail": "Transform hash values",
1224
+ "documentation": { "value": "Returns a new hash with values transformed by the block.\n\n```ruby\n{ a: 1, b: 2 }.transform_values { |v| v * 2 }\n# => { a: 2, b: 4 }\n```" },
1225
+ "insertText": ".transform_values { |${1:v}| ${2:v} }",
1226
+ "insertTextRules": 4,
1227
+ "sortText": "05_transform_values"
1228
+ },
1229
+ {
1230
+ "label": ".to_a",
1231
+ "kind": 2,
1232
+ "detail": "Convert to array",
1233
+ "documentation": { "value": "Converts the object to an array.\n\n```ruby\n{ a: 1, b: 2 }.to_a # => [[:a, 1], [:b, 2]]\n(1..5).to_a # => [1, 2, 3, 4, 5]\n```" },
1234
+ "insertText": ".to_a",
1235
+ "sortText": "05_to_a"
1236
+ },
1237
+ {
1238
+ "label": ".invert",
1239
+ "kind": 2,
1240
+ "detail": "Swap hash keys and values",
1241
+ "documentation": { "value": "Returns a new hash with keys and values swapped.\n\n```ruby\n{ a: 1, b: 2 }.invert # => { 1 => :a, 2 => :b }\n```" },
1242
+ "insertText": ".invert",
1243
+ "sortText": "05_invert"
1244
+ },
1245
+ {
1246
+ "label": ".except",
1247
+ "kind": 2,
1248
+ "detail": "Hash without specified keys",
1249
+ "documentation": { "value": "Returns a new hash excluding the specified keys. Available in Ruby 3.0+.\n\n```ruby\n{ a: 1, b: 2, c: 3 }.except(:b) # => { a: 1, c: 3 }\n```" },
1250
+ "insertText": ".except(${1:keys})",
1251
+ "insertTextRules": 4,
1252
+ "sortText": "05_except"
1253
+ },
1254
+ {
1255
+ "label": ".take_while",
1256
+ "kind": 2,
1257
+ "detail": "Take while condition is true",
1258
+ "documentation": { "value": "Returns elements from the beginning while the block returns truthy.\n\n```ruby\n[1, 2, 3, 4, 5].take_while { |n| n < 4 } # => [1, 2, 3]\n```" },
1259
+ "insertText": ".take_while { |${1:el}| ${2:condition} }",
1260
+ "insertTextRules": 4,
1261
+ "sortText": "06_take_while"
1262
+ },
1263
+ {
1264
+ "label": ".drop_while",
1265
+ "kind": 2,
1266
+ "detail": "Drop while condition is true",
1267
+ "documentation": { "value": "Drops elements from the beginning while the block returns truthy, then returns the rest.\n\n```ruby\n[1, 2, 3, 4, 5].drop_while { |n| n < 3 } # => [3, 4, 5]\n```" },
1268
+ "insertText": ".drop_while { |${1:el}| ${2:condition} }",
1269
+ "insertTextRules": 4,
1270
+ "sortText": "06_drop_while"
1271
+ },
1272
+ {
1273
+ "label": ".lazy",
1274
+ "kind": 2,
1275
+ "detail": "Create lazy enumerator",
1276
+ "documentation": { "value": "Returns a lazy enumerator. Operations are deferred until values are needed.\n\n```ruby\n(1..Float::INFINITY).lazy.select(&:odd?).take(5).to_a\n# => [1, 3, 5, 7, 9]\n```" },
1277
+ "insertText": ".lazy",
1278
+ "sortText": "06_lazy"
1279
+ },
1280
+ {
1281
+ "label": ".filter_map",
1282
+ "kind": 2,
1283
+ "detail": "Filter and map in one step",
1284
+ "documentation": { "value": "Returns an array containing truthy results of running the block for every element.\n\n```ruby\n[1, 2, 3, 4, 5].filter_map { |n| n * 2 if n.odd? }\n# => [2, 6, 10]\n```" },
1285
+ "insertText": ".filter_map { |${1:el}| ${2:el} }",
1286
+ "insertTextRules": 4,
1287
+ "sortText": "06_filter_map"
1288
+ },
1289
+ {
1290
+ "label": "File.read",
1291
+ "kind": 1,
1292
+ "detail": "Read entire file contents",
1293
+ "documentation": { "value": "Opens the file, reads the entire contents, and closes it. Returns a string.\n\n```ruby\ncontent = File.read('config.yml')\n```" },
1294
+ "insertText": "File.read('${1:path}')",
1295
+ "insertTextRules": 4,
1296
+ "sortText": "07_file_read"
1297
+ },
1298
+ {
1299
+ "label": "File.write",
1300
+ "kind": 1,
1301
+ "detail": "Write string to file",
1302
+ "documentation": { "value": "Opens the file, writes the string, and closes it. Creates the file if it doesn't exist.\n\n```ruby\nFile.write('output.txt', content)\n```" },
1303
+ "insertText": "File.write('${1:path}', ${2:data})",
1304
+ "insertTextRules": 4,
1305
+ "sortText": "07_file_write"
1306
+ },
1307
+ {
1308
+ "label": "File.open",
1309
+ "kind": 1,
1310
+ "detail": "Open a file",
1311
+ "documentation": { "value": "Opens a file with the given mode. When given a block, closes the file automatically.\n\n```ruby\nFile.open('data.txt', 'r') do |f|\n f.each_line { |line| puts line }\nend\n```" },
1312
+ "insertText": "File.open('${1:path}', '${2:r}') do |${3:f}|\n ${4:# body}\nend",
1313
+ "insertTextRules": 4,
1314
+ "sortText": "07_file_open"
1315
+ },
1316
+ {
1317
+ "label": "File.exist?",
1318
+ "kind": 1,
1319
+ "detail": "Check if file exists",
1320
+ "documentation": { "value": "Returns `true` if the named file exists.\n\n```ruby\nFile.exist?('config.yml') # => true or false\n```" },
1321
+ "insertText": "File.exist?('${1:path}')",
1322
+ "insertTextRules": 4,
1323
+ "sortText": "07_file_exist"
1324
+ },
1325
+ {
1326
+ "label": "File.delete",
1327
+ "kind": 1,
1328
+ "detail": "Delete a file",
1329
+ "documentation": { "value": "Deletes the named file(s). Raises `Errno::ENOENT` if the file does not exist.\n\n```ruby\nFile.delete('temp.txt')\n```" },
1330
+ "insertText": "File.delete('${1:path}')",
1331
+ "insertTextRules": 4,
1332
+ "sortText": "07_file_delete"
1333
+ },
1334
+ {
1335
+ "label": "File.rename",
1336
+ "kind": 1,
1337
+ "detail": "Rename a file",
1338
+ "documentation": { "value": "Renames the file.\n\n```ruby\nFile.rename('old.txt', 'new.txt')\n```" },
1339
+ "insertText": "File.rename('${1:old_name}', '${2:new_name}')",
1340
+ "insertTextRules": 4,
1341
+ "sortText": "07_file_rename"
1342
+ },
1343
+ {
1344
+ "label": "File.join",
1345
+ "kind": 1,
1346
+ "detail": "Join path components",
1347
+ "documentation": { "value": "Joins path components with the platform file separator.\n\n```ruby\nFile.join('usr', 'local', 'bin') # => \"usr/local/bin\"\n```" },
1348
+ "insertText": "File.join(${1:paths})",
1349
+ "insertTextRules": 4,
1350
+ "sortText": "07_file_join"
1351
+ },
1352
+ {
1353
+ "label": "File.dirname",
1354
+ "kind": 1,
1355
+ "detail": "Get directory part of path",
1356
+ "documentation": { "value": "Returns the directory portion of the path.\n\n```ruby\nFile.dirname('/usr/local/bin/ruby') # => \"/usr/local/bin\"\n```" },
1357
+ "insertText": "File.dirname('${1:path}')",
1358
+ "insertTextRules": 4,
1359
+ "sortText": "07_file_dirname"
1360
+ },
1361
+ {
1362
+ "label": "File.basename",
1363
+ "kind": 1,
1364
+ "detail": "Get filename from path",
1365
+ "documentation": { "value": "Returns the last component of the filename.\n\n```ruby\nFile.basename('/usr/local/bin/ruby') # => \"ruby\"\nFile.basename('/usr/local/bin/ruby.rb', '.rb') # => \"ruby\"\n```" },
1366
+ "insertText": "File.basename('${1:path}')",
1367
+ "insertTextRules": 4,
1368
+ "sortText": "07_file_basename"
1369
+ },
1370
+ {
1371
+ "label": "File.extname",
1372
+ "kind": 1,
1373
+ "detail": "Get file extension",
1374
+ "documentation": { "value": "Returns the file extension including the dot.\n\n```ruby\nFile.extname('test.rb') # => \".rb\"\nFile.extname('Makefile') # => \"\"\n```" },
1375
+ "insertText": "File.extname('${1:path}')",
1376
+ "insertTextRules": 4,
1377
+ "sortText": "07_file_extname"
1378
+ },
1379
+ {
1380
+ "label": "Dir.glob",
1381
+ "kind": 1,
1382
+ "detail": "Find files by pattern",
1383
+ "documentation": { "value": "Returns filenames matching the given glob pattern.\n\n```ruby\nDir.glob('*.rb') # all .rb files\nDir.glob('**/*.rb') # recursive\nDir.glob('lib/**/*.rb')\n```" },
1384
+ "insertText": "Dir.glob('${1:pattern}')",
1385
+ "insertTextRules": 4,
1386
+ "sortText": "07_dir_glob"
1387
+ },
1388
+ {
1389
+ "label": "Dir.entries",
1390
+ "kind": 1,
1391
+ "detail": "List directory entries",
1392
+ "documentation": { "value": "Returns an array of filenames in the given directory, including `.` and `..`.\n\n```ruby\nDir.entries('.') # => [\".\", \"..\", \"file1.rb\", ...]\n```" },
1393
+ "insertText": "Dir.entries('${1:path}')",
1394
+ "insertTextRules": 4,
1395
+ "sortText": "07_dir_entries"
1396
+ },
1397
+ {
1398
+ "label": "IO.read",
1399
+ "kind": 1,
1400
+ "detail": "Read from IO",
1401
+ "documentation": { "value": "Opens the file and reads the entire content as a string.\n\n```ruby\ncontent = IO.read('file.txt')\n```" },
1402
+ "insertText": "IO.read('${1:path}')",
1403
+ "insertTextRules": 4,
1404
+ "sortText": "07_io_read"
1405
+ },
1406
+ {
1407
+ "label": "Integer()",
1408
+ "kind": 1,
1409
+ "detail": "Strict integer conversion",
1410
+ "documentation": { "value": "Converts the argument to an Integer. Raises `ArgumentError` on invalid input (unlike `to_i`).\n\n```ruby\nInteger('42') # => 42\nInteger('0xff', 16) # => 255\n```" },
1411
+ "insertText": "Integer(${1:value})",
1412
+ "insertTextRules": 4,
1413
+ "sortText": "08_integer"
1414
+ },
1415
+ {
1416
+ "label": "Float()",
1417
+ "kind": 1,
1418
+ "detail": "Strict float conversion",
1419
+ "documentation": { "value": "Converts the argument to a Float. Raises `ArgumentError` on invalid input.\n\n```ruby\nFloat('3.14') # => 3.14\n```" },
1420
+ "insertText": "Float(${1:value})",
1421
+ "insertTextRules": 4,
1422
+ "sortText": "08_float"
1423
+ },
1424
+ {
1425
+ "label": "String()",
1426
+ "kind": 1,
1427
+ "detail": "Convert to string",
1428
+ "documentation": { "value": "Converts the argument to a String by calling `to_s`.\n\n```ruby\nString(42) # => \"42\"\nString(nil) # => \"\"\n```" },
1429
+ "insertText": "String(${1:value})",
1430
+ "insertTextRules": 4,
1431
+ "sortText": "08_string"
1432
+ },
1433
+ {
1434
+ "label": "Array()",
1435
+ "kind": 1,
1436
+ "detail": "Convert to array",
1437
+ "documentation": { "value": "Converts the argument to an Array. Calls `to_ary` then `to_a`. Returns `[]` for `nil`.\n\n```ruby\nArray(nil) # => []\nArray([1, 2]) # => [1, 2]\nArray(1) # => [1]\n```" },
1438
+ "insertText": "Array(${1:value})",
1439
+ "insertTextRules": 4,
1440
+ "sortText": "08_array"
1441
+ },
1442
+ {
1443
+ "label": "Hash()",
1444
+ "kind": 1,
1445
+ "detail": "Convert to hash",
1446
+ "documentation": { "value": "Converts the argument to a Hash.\n\n```ruby\nHash(nil) # => {}\nHash(a: 1, b: 2) # => { a: 1, b: 2 }\n```" },
1447
+ "insertText": "Hash(${1:value})",
1448
+ "insertTextRules": 4,
1449
+ "sortText": "08_hash"
1450
+ },
1451
+ {
1452
+ "label": "loop",
1453
+ "kind": 1,
1454
+ "detail": "Infinite loop",
1455
+ "documentation": { "value": "Repeatedly executes the block. Break out with `break`.\n\n```ruby\nloop do\n input = gets.chomp\n break if input == 'quit'\n puts input\nend\n```" },
1456
+ "insertText": "loop do\n ${1:# body}\n break if ${2:condition}\nend",
1457
+ "insertTextRules": 4,
1458
+ "sortText": "08_loop"
1459
+ },
1460
+ {
1461
+ "label": "sleep",
1462
+ "kind": 1,
1463
+ "detail": "Pause execution",
1464
+ "documentation": { "value": "Suspends the current thread for the given number of seconds.\n\n```ruby\nsleep 1 # sleep 1 second\nsleep 0.5 # sleep 500ms\n```" },
1465
+ "insertText": "sleep ${1:seconds}",
1466
+ "insertTextRules": 4,
1467
+ "sortText": "08_sleep"
1468
+ },
1469
+ {
1470
+ "label": "rand",
1471
+ "kind": 1,
1472
+ "detail": "Generate random number",
1473
+ "documentation": { "value": "Returns a random number. Without argument, returns a float between 0.0 and 1.0. With an integer, returns 0..n-1.\n\n```ruby\nrand # => 0.5312...\nrand(10) # => 0..9\nrand(1..6) # => 1..6\n```" },
1474
+ "insertText": "rand(${1:max})",
1475
+ "insertTextRules": 4,
1476
+ "sortText": "08_rand"
1477
+ },
1478
+ {
1479
+ "label": "exit",
1480
+ "kind": 1,
1481
+ "detail": "Exit the program",
1482
+ "documentation": { "value": "Terminates the program with an optional exit status code.\n\n```ruby\nexit # exits with status 0\nexit(1) # exits with status 1\n```" },
1483
+ "insertText": "exit(${1:0})",
1484
+ "insertTextRules": 4,
1485
+ "sortText": "08_exit"
1486
+ },
1487
+ {
1488
+ "label": "abort",
1489
+ "kind": 1,
1490
+ "detail": "Abort with message",
1491
+ "documentation": { "value": "Terminates the program with an error message written to STDERR and exit status 1.\n\n```ruby\nabort 'Fatal error occurred'\n```" },
1492
+ "insertText": "abort '${1:message}'",
1493
+ "insertTextRules": 4,
1494
+ "sortText": "08_abort"
1495
+ },
1496
+ {
1497
+ "label": "system",
1498
+ "kind": 1,
1499
+ "detail": "Execute shell command",
1500
+ "documentation": { "value": "Executes the given command in a subshell. Returns `true` on success, `false` on failure, `nil` if command not found.\n\n```ruby\nsystem('ls -la')\nsystem('echo', 'hello')\n```" },
1501
+ "insertText": "system('${1:command}')",
1502
+ "insertTextRules": 4,
1503
+ "sortText": "08_system"
1504
+ },
1505
+ {
1506
+ "label": "exec",
1507
+ "kind": 1,
1508
+ "detail": "Replace process with command",
1509
+ "documentation": { "value": "Replaces the current process with the given external command. Never returns on success.\n\n```ruby\nexec('ls', '-la')\n```" },
1510
+ "insertText": "exec('${1:command}')",
1511
+ "insertTextRules": 4,
1512
+ "sortText": "08_exec"
1513
+ },
1514
+ {
1515
+ "label": "gets",
1516
+ "kind": 1,
1517
+ "detail": "Read line from stdin",
1518
+ "documentation": { "value": "Reads a line from STDIN. Returns `nil` at end of input.\n\n```ruby\ninput = gets\ninput = gets.chomp # remove trailing newline\n```" },
1519
+ "insertText": "gets",
1520
+ "sortText": "08_gets"
1521
+ },
1522
+ {
1523
+ "label": "chomp",
1524
+ "kind": 1,
1525
+ "detail": "Remove trailing newline from input",
1526
+ "documentation": { "value": "Commonly chained with `gets` to remove the trailing newline from user input.\n\n```ruby\nname = gets.chomp\n```" },
1527
+ "insertText": "gets.chomp",
1528
+ "sortText": "08_chomp"
1529
+ }
1530
+ ]
1531
+ }