neovim 0.7.1 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/docs.yml +39 -0
  3. data/.github/workflows/tests.yml +64 -0
  4. data/.gitignore +2 -0
  5. data/CHANGELOG.md +22 -0
  6. data/CODE_OF_CONDUCT.md +3 -3
  7. data/README.md +19 -20
  8. data/Rakefile +21 -11
  9. data/exe/neovim-ruby-host +5 -0
  10. data/lib/neovim/buffer.rb +120 -41
  11. data/lib/neovim/client.rb +304 -39
  12. data/lib/neovim/client_info.rb +46 -0
  13. data/lib/neovim/connection.rb +7 -2
  14. data/lib/neovim/event_loop.rb +8 -4
  15. data/lib/neovim/host/cli.rb +41 -0
  16. data/lib/neovim/host.rb +3 -0
  17. data/lib/neovim/logging.rb +1 -1
  18. data/lib/neovim/message.rb +1 -1
  19. data/lib/neovim/plugin/dsl.rb +6 -0
  20. data/lib/neovim/plugin.rb +7 -2
  21. data/lib/neovim/remote_object.rb +5 -2
  22. data/lib/neovim/ruby_provider/object_ext.rb +5 -0
  23. data/lib/neovim/ruby_provider/vim.rb +6 -5
  24. data/lib/neovim/ruby_provider.rb +29 -10
  25. data/lib/neovim/session.rb +21 -16
  26. data/lib/neovim/tabpage.rb +8 -15
  27. data/lib/neovim/version.rb +1 -1
  28. data/lib/neovim/window.rb +45 -33
  29. data/lib/neovim.rb +12 -3
  30. data/neovim.gemspec +4 -5
  31. data/script/ci/download_nvim.sh +40 -0
  32. data/script/dump_api.rb +1 -1
  33. data/script/generate_docs.rb +6 -7
  34. data/script/run_acceptance.rb +15 -11
  35. data/spec/acceptance/client_info_spec.vim +42 -0
  36. data/spec/acceptance/rplugin_command_spec.vim +2 -2
  37. data/spec/acceptance/ruby_spec.vim +18 -11
  38. data/spec/acceptance/rubydo_spec.vim +9 -0
  39. data/spec/acceptance/rubyeval_spec.vim +22 -0
  40. data/spec/acceptance/rubyfile/curbuf_ivar_get.rb +1 -1
  41. data/spec/acceptance/rubyfile/curbuf_ivar_set.rb +1 -1
  42. data/spec/acceptance/rubyfile/define_foo.rb +1 -1
  43. data/spec/acceptance/rubyfile/nested_inner.rb +1 -1
  44. data/spec/acceptance/rubyfile/set_pwd_after.rb +1 -1
  45. data/spec/acceptance/rubyfile/set_pwd_before.rb +1 -1
  46. data/spec/acceptance/rubyfile_spec.vim +19 -19
  47. data/spec/acceptance/runtime/init.vim +2 -2
  48. data/spec/acceptance/runtime/rplugin/ruby/commands.rb +2 -2
  49. data/spec/helper.rb +25 -7
  50. data/spec/neovim/api_spec.rb +1 -1
  51. data/spec/neovim/buffer_spec.rb +10 -6
  52. data/spec/neovim/client_info_spec.rb +77 -0
  53. data/spec/neovim/client_spec.rb +9 -2
  54. data/spec/neovim/connection_spec.rb +32 -4
  55. data/spec/neovim/current_spec.rb +1 -2
  56. data/spec/neovim/event_loop_spec.rb +16 -0
  57. data/spec/neovim/host/cli_spec.rb +94 -0
  58. data/spec/neovim/host_spec.rb +16 -14
  59. data/spec/neovim/line_range_spec.rb +1 -3
  60. data/spec/neovim/remote_object_spec.rb +1 -2
  61. data/spec/neovim/ruby_provider/buffer_ext_spec.rb +6 -7
  62. data/spec/neovim/ruby_provider/object_ext_spec.rb +10 -0
  63. data/spec/neovim/ruby_provider/vim_spec.rb +1 -1
  64. data/spec/neovim/ruby_provider/window_ext_spec.rb +7 -10
  65. data/spec/neovim/session_spec.rb +13 -40
  66. data/spec/neovim/window_spec.rb +1 -1
  67. data/spec/neovim_spec.rb +28 -51
  68. data/spec/support.rb +27 -1
  69. metadata +26 -44
  70. data/.coveralls.yml +0 -1
  71. data/.rubocop.yml +0 -118
  72. data/.travis.yml +0 -22
  73. data/appveyor.yml +0 -31
  74. data/bin/neovim-ruby-host +0 -18
  75. data/script/validate_docs.rb +0 -29
