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
@@ -30,16 +30,16 @@ module Neovim
30
30
  it "registers a msgpack ext type" do
31
31
  ext_class = Struct.new(:id) do
32
32
  def self.from_msgpack_ext(data)
33
- new(data.unpack('N')[0])
33
+ new(data.unpack("N")[0])
34
34
  end
35
35
 
36
36
  def to_msgpack_ext
37
- [self.id].pack('C')
37
+ [id].pack("C")
38
38
  end
39
39
  end
40
40
 
41
41
  client_rd, server_wr = IO.pipe
42
- server_rd, client_wr = IO.pipe
42
+ _, client_wr = IO.pipe
43
43
 
44
44
  connection = Connection.new(client_rd, client_wr)
45
45
 
@@ -56,7 +56,6 @@ module Neovim
56
56
  end
57
57
  end
58
58
 
59
-
60
59
  describe "#close" do
61
60
  it "closes IO handles" do
62
61
  rd, wr = ::IO.pipe
@@ -69,10 +68,10 @@ module Neovim
69
68
  it "kills spawned processes" do
70
69
  io = ::IO.popen("cat", "rb+")
71
70
  pid = io.pid
72
- expect(pid).to respond_to(:to_int)
71
+ thr = Process.detach(pid)
73
72
 
74
73
  Connection.new(io, nil_io).close
75
- expect { Process.kill(0, pid) }.to raise_error(Errno::ESRCH)
74
+ expect(thr.join.pid).to eq(pid)
76
75
  end
77
76
  end
78
77
  end
@@ -35,9 +35,9 @@ module Neovim
35
35
  initial_index = current.buffer.index
36
36
  client.command("vnew")
37
37
 
38
- expect {
38
+ expect do
39
39
  current.buffer = initial_index
40
- }.to change { current.buffer.index }.to(initial_index)
40
+ end.to change { current.buffer.index }.to(initial_index)
41
41
  end
42
42
 
43
43
  it "sets the current buffer from a Buffer" do
@@ -45,9 +45,9 @@ module Neovim
45
45
  client.command("vnew")
46
46
  b1 = current.buffer
47
47
 
48
- expect {
48
+ expect do
49
49
  current.buffer = b0
50
- }.to change { current.buffer }.from(b1).to(b0)
50
+ end.to change { current.buffer }.from(b1).to(b0)
51
51
  end
52
52
 
53
53
  it "returns an integer" do
@@ -72,9 +72,9 @@ module Neovim
72
72
  start_index = current.window.index
73
73
  client.command("vsp")
74
74
 
75
- expect {
75
+ expect do
76
76
  current.window = start_index
77
- }.to change { current.window.index }.to(start_index)
77
+ end.to change { current.window.index }.to(start_index)
78
78
  end
79
79
 
80
80
  it "sets the current window from a Window" do
@@ -82,9 +82,9 @@ module Neovim
82
82
  client.command("vsp")
83
83
  w1 = current.window
84
84
 
85
- expect {
85
+ expect do
86
86
  current.window = w0
87
- }.to change { current.window }.from(w1).to(w0)
87
+ end.to change { current.window }.from(w1).to(w0)
88
88
  end
89
89
 
90
90
  it "returns an integer" do
@@ -110,9 +110,9 @@ module Neovim
110
110
  client.command("tabnew")
111
111
  expect(current.tabpage.index).not_to eq(initial_index)
112
112
 
113
- expect {
113
+ expect do
114
114
  current.tabpage = initial_index
115
- }.to change { current.tabpage.index }.to(initial_index)
115
+ end.to change { current.tabpage.index }.to(initial_index)
116
116
  end
117
117
 
118
118
  it "sets the current tabpage from a Tabpage" do
@@ -120,9 +120,9 @@ module Neovim
120
120
  client.command("tabnew")
121
121
  tp1 = current.tabpage
122
122
 
123
- expect {
123
+ expect do
124
124
  current.tabpage = tp0
125
- }.to change { current.tabpage }.from(tp1).to(tp0)
125
+ end.to change { current.tabpage }.from(tp1).to(tp0)
126
126
  end
127
127
 
128
128
  it "returns an integer" do
@@ -23,9 +23,9 @@ module Neovim
23
23
  it "raises with an invalid executable path" do
24
24
  executable = Executable.new(File::NULL)
25
25
 
26
- expect {
26
+ expect do
27
27
  executable.version
28
- }.to raise_error(Executable::Error, Regexp.new(File::NULL))
28
+ end.to raise_error(Executable::Error, Regexp.new(File::NULL))
29
29
  end
