neovim 0.7.0 → 0.7.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 (73) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +3 -1
  3. data/.rubocop.yml +118 -0
  4. data/.travis.yml +1 -1
  5. data/CHANGELOG.md +5 -0
  6. data/Rakefile +29 -16
  7. data/VimFlavor +1 -0
  8. data/appveyor.yml +2 -0
  9. data/lib/neovim/api.rb +2 -1
  10. data/lib/neovim/buffer.rb +7 -15
  11. data/lib/neovim/client.rb +3 -3
  12. data/lib/neovim/connection.rb +6 -7
  13. data/lib/neovim/event_loop.rb +3 -3
  14. data/lib/neovim/executable.rb +1 -0
  15. data/lib/neovim/host.rb +12 -12
  16. data/lib/neovim/line_range.rb +16 -16
  17. data/lib/neovim/logging.rb +14 -14
  18. data/lib/neovim/message.rb +7 -7
  19. data/lib/neovim/plugin/dsl.rb +4 -4
  20. data/lib/neovim/plugin/handler.rb +3 -3
  21. data/lib/neovim/remote_object.rb +3 -3
  22. data/lib/neovim/ruby_provider.rb +11 -15
  23. data/lib/neovim/ruby_provider/buffer_ext.rb +1 -0
  24. data/lib/neovim/ruby_provider/vim.rb +14 -2
  25. data/lib/neovim/ruby_provider/window_ext.rb +1 -0
  26. data/lib/neovim/session.rb +7 -10
  27. data/lib/neovim/version.rb +1 -1
  28. data/lib/neovim/window.rb +3 -3
  29. data/neovim.gemspec +5 -4
  30. data/script/{dump_api → dump_api.rb} +0 -0
  31. data/script/{generate_docs → generate_docs.rb} +0 -0
  32. data/script/{j2mp → j2mp.rb} +0 -0
  33. data/script/{mp2j → mp2j.rb} +0 -0
  34. data/script/run_acceptance.rb +35 -0
  35. data/script/validate_docs.rb +29 -0
  36. data/spec/acceptance/rplugin_autocmd_spec.vim +20 -10
  37. data/spec/acceptance/rplugin_command_spec.vim +54 -56
  38. data/spec/acceptance/rplugin_function_spec.vim +28 -22
  39. data/spec/acceptance/ruby_spec.vim +40 -48
  40. data/spec/acceptance/rubydo_spec.vim +40 -52
  41. data/spec/acceptance/rubyfile/nested.rb +1 -1
  42. data/spec/acceptance/rubyfile_spec.vim +57 -63
  43. data/spec/acceptance/runtime/init.vim +4 -3
  44. data/spec/acceptance/runtime/rplugin/ruby/autocmds.rb +6 -2
  45. data/spec/acceptance/runtime/rplugin/ruby/commands.rb +17 -16
  46. data/spec/acceptance/runtime/rplugin/ruby/functions.rb +8 -8
  47. data/spec/helper.rb +2 -2
  48. data/spec/neovim/api_spec.rb +1 -1
  49. data/spec/neovim/client_spec.rb +10 -10
  50. data/spec/neovim/connection_spec.rb +5 -6
  51. data/spec/neovim/current_spec.rb +12 -12
  52. data/spec/neovim/executable_spec.rb +2 -2
  53. data/spec/neovim/host/loader_spec.rb +2 -2
  54. data/spec/neovim/host_spec.rb +7 -7
  55. data/spec/neovim/line_range_spec.rb +16 -16
  56. data/spec/neovim/logging_spec.rb +7 -7
  57. data/spec/neovim/plugin_spec.rb +6 -6
  58. data/spec/neovim/ruby_provider/buffer_ext_spec.rb +2 -2
  59. data/spec/neovim/ruby_provider/vim_spec.rb +4 -4
  60. data/spec/neovim/ruby_provider/window_ext_spec.rb +8 -8
  61. data/spec/neovim/session_spec.rb +8 -8
  62. data/spec/neovim/window_spec.rb +0 -1
  63. metadata +41 -27
  64. data/.gitmodules +0 -3
  65. data/.rspec +0 -1
  66. data/spec/acceptance/runtime/vader.vim/autoload/vader.vim +0 -348
  67. data/spec/acceptance/runtime/vader.vim/autoload/vader/assert.vim +0 -116
  68. data/spec/acceptance/runtime/vader.vim/autoload/vader/helper.vim +0 -43
  69. data/spec/acceptance/runtime/vader.vim/autoload/vader/parser.vim +0 -179
  70. data/spec/acceptance/runtime/vader.vim/autoload/vader/syntax.vim +0 -73
  71. data/spec/acceptance/runtime/vader.vim/autoload/vader/window.vim +0 -205
  72. data/spec/acceptance/runtime/vader.vim/plugin/vader.vim +0 -37
  73. data/spec/acceptance_spec.rb +0 -85