data/lib/neovim/client.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require "neovim/api"
2
2
  require "neovim/current"
3
3
  require "neovim/session"
4
+ require "set"
4
5
 
5
6
  module Neovim
6
7
  # Client to a running +nvim+ instance. The interface is generated at
@@ -8,7 +9,7 @@ module Neovim
8
9
  # +RemoteObject+ subclasses (i.e. +Buffer+, +Window+, or +Tabpage+),
9
10
  # which similarly have dynamically generated interfaces.
10
11
  #
11
- # The methods documented here were generated using NVIM v0.2.2
12
+ # The methods documented here were generated using NVIM v0.5.0
12
13
  #
13
14
  # @see Buffer
14
15
  # @see Window
@@ -28,6 +29,10 @@ module Neovim
28
29
  @api = api
29
30
  end
30
31
 
32
+ def channel_id
33
+ @api.channel_id
34
+ end
35
+
31
36
  # Intercept method calls and delegate to appropriate RPC methods.
32
37
  def method_missing(method_name, *args)
33
38
  if (func = @api.function_for_object_method(self, method_name))
@@ -44,7 +49,7 @@ module Neovim
44
49
 
45
50
  # Extend +methods+ to include RPC methods.
46
51
  def methods(*args)
47
- super | rpc_methods
52
+ super | rpc_methods.to_a
48
53
  end
49
54
 
50
55
  # Access to objects belonging to the current +nvim+ context.
@@ -104,15 +109,28 @@ module Neovim
104
109
  private
105
110
 
106
111
  def rpc_methods
107
- @api.functions_for_object(self).map(&:method_name)
112
+ @rpc_methods ||=
113
+ @api.functions_for_object(self).map(&:method_name).to_set
108
114
  end
109
115
 
110
116
  public
111
117
 
112
118
  # The following methods are dynamically generated.
113
119
  =begin
114
- @method ui_attach(height, options)
120
+ @method command_output(command)
121
+ See +:h nvim_command_output()+
122
+ @param [String] command
123
+ @return [String]
124
+
125
+ @method execute_lua(code, args)
126
+ See +:h nvim_execute_lua()+
127
+ @param [String] code
128
+ @param [Array] args
129
+ @return [Object]
130
+
131
+ @method ui_attach(width, height, options)
115
132
  See +:h nvim_ui_attach()+
133
+ @param [Integer] width
116
134
  @param [Integer] height
117
135
  @param [Hash] options
118
136
  @return [void]
@@ -121,120 +139,228 @@ module Neovim
121
139
  See +:h nvim_ui_detach()+
122
140
  @return [void]
123
141
 
124
- @method ui_try_resize(height)
142
+ @method ui_try_resize(width, height)
125
143
  See +:h nvim_ui_try_resize()+
144
+ @param [Integer] width
126
145
  @param [Integer] height
127
146
  @return [void]
128
147
 
129
- @method ui_set_option(value)
148
+ @method ui_set_option(name, value)
130
149
  See +:h nvim_ui_set_option()+
150
+ @param [String] name
131
151
  @param [Object] value
132
152
  @return [void]
133
153
 
134
- @method command
154
+ @method ui_try_resize_grid(grid, width, height)
155
+ See +:h nvim_ui_try_resize_grid()+
156
+ @param [Integer] grid
157
+ @param [Integer] width
158
+ @param [Integer] height
159
+ @return [void]
160
+
161
+ @method ui_pum_set_height(height)
162
+ See +:h nvim_ui_pum_set_height()+
163
+ @param [Integer] height
164
+ @return [void]
165
+
166
+ @method ui_pum_set_bounds(width, height, row, col)
167
+ See +:h nvim_ui_pum_set_bounds()+
168
+ @param [Float] width
169
+ @param [Float] height
170
+ @param [Float] row
171
+ @param [Float] col
172
+ @return [void]
173
+
174
+ @method exec(src, output)
175
+ See +:h nvim_exec()+
176
+ @param [String] src
177
+ @param [Boolean] output
178
+ @return [String]
179
+
180
+ @method command(command)
135
181
  See +:h nvim_command()+
182
+ @param [String] command
136
183
  @return [void]
137
184
 
138
- @method get_hl_by_name(rgb)
185
+ @method get_hl_by_name(name, rgb)
139
186
  See +:h nvim_get_hl_by_name()+
187
+ @param [String] name
140
188
  @param [Boolean] rgb
141
189
  @return [Hash]
142
190
 