30
30
  end
31
31
  end
@@ -45,9 +45,9 @@ module Neovim
45
45
 
46
46
  it "doesn't leak the overidden Neovim.plugin method" do
47
47
  loader.load([plugin_path])
48
- expect {
48
+ expect do
49
49
  Neovim.plugin
50
- }.to raise_error(/outside of a plugin host/)
50
+ end.to raise_error(/outside of a plugin host/)
51
51
  end
52
52
  end
53
53
  end
@@ -64,7 +64,7 @@ module Neovim
64
64
  context "after poll" do
65
65
  before do
66
66
  nvim_wr.write([0, 1, :poll, []]).flush
67
- _, reqid, _ = nvim_rd.read
67
+ _, reqid, = nvim_rd.read
68
68
 
69
69
  session = Session.new(EventLoop.child(Support.child_argv))
70
70
  api_info = session.request(:nvim_get_api_info)
@@ -87,22 +87,22 @@ module Neovim
87
87
  "type" => "command",
88
88
  "name" => "Echo",
89
89
  "sync" => true,
90
- "opts" => {"nargs" => 1},
90
+ "opts" => {"nargs" => 1}
91
91
  },
92
92
  {
93
93
  "type" => "command",
94
94
  "name" => "Boom",
95
95
  "sync" => true,
96
- "opts" => {},
96
+ "opts" => {}
97
97
  },
98
98
  {
99
99
  "type" => "command",
100
100
  "name" => "BoomAsync",
101
101
  "sync" => false,
102
- "opts" => {},
103
- },
104
- ],
105
- ],
102
+ "opts" => {}
103
+ }
104
+ ]
105
+ ]
106
106
  )
107
107
  end
108
108
 
@@ -66,9 +66,9 @@ module Neovim
66
66
  expect(line_range[-2, 2]).to eq(["3", "4"])
67
67
  expect(line_range[-2, 3]).to eq(["3", "4"])
68
68
 
69
- expect {
69
+ expect do
70
70
  line_range[2, 3]
71
- }.to raise_error(/out of bounds/)
71
+ end.to raise_error(/out of bounds/)
72
72
  end
73
73
 
74
74
  it "accepts a range" do
@@ -83,9 +83,9 @@ module Neovim
83
83
  expect(line_range[0...-4]).to eq([])
84
84
  expect(line_range[-2..-3]).to eq([])
85
85
 
86
- expect {
86
+ expect do
87
87
  line_range[2..4]
88
- }.to raise_error(/out of bounds/)
88
+ end.to raise_error(/out of bounds/)
89
89
  end
90
90
  end
91
91
 
@@ -97,9 +97,9 @@ module Neovim
97
97
  expect(line_range[-1] = "bar").to eq("bar")
98
98
  expect(line_range.to_a).to eq(["foo", "2", "3", "bar"])
99
99
 
100
- expect {
100
+ expect do
101
101
  line_range[-5] = "foo"
102
- }.to raise_error(/out of bounds/)
102
+ end.to raise_error(/out of bounds/)
103
103
  end
104
104
 
105
105
  it "accepts an index and length" do
@@ -112,9 +112,9 @@ module Neovim
112
112
  expect(line_range[0, 2] = "baz").to eq("baz")
113
113
  expect(line_range.to_a).to eq(["baz"])
114
114
 
115
- expect {
115
+ expect do
116
116
  line_range[0, 5] = "foo"
117
- }.to raise_error(/out of bounds/)
117
+ end.to raise_error(/out of bounds/)
118
118
  end
119
119
 
120
120
  it "accepts a range" do
@@ -141,17 +141,17 @@ module Neovim
141
141
 
142
142
  describe "#delete" do
143
143
  it "deletes the line at the given index" do
144
- expect {
144
+ expect do
145
145
  line_range.delete(0)
146
- }.to change { line_range.to_a }.to(["2", "3", "4"])
146
+ end.to change { line_range.to_a }.to(["2", "3", "4"])
147
147
 
148
- expect {
148
+ expect do
149
149
  line_range.delete(-1)
150
- }.to change { line_range.to_a }.to(["2", "3"])
150
+ end.to change { line_range.to_a }.to(["2", "3"])
151
151
 
152
- expect {
152
+ expect do
153
153
  line_range.delete(-2)
154
- }.to change { line_range.to_a }.to(["3"])
154
+ end.to change { line_range.to_a }.to(["3"])
155
155
  end