File without changes
File without changes
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "fileutils"
4
+
5
+ ENV.delete("VIM")
6
+ ENV.delete("VIMRUNTIME")
7
+
8
+ acceptance_root = File.expand_path("../../spec/acceptance", __FILE__)
9
+ themis_rtp = File.join(acceptance_root, "runtime")
10
+ themis_home = File.join(themis_rtp, "flavors/thinca_vim-themis")
11
+ manifest = File.join(themis_rtp, "rplugin_manifest.vim")
12
+ vimrc = File.join(themis_rtp, "init.vim")
13
+
14
+ themis_exe = Gem.win_platform? ?
15
+ File.join(themis_home, "bin/themis.bat") :
16
+ File.join(themis_home, "bin/themis")
17
+
18
+ env = {
19
+ "NVIM_RPLUGIN_MANIFEST" => manifest,
20
+ "THEMIS_VIM" => "nvim",
21
+ "THEMIS_HOME" => themis_home,
22
+ "THEMIS_ARGS" => "-e -s --headless -u #{vimrc}"
23
+ }
24
+
25
+ FileUtils.rm_f(manifest)
26
+
27
+ system(
28
+ env,
29
+ "nvim",
30
+ "-e", "-s", "--headless",
31
+ "-u", vimrc,
32
+ "+UpdateRemotePlugins", "+qa!"
33
+ )
34
+
35
+ exec(env, themis_exe, *ARGV)
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "json"
4
+ require "open-uri"
5
+
6
+ url = "https://api.github.com/repos/neovim/neovim/releases/latest"
7
+
8
+ begin
9
+ response = open(url) { |res| JSON.parse(res.read) }
10
+ rescue SocketError, OpenURI::HTTPError => e
11
+ puts "Request failed: #{e}\n"
12
+ exit
13
+ end
14
+
15
+ release_version = response["name"][/NVIM v?(.+)$/, 1]
16
+
17
+ client_file = File.read(
18
+ File.expand_path("../../lib/neovim/client.rb", __FILE__)
19
+ )
20
+ docs_version = client_file[
21
+ /The methods documented here were generated using NVIM v?(.+)$/,
22
+ 1
23
+ ]
24
+
25
+ if docs_version == release_version
26
+ puts "Documentation is up-to-date."
27
+ else
28
+ abort "Documentation is out of date: expected #{release_version}, got #{docs_version}."
29
+ end
@@ -1,18 +1,28 @@
1
- Before (Generate rplugin manifest):
2
- silent UpdateRemotePlugins
1
+ let s:suite = themis#suite("Remote plugin autocmd")
2
+ let s:expect = themis#helper("expect")
3
3
 
4
- Execute (Trigger event for matching patterns):
4
+ function! s:suite.has_nvim() abort
5
+ call s:expect(has("nvim")).to_equal(1)
6
+ endfunction
7
+
8
+ function! s:suite.triggers_for_matched_pattern() abort
5
9
  silent split file.rb
6
- sleep 50m
7
- AssertEqual v:true, b:rplugin_autocmd_BufEnter
10
+ call s:expect(b:rplugin_autocmd_BufEnter).to_equal(v:true)
11
+ endfunction
8
12
 