143
- @method get_hl_by_id(rgb)
191
+ @method get_hl_by_id(hl_id, rgb)
144
192
  See +:h nvim_get_hl_by_id()+
193
+ @param [Integer] hl_id
145
194
  @param [Boolean] rgb
146
195
  @return [Hash]
147
196
 
148
- @method feedkeys(mode, escape_csi)
197
+ @method get_hl_id_by_name(name)
198
+ See +:h nvim_get_hl_id_by_name()+
199
+ @param [String] name
200
+ @return [Integer]
201
+
202
+ @method set_hl(ns_id, name, val)
203
+ See +:h nvim_set_hl()+
204
+ @param [Integer] ns_id
205
+ @param [String] name
206
+ @param [Hash] val
207
+ @return [void]
208
+
209
+ @method feedkeys(keys, mode, escape_csi)
149
210
  See +:h nvim_feedkeys()+
211
+ @param [String] keys
150
212
  @param [String] mode
151
213
  @param [Boolean] escape_csi
152
214
  @return [void]
153
215
 
154
- @method input
216
+ @method input(keys)
155
217
  See +:h nvim_input()+
218
+ @param [String] keys
156
219
  @return [Integer]
157
220
 
158
- @method replace_termcodes(from_part, do_lt, special)
221
+ @method input_mouse(button, action, modifier, grid, row, col)
222
+ See +:h nvim_input_mouse()+
223
+ @param [String] button
224
+ @param [String] action
225
+ @param [String] modifier
226
+ @param [Integer] grid
227
+ @param [Integer] row
228
+ @param [Integer] col
229
+ @return [void]
230
+
231
+ @method replace_termcodes(str, from_part, do_lt, special)
159
232
  See +:h nvim_replace_termcodes()+
233
+ @param [String] str
160
234
  @param [Boolean] from_part
161
235
  @param [Boolean] do_lt
162
236
  @param [Boolean] special
163
237
  @return [String]
164
238
 
165
- @method command_output
166
- See +:h nvim_command_output()+
167
- @return [String]
168
-
169
- @method eval
239
+ @method eval(expr)
170
240
  See +:h nvim_eval()+
241
+ @param [String] expr
171
242
  @return [Object]
172
243
 
173
- @method call_function(args)
244
+ @method exec_lua(code, args)
245
+ See +:h nvim_exec_lua()+
246
+ @param [String] code
247
+ @param [Array] args
248
+ @return [Object]
249
+
250
+ @method notify(msg, log_level, opts)
251
+ See +:h nvim_notify()+
252
+ @param [String] msg
253
+ @param [Integer] log_level
254
+ @param [Hash] opts
255
+ @return [Object]
256
+
257
+ @method call_function(fn, args)
174
258
  See +:h nvim_call_function()+
259
+ @param [String] fn
175
260
  @param [Array] args
176
261
  @return [Object]
177
262
 
178
- @method execute_lua(args)
179
- See +:h nvim_execute_lua()+
263
+ @method call_dict_function(dict, fn, args)
264
+ See +:h nvim_call_dict_function()+
265
+ @param [Object] dict
266
+ @param [String] fn
180
267
  @param [Array] args
181
268
  @return [Object]
182
269
 
183
- @method strwidth
270
+ @method strwidth(text)
184
271
  See +:h nvim_strwidth()+
272
+ @param [String] text
185
273
  @return [Integer]
186
274
 
187
275
  @method list_runtime_paths
188
276
  See +:h nvim_list_runtime_paths()+
189
277
  @return [Array<String>]
190
278
 
191
- @method set_current_dir
279
+ @method get_runtime_file(name, all)
280
+ See +:h nvim_get_runtime_file()+
281
+ @param [String] name
282
+ @param [Boolean] all
283
+ @return [Array<String>]
284
+
285
+ @method set_current_dir(dir)
192
286
  See +:h nvim_set_current_dir()+
287
+ @param [String] dir
193
288
  @return [void]
194
289
 
195
290
  @method get_current_line
196
291
  See +:h nvim_get_current_line()+
197
292
  @return [String]
198
293
 
199
- @method set_current_line
294
+ @method set_current_line(line)
200
295
  See +:h nvim_set_current_line()+
296
+ @param [String] line
201
297
  @return [void]
202
298
 
203
299
  @method del_current_line
204
300
  See +:h nvim_del_current_line()+
205
301
  @return [void]
206
302
 
207
- @method get_var
303
+ @method get_var(name)
208
304
  See +:h nvim_get_var()+
305
+ @param [String] name
209
306
  @return [Object]
210
307
 