156
156
 
157
157
  it "returns the line deleted" do
@@ -160,9 +160,9 @@ module Neovim
160
160
  end
161
161
 
162
162
  it "returns nil if provided a non-integer" do
163
- expect {
163
+ expect do
164
164
  expect(line_range.delete(:foo)).to eq(nil)
165
- }.not_to change { line_range.to_a }
165
+ end.not_to change { line_range.to_a }
166
166
  end
167
167
  end
168
168
  end
@@ -16,21 +16,21 @@ module Neovim
16
16
 
17
17
  describe ".logger" do
18
18
  it "fetches the output from $NVIM_RUBY_LOG_FILE" do
19
- logger = instance_double(Logger, "level=": nil, "formatter=": nil)
19
+ logger = instance_double(Logger, :level= => nil, :formatter= => nil)
20
20
  expect(Logger).to receive(:new).with("/tmp/nvim.log").and_return(logger)
21
21
  Logging.logger("NVIM_RUBY_LOG_FILE" => "/tmp/nvim.log")
22
22
  expect(Logging.logger).to be(logger)
23
23
  end
24
24
 
25
25
  it "defaults the output to STDERR" do
26
- logger = instance_double(Logger, "level=": nil, "formatter=": nil)
26
+ logger = instance_double(Logger, :level= => nil, :formatter= => nil)
27
27
  expect(Logger).to receive(:new).with(STDERR).and_return(logger)
28
28
  Logging.logger({})
29
29
  expect(Logging.logger).to be(logger)
30
30
  end
31
31
 
32
32
  it "fetches the level from $NVIM_RUBY_LOG_LEVEL as a string" do
33
- logger = instance_double(Logger, "formatter=": nil)
33
+ logger = instance_double(Logger, :formatter= => nil)
34
34
  expect(Logger).to receive(:new).and_return(logger)
35
35
  expect(logger).to receive(:level=).with(Logger::DEBUG)
36
36
  Logging.logger("NVIM_RUBY_LOG_LEVEL" => "DEBUG")
@@ -38,7 +38,7 @@ module Neovim
38
38
  end
39
39
 
40
40
  it "fetches the level from $NVIM_RUBY_LOG_LEVEL as an integer" do
41
- logger = instance_double(Logger, "formatter=": nil)
41
+ logger = instance_double(Logger, :formatter= => nil)
42
42
  expect(Logger).to receive(:new).and_return(logger)
43
43
  expect(logger).to receive(:level=).with(0)
44
44
  Logging.logger("NVIM_RUBY_LOG_LEVEL" => "0")
@@ -46,7 +46,7 @@ module Neovim
46
46
  end
47
47
 
48
48
  it "defaults the level to WARN" do
49
- logger = instance_double(Logger, "formatter=": nil)
49
+ logger = instance_double(Logger, :formatter= => nil)
50
50
  expect(Logger).to receive(:new).and_return(logger)
51
51
  expect(logger).to receive(:level=).with(Logger::WARN)
52
52
  Logging.logger({})
@@ -110,7 +110,7 @@ module Neovim
110
110
  "_method" => "some_method",
111
111
  "_time" => /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d+/,
112
112
  "exception" => "RuntimeError",
113
- "message" => "BOOM",
113
+ "message" => "BOOM"
114
114
  )
115
115
 
116
116
  expect(debug).to match(
@@ -120,7 +120,7 @@ module Neovim
120
120
  "_time" => /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d+/,
121
121
  "exception" => "RuntimeError",
122
122
  "message" => "BOOM",
123
- "backtrace" => ["one", "two"],
123
+ "backtrace" => ["one", "two"]
124
124
  )
125
125
  end
126
126
  end
@@ -33,8 +33,8 @@ module Neovim
33
33
  nargs: 1,
34
34
  range: "",
35
35
  bang: "",
36
- register: "",
37
- },
36
+ register: ""
37
+ }
38
38
  )
39
39
  end
40
40
 
@@ -56,7 +56,7 @@ module Neovim
56
56
  type: :autocmd,
57
57
  name: "BufEnter",
58
58
  sync: false,
59
- opts: {pattern: "*.rb"},
59
+ opts: {pattern: "*.rb"}
60
60
  )
61
61
  end
62
62
 
@@ -78,7 +78,7 @@ module Neovim
78
78
  type: :function,
79
79
  name: "Foo",
80
80
  sync: false,
81
- opts: {range: "", nargs: 1},
81
+ opts: {range: "", nargs: 1}
82
82
  )