9
- Execute (Don't trigger event for non-matching patterns):
13
+ function! s:suite.doesnt_trigger_for_unmatched_pattern() abort
10
14
  silent split file.py
11
- sleep 50m
12
- AssertEqual 0, exists("b:rplugin_autocmd_BufEnter")
15
+ call s:expect(exists('b:rplugin_autocmd_BufEnter')).to_equal(0)
16
+ endfunction
13
17
 
14
- Execute (Trigger event with eval):
18
+ function! s:suite.supports_eval() abort
15
19
  let g:to_eval = {'a': 42}
16
20
  silent split file.c
21
+ call s:expect(g:rplugin_autocmd_BufEnter_eval).to_equal({'a': 42, 'b': 43})
22
+ endfunction
23
+
24
+ function! s:suite.supports_async() abort
25
+ silent split file.async
17
26
  sleep 50m
18
- AssertEqual {'a': 42, 'b': 43}, g:rplugin_autocmd_BufEnter_eval
27
+ call s:expect(g:rplugin_autocmd_BufEnter_async).to_equal(v:true)
28
+ endfunction
@@ -1,7 +1,17 @@
1
- Before (Generate rplugin manifest):
2
- silent UpdateRemotePlugins
1
+ let s:suite = themis#suite("Remote plugin command")
2
+ let s:expect = themis#helper("expect")
3
3
 
4
- Execute (Call rplugin commands with arguments):
4
+ function! s:suite.before_each() abort
5
+ 1,$delete
6
+ call append(0, ["one", "two", "three"])
7
+ normal gg
8
+ endfunction
9
+
10
+ function! s:suite.has_nvim() abort
11
+ call s:expect(has("nvim")).to_equal(1)
12
+ endfunction
13
+
14
+ function! s:suite.supports_arguments() abort
5
15
  RPluginCommandNargs0
6
16
  RPluginCommandNargs1 1
7
17
  RPluginCommandNargsN
@@ -11,91 +21,79 @@ Execute (Call rplugin commands with arguments):
11
21
  RPluginCommandNargsQ 1
12
22
  RPluginCommandNargsP 1
13
23
  RPluginCommandNargsP 1 2
14
- sleep 100m
15
-
16
- Then:
17
- AssertEqual v:true, g:rplugin_command_nargs_0
18
- AssertEqual "1", g:rplugin_command_nargs_1
19
- AssertEqual ["1", "2"], g:rplugin_command_nargs_n
20
- AssertEqual "1", g:rplugin_command_nargs_q
21
- AssertEqual ["1", "2"], g:rplugin_command_nargs_p
22
24
 
23
- Given:
24
- one
25
- two
26
- three
25
+ call s:expect(g:rplugin_command_nargs_0).to_equal(v:true)
26
+ call s:expect(g:rplugin_command_nargs_1).to_equal("1")
27
+ call s:expect(g:rplugin_command_nargs_n).to_equal(["1", "2"])
28
+ call s:expect(g:rplugin_command_nargs_q).to_equal("1")
29
+ call s:expect(g:rplugin_command_nargs_p).to_equal(["1", "2"])
30
+ endfunction
27
31
 
28
- Execute (Call rplugin commands with a range):
32
+ function! s:suite.supports_line_range() abort
29
33
  RPluginCommandRange
30
- sleep 50m
31
- AssertEqual [1, 1], g:rplugin_command_range
34
+ call s:expect(g:rplugin_command_range).to_equal([1, 1])
32
35
 
33
36
  1,2RPluginCommandRange
34
- sleep 50m
35
- AssertEqual [1, 2], g:rplugin_command_range
37
+ call s:expect(g:rplugin_command_range).to_equal([1, 2])
36
38
 
37
39
  %RPluginCommandRange
38
- sleep 50m
39
- AssertEqual [1, 3], g:rplugin_command_range
40
+ call s:expect(g:rplugin_command_range).to_equal([1, 4])
40
41
 
41
42
  RPluginCommandRangeP
42
- sleep 50m
43
- AssertEqual [1, 3], g:rplugin_command_range_p
43
+ call s:expect(g:rplugin_command_range_p).to_equal([1, 4])
44
44
 
45
45
  1,2RPluginCommandRangeP
46
- sleep 50m
47
- AssertEqual [1, 2], g:rplugin_command_range_p
46
+ call s:expect(g:rplugin_command_range_p).to_equal([1, 2])
48
47
 
49
48
  %RPluginCommandRangeP
50
- sleep 50m
51
- AssertEqual [1, 3], g:rplugin_command_range_p
49
+ call s:expect(g:rplugin_command_range_p).to_equal([1, 4])
52
50
 
53
51
  RPluginCommandRangeN
54
- sleep 50m
55
- AssertEqual [1], g:rplugin_command_range_n
52
+ call s:expect(g:rplugin_command_range_n).to_equal([1])
56
53
 
57
54
  2RPluginCommandRangeN
58
- sleep 50m
59
- AssertEqual [2], g:rplugin_command_range_n
55
+ call s:expect(g:rplugin_command_range_n).to_equal([2])
56
+ endfunction
60
57
 
61
- Execute (Call rplugin commands with a count):
58
+ function! s:suite.supports_count() abort
62
59
  RPluginCommandCountN
63
- sleep 50m
64
- AssertEqual [1], g:rplugin_command_count_n
60
+ call s:expect(g:rplugin_command_count_n).to_equal([1])
65
61
 
66
62
  2RPluginCommandCountN
67
- sleep 50m
68
- AssertEqual [2], g:rplugin_command_count_n
63
+ call s:expect(g:rplugin_command_count_n).to_equal([2])
64
+ endfunction
69
65
 
70
- Execute (Call rplugin commands with a bang):
66
+ function! s:suite.supports_bang() abort
71
67
  RPluginCommandBang
72
- sleep 50m
73
- AssertEqual 0, g:rplugin_command_bang
68
+ call s:expect(g:rplugin_command_bang).to_equal(0)
74
69
 
75
70
  RPluginCommandBang!
76
- sleep 50m
77
- AssertEqual 1, g:rplugin_command_bang
71
+ call s:expect(g:rplugin_command_bang).to_equal(1)
72
+ endfunction
78
73
 
79
- Execute (Call rplugin commands with a register):
74
+ function! s:suite.supports_register() abort
80
75
  RPluginCommandRegister a
81
- sleep 50m
82
- AssertEqual "a", g:rplugin_command_register
76
+ call s:expect(g:rplugin_command_register).to_equal("a")
77
+ endfunction
83
78
 
84
- Execute (Call rplugin commands with completion):
79
+ function! s:suite.supports_completion() abort
85
80
  RPluginCommandCompletion
86
- sleep 50m
87
- AssertEqual "buffer", g:rplugin_command_completion
81
+ call s:expect(g:rplugin_command_completion).to_equal("buffer")
82
+ endfunction
88
83
 
89
- Execute (Call rplugin commands with eval):
84
+ function! s:suite.supports_eval() abort
90
85
  let g:to_eval = {'a': 42}
91
86
  RPluginCommandEval
92
- sleep 50m
93
- AssertEqual {'a': 42, 'b': 43}, g:rplugin_command_eval
87
+ call s:expect(g:rplugin_command_eval).to_equal({'a': 42, 'b': 43})
88
+ endfunction
94
89
 
95
- Execute (Call synchronous rplugin commands):
96
- RPluginCommandSync
97
- AssertEqual v:true, g:rplugin_command_sync
90
+ function! s:suite.supports_asynchronous_commands() abort
91
+ RPluginCommandAsync
92
+ sleep 50m
93
+ call s:expect(g:rplugin_command_async).to_equal(v:true)
94
+ endfunction
98
95
 
99
- Execute (Call recursive rplugin commands):
96
+ function! s:suite.supports_recursion() abort
100
97
  RPluginCommandRecursive 0
101
- AssertEqual "10", g:rplugin_command_recursive
98
+ call s:expect(g:rplugin_command_recursive).to_equal("10")
99
+ endfunction
@@ -1,29 +1,35 @@
1
- Before (Generate rplugin manifest):
2
- silent UpdateRemotePlugins
1
+ let s:suite = themis#suite("Remote plugin function")
2
+ let s:expect = themis#helper("expect")
3
3
 
4
- Execute (Call rplugin functions with arguments):
5
- call RPluginFunctionArgs(1, 2)
6
- sleep 50m
7
- AssertEqual [1, 2], g:rplugin_function_args
4
+ function! s:suite.before_each() abort
5
+ 1,$delete
6
+ call append(0, ["one", "two", "three"])
7
+ endfunction
8
8
 
9
- Given:
10
- one
11
- two
12
- three
9
+ function! s:suite.has_nvim() abort
10
+ call s:expect(has("nvim")).to_equal(1)
11
+ endfunction
13
12
 
14
- Execute (Call rplugin functions with a range):
15
- 1,2call RPluginFunctionRange()
16
- sleep 50m
17
- AssertEqual [1, 2], g:rplugin_function_range
13
+ function! s:suite.supports_arguments() abort
14
+ call s:expect(RPluginFunctionArgs(1, 2)).to_equal([1, 2])
15
+ endfunction
16
+
17
+ function! s:suite.supports_line_range() abort
18
+ 3,4call RPluginFunctionRange()
19
+ call s:expect(g:rplugin_function_range).to_equal([3, 4])
20
+ endfunction
18
21
 
19
- Execute (Call rplugin functions with eval):
22
+ function! s:suite.supports_eval() abort
20
23
  let g:to_eval = {'a': 42}
21
- call RPluginFunctionEval()
22
- sleep 50m
23
- AssertEqual {'a': 42, 'b': 43}, g:rplugin_function_eval
24
+ call s:expect(RPluginFunctionEval()).to_equal({"a": 42, "b": 43})
25
+ endfunction
24
26
 
25
- Execute (Call synchronous rplugin functions):
26
- AssertEqual v:true, RPluginFunctionSync()
27
+ function! s:suite.supports_asynchronous_functions() abort
28
+ call RPluginFunctionAsync()
29
+ sleep 50m
30
+ call s:expect(g:rplugin_function_async).to_equal(v:true)
31
+ endfunction
27
32
 
28
- Execute (Call recursive rplugin functions):
29
- AssertEqual 10, RPluginFunctionRecursive(0)
33
+ function! s:suite.supports_recursion() abort
34
+ call s:expect(RPluginFunctionRecursive(0)).to_equal(10)
35
+ endfunction
@@ -1,92 +1,84 @@
1
- Execute (Set nvim_version):
2
- if has('nvim')
3
- let g:nvim_version = api_info()['version']
4
- else
5
- let g:nvim_version = {'major': 99, 'minor': 99, 'patch': 99}
6
- endif
7
-
8
- Given:
9
- one
10
- two
11
-
12
- Execute (Define a Ruby method):
13
- ruby def foo; Vim.command("let g:called = 1"); end
1
+ let s:suite = themis#suite(":ruby")
2
+ let s:expect = themis#helper("expect")
3
+
4
+ function! s:suite.before_each() abort
5
+ 1,$delete
6
+ call append(0, ["one", "two"])
7
+ endfunction
8
+
9
+ function! s:suite.has_nvim() abort
10
+ call s:expect(has("nvim")).to_equal(1)
11
+ endfunction
14
12
 
15
- Execute (Call a Ruby method):
13
+ function! s:suite.defines_a_ruby_method() abort
14
+ ruby def foo; Vim.command("let g:called = 1"); end
16
15
  ruby foo
17
16
 
18
- Then:
19
- AssertEqual 1, g:called
17
+ call s:expect(g:called).to_equal(1)
18
+ endfunction
20
19
 
21
- Execute (Update instance state on `$curbuf`):
20
+ function! s:suite.persists_curbuf_state() abort
22
21
  ruby $curbuf.instance_variable_set(:@foo, 123)
23
22
  ruby Vim.command("let g:foo = #{$curbuf.instance_variable_get(:@foo)}")
24
23
 
25
- Then:
26
- AssertEqual 123, g:foo
24
+ call s:expect(g:foo).to_equal(123)
25
+ endfunction
27
26
 
28
- Execute (Change the working directory explicitly):
27
+ function! s:suite.updates_working_directory() abort
29
28
  cd /
30
- ruby Vim.command("let g:ruby_pwd = '#{Dir.pwd.sub(/^C:/, '')}'")
29
+ ruby Vim.command("let g:ruby_pwd = '#{Dir.pwd.sub(/^C:/, "")}'")
31
30
  cd -
32
31
 
33
- Then:
34
- if g:nvim_version['major'] > 0 || g:nvim_version['minor'] >= 2
35
- AssertEqual "/", g:ruby_pwd
36
- endif
32
+ call s:expect(g:ruby_pwd).to_equal("/")
33
+ endfunction
37
34
 
38
- Execute (Change the working directory implicitly):
35
+ function! s:suite.updates_working_directory_implicitly() abort
39
36
  split | lcd /
40
37
  ruby Vim.command("let g:before_pwd = '#{Dir.pwd}'")
41
38
  wincmd p
42
39
  ruby Vim.command("let g:after_pwd = '#{Dir.pwd}'")
43
40
  wincmd p | lcd -
44
41
 
45
- Then:
46
- if g:nvim_version['major'] > 0 || g:nvim_version['minor'] >= 2
47
- AssertNotEqual g:before_pwd, g:after_pwd
48
- endif
42
+ call s:expect(g:before_pwd).not.to_equal(g:after_pwd)
43
+ endfunction
49
44
 
50
- Execute (Run nested Ruby commands):
45
+ function! s:suite.supports_nesting() abort
51
46
  ruby Vim.command("ruby Vim.command('let g:ruby_nested = 123')")
52
47
 
53
- Then:
54
- AssertEqual 123, g:ruby_nested
48
+ call s:expect(g:ruby_nested).to_equal(123)
49
+ endfunction
55
50
 
56
- Execute (Raise a Ruby standard error):
51
+ function! s:suite.handles_standard_error() abort
57
52
  try
58
53
  ruby raise "BOOM"
59
54
  throw "Nothing raised"
60
55
  catch /BOOM/
61
56
  endtry
62
57
 
63
- ruby $curbuf[1] = "still works"
64
-
65
- Expect:
66
- still works
67
- two
58
+ call s:suite.defines_a_ruby_method()
59
+ endfunction
68
60
 
69
- Execute (Raise a Ruby syntax error):
61
+ function! s:suite.handles_syntax_error() abort
70
62
  try
71
63
  ruby puts[
72
64
  throw "Nothing raised"
73
65
  catch /SyntaxError/
74
66
  endtry
75
67
 
76
- ruby $curbuf[1] = "still works"
77
-
78
- Expect:
79
- still works
80
- two
68
+ call s:suite.defines_a_ruby_method()
69
+ endfunction
81
70
 
82
- Execute (Access Vim interface):
71
+ function! s:suite.exposes_Vim() abort
83
72
  ruby expect(Vim).to eq(VIM)
84
73
  ruby expect(Vim.strwidth("hi")).to eq(2)
74
+ endfunction
85
75
 
86
- Execute (Access Vim::Buffer interface):
76
+ function! s:suite.exposes_Buffer() abort
87
77
  ruby expect($curbuf).to be_a(Neovim::Buffer)
88
78
  ruby expect(Vim::Buffer.current).to eq($curbuf)
79
+ endfunction
89
80
 
90
- Execute (Access Vim::Window interface):
81
+ function! s:suite.exposes_Window() abort
91
82
  ruby expect($curwin).to be_a(Neovim::Window)
92
83
  ruby expect(Vim::Window.current).to eq($curwin)
84
+ endfunction