211
- @method set_var(value)
308
+ @method set_var(name, value)
212
309
  See +:h nvim_set_var()+
310
+ @param [String] name
213
311
  @param [Object] value
214
312
  @return [void]
215
313
 
216
- @method del_var
314
+ @method del_var(name)
217
315
  See +:h nvim_del_var()+
316
+ @param [String] name
218
317
  @return [void]
219
318
 
220
- @method get_vvar
319
+ @method get_vvar(name)
221
320
  See +:h nvim_get_vvar()+
321
+ @param [String] name
222
322
  @return [Object]
223
323
 
224
- @method get_option
324
+ @method set_vvar(name, value)
325
+ See +:h nvim_set_vvar()+
326
+ @param [String] name
327
+ @param [Object] value
328
+ @return [void]
329
+
330
+ @method get_option(name)
225
331
  See +:h nvim_get_option()+
332
+ @param [String] name
226
333
  @return [Object]
227
334
 
228
- @method out_write
335
+ @method get_all_options_info
336
+ See +:h nvim_get_all_options_info()+
337
+ @return [Hash]
338
+
339
+ @method get_option_info(name)
340
+ See +:h nvim_get_option_info()+
341
+ @param [String] name
342
+ @return [Hash]
343
+
344
+ @method echo(chunks, history, opts)
345
+ See +:h nvim_echo()+
346
+ @param [Array] chunks
347
+ @param [Boolean] history
348
+ @param [Hash] opts
349
+ @return [void]
350
+
351
+ @method out_write(str)
229
352
  See +:h nvim_out_write()+
353
+ @param [String] str
230
354
  @return [void]
231
355
 
232
- @method err_write
356
+ @method err_write(str)
233
357
  See +:h nvim_err_write()+
358
+ @param [String] str
234
359
  @return [void]
235
360
 
236
- @method err_writeln
361
+ @method err_writeln(str)
237
362
  See +:h nvim_err_writeln()+
363
+ @param [String] str
238
364
  @return [void]
239
365
 
240
366
  @method list_bufs
@@ -245,8 +371,9 @@ module Neovim
245
371
  See +:h nvim_get_current_buf()+
246
372
  @return [Buffer]
247
373
 
248
- @method set_current_buf
374
+ @method set_current_buf(buffer)
249
375
  See +:h nvim_set_current_buf()+
376
+ @param [Buffer] buffer
250
377
  @return [void]
251
378
 
252
379
  @method list_wins
@@ -257,10 +384,36 @@ module Neovim
257
384
  See +:h nvim_get_current_win()+
258
385
  @return [Window]
259
386
 
260
- @method set_current_win
387
+ @method set_current_win(window)
261
388
  See +:h nvim_set_current_win()+
389
+ @param [Window] window
262
390
  @return [void]
263
391
 
392
+ @method create_buf(listed, scratch)
393
+ See +:h nvim_create_buf()+
394
+ @param [Boolean] listed
395
+ @param [Boolean] scratch
396
+ @return [Buffer]
397
+
398
+ @method open_term(buffer, opts)
399
+ See +:h nvim_open_term()+
400
+ @param [Buffer] buffer
401
+ @param [Hash] opts
402
+ @return [Integer]
403
+
404
+ @method chan_send(chan, data)
405
+ See +:h nvim_chan_send()+
406
+ @param [Integer] chan
407
+ @param [String] data
408
+ @return [void]
409
+
410
+ @method open_win(buffer, enter, config)
411
+ See +:h nvim_open_win()+
412
+ @param [Buffer] buffer
413
+ @param [Boolean] enter
414
+ @param [Hash] config
415
+ @return [Window]
416
+
264
417
  @method list_tabpages
265
418
  See +:h nvim_list_tabpages()+
266
419
  @return [Array<Tabpage>]
@@ -269,42 +422,154 @@ module Neovim
269
422
  See +:h nvim_get_current_tabpage()+
270
423
  @return [Tabpage]
271
424
 
272
- @method set_current_tabpage
425
+ @method set_current_tabpage(tabpage)
273
426
  See +:h nvim_set_current_tabpage()+
427
+ @param [Tabpage] tabpage
274
428
  @return [void]
275
429
 