83
83
  end
84
84
 
@@ -95,9 +95,9 @@ module Neovim
95
95
  end
96
96
  end
97
97
 
98
- expect {
98
+ expect do
99
99
  plugin.setup(:client)
100
- }.to change { yielded }.from([]).to([:client, :other])
100
+ end.to change { yielded }.from([]).to([:client, :other])
101
101
  end
102
102
 
103
103
  it "registers a top level RPC" do
@@ -19,9 +19,9 @@ module Neovim
19
19
 
20
20
  describe ".count" do
21
21
  it "returns the current buffer count from the global Vim client" do
22
- expect {
22
+ expect do
23
23
  nvim.command("new")
24
- }.to change { Buffer.count }.by(1)
24
+ end.to change { Buffer.count }.by(1)
25
25
  end
26
26
  end
27
27
 
@@ -58,13 +58,13 @@ RSpec.describe Vim do
58
58
  Vim.__client = client
59
59
  Vim.__refresh_globals(client)
60
60
 
61
- expect {
61
+ expect do
62
62
  Vim.command("wincmd n")
63
- }.to change { $curwin.index }.by(1)
63
+ end.to change { $curwin.index }.by(1)
64
64
 
65
- expect {
65
+ expect do
66
66
  Vim.command("vs bar")
67
- }.to change { $curbuf.index }.by(1)
67
+ end.to change { $curbuf.index }.by(1)
68
68
  end
69
69
  end
70
70
  end
@@ -19,31 +19,31 @@ module Neovim
19
19
 
20
20
  describe ".count" do
21
21
  it "returns the current window count from the global Vim client" do
22
- expect {
22
+ expect do
23
23
  nvim.command("new")
24
- }.to change { Window.count }.by(1)
24
+ end.to change { Window.count }.by(1)
25
25
  end
26
26
 
27
27
  it "only includes windows within a tabpage" do
28
- expect {
28
+ expect do
29
29
  nvim.command("tabnew")
30
- }.not_to change { Window.count }.from(1)
30
+ end.not_to change { Window.count }.from(1)
31
31
  end
32
32
  end
33
33
 
34
34
  describe ".[]" do
35
35
  it "returns the window at the given index" do
36
- expect {
36
+ expect do
37
37
  nvim.command("new")
38
- }.to change { Window[1] }.from(nil).to(kind_of(Window))
38
+ end.to change { Window[1] }.from(nil).to(kind_of(Window))
39
39
  end
40
40
 
41
41
  it "only includes windows within a tabpage" do
42
42
  nvim.command("new")
43
43
 
44
- expect {
44
+ expect do
45
45
  nvim.command("tabnew")
46
- }.to change { Window[1] }.from(kind_of(Window)).to(nil)
46
+ end.to change { Window[1] }.from(kind_of(Window)).to(nil)
47
47
  end
48
48
  end
49
49
  end
@@ -13,9 +13,9 @@ module Neovim
13
13
  end
14
14
 
15
15
  it "raises an exception when there are errors" do
16
- expect {
16
+ expect do
17
17
  session.request(:nvim_strwidth, "too", "many")
18
- }.to raise_error(/wrong number of arguments/i)
18
+ end.to raise_error(/wrong number of arguments/i)
19
19
  end
20
20
 
21
21
  it "handles large data" do
@@ -25,17 +25,17 @@ module Neovim
25
25
  end
26
26
 
27
27
  it "fails outside of the main thread", :silence_thread_exceptions do
28
- expect {
28
+ expect do
29
29
  Thread.new { session.request(:nvim_strwidth, "foo") }.join
30
- }.to raise_error(/outside of the main thread/)
30
+ end.to raise_error(/outside of the main thread/)
31
31
  end
32
32
  end
33
33
 
34
34
  describe "#notify" do
35
35
  it "doesn't raise exceptions" do
36
- expect {
36
+ expect do
37
37
  session.notify(:nvim_strwidth, "too", "many")
38
- }.not_to raise_error
38
+ end.not_to raise_error
39
39
  end
40
40
 
41
41
  it "handles large data" do
@@ -45,9 +45,9 @@ module Neovim
45
45
  end
46
46
 
47
47
  it "succeeds outside of the main thread" do
48
- expect {
48
+ expect do
49
49
  Thread.new { session.notify(:nvim_set_current_line, "foo") }.join
50
- }.not_to raise_error
50
+ end.not_to raise_error
51
51
  end
52
52
  end
53
53