276
- @method subscribe
430
+ @method create_namespace(name)
431
+ See +:h nvim_create_namespace()+
432
+ @param [String] name
433
+ @return [Integer]
434
+
435
+ @method get_namespaces
436
+ See +:h nvim_get_namespaces()+
437
+ @return [Hash]
438
+
439
+ @method paste(data, crlf, phase)
440
+ See +:h nvim_paste()+
441
+ @param [String] data
442
+ @param [Boolean] crlf
443
+ @param [Integer] phase
444
+ @return [Boolean]
445
+
446
+ @method put(lines, type, after, follow)
447
+ See +:h nvim_put()+
448
+ @param [Array<String>] lines
449
+ @param [String] type
450
+ @param [Boolean] after
451
+ @param [Boolean] follow
452
+ @return [void]
453
+
454
+ @method subscribe(event)
277
455
  See +:h nvim_subscribe()+
456
+ @param [String] event
278
457
  @return [void]
279
458
 
280
- @method unsubscribe
459
+ @method unsubscribe(event)
281
460
  See +:h nvim_unsubscribe()+
461
+ @param [String] event
282
462
  @return [void]
283
463
 
284
- @method get_color_by_name
464
+ @method get_color_by_name(name)
285
465
  See +:h nvim_get_color_by_name()+
466
+ @param [String] name
286
467
  @return [Integer]
287
468
 
288
469
  @method get_color_map
289
470
  See +:h nvim_get_color_map()+
290
471
  @return [Hash]
291
472
 
473
+ @method get_context(opts)
474
+ See +:h nvim_get_context()+
475
+ @param [Hash] opts
476
+ @return [Hash]
477
+
478
+ @method load_context(dict)
479
+ See +:h nvim_load_context()+
480
+ @param [Hash] dict
481
+ @return [Object]
482
+
292
483
  @method get_mode
293
484
  See +:h nvim_get_mode()+
294
485
  @return [Hash]
295
486
 
296
- @method get_keymap
487
+ @method get_keymap(mode)
297
488
  See +:h nvim_get_keymap()+
489
+ @param [String] mode
298
490
  @return [Array<Hash>]
299
491
 
492
+ @method set_keymap(mode, lhs, rhs, opts)
493
+ See +:h nvim_set_keymap()+
494
+ @param [String] mode
495
+ @param [String] lhs
496
+ @param [String] rhs
497
+ @param [Hash] opts
498
+ @return [void]
499
+
500
+ @method del_keymap(mode, lhs)
501
+ See +:h nvim_del_keymap()+
502
+ @param [String] mode
503
+ @param [String] lhs
504
+ @return [void]
505
+
506
+ @method get_commands(opts)
507
+ See +:h nvim_get_commands()+
508
+ @param [Hash] opts
509
+ @return [Hash]
510
+
300
511
  @method get_api_info
301
512
  See +:h nvim_get_api_info()+
302
513
  @return [Array]
303
514
 
304
- @method call_atomic
515
+ @method set_client_info(name, version, type, methods, attributes)
516
+ See +:h nvim_set_client_info()+
517
+ @param [String] name
518
+ @param [Hash] version
519
+ @param [String] type
520
+ @param [Hash] methods
521
+ @param [Hash] attributes
522
+ @return [void]
523
+
524
+ @method get_chan_info(chan)
525
+ See +:h nvim_get_chan_info()+
526
+ @param [Integer] chan
527
+ @return [Hash]
528
+
529
+ @method list_chans
530
+ See +:h nvim_list_chans()+
531
+ @return [Array]
532
+
533
+ @method call_atomic(calls)
305
534
  See +:h nvim_call_atomic()+
535
+ @param [Array] calls
536
+ @return [Array]
537
+
538
+ @method parse_expression(expr, flags, highlight)
539
+ See +:h nvim_parse_expression()+
540
+ @param [String] expr
541
+ @param [String] flags
542
+ @param [Boolean] highlight
543
+ @return [Hash]
544
+
545
+ @method list_uis
546
+ See +:h nvim_list_uis()+
306
547
  @return [Array]
307
548
 
549
+ @method get_proc_children(pid)
550
+ See +:h nvim_get_proc_children()+
551
+ @param [Integer] pid
552
+ @return [Array]
553
+
554
+ @method get_proc(pid)
555
+ See +:h nvim_get_proc()+
556
+ @param [Integer] pid
557
+ @return [Object]
558
+
559
+ @method select_popupmenu_item(item, insert, finish, opts)
560
+ See +:h nvim_select_popupmenu_item()+
561
+ @param [Integer] item
562
+ @param [Boolean] insert
563
+ @param [Boolean] finish
564
+ @param [Hash] opts
565
+ @return [void]
566
+
567
+ @method set_decoration_provider(ns_id, opts)
568
+ See +:h nvim_set_decoration_provider()+
569
+ @param [Integer] ns_id
570
+ @param [Hash] opts
571
+ @return [void]
572
+
308
573
  =end
309
574
  end
310
575
  end