neovim 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b4fecc46a144d9fa3d537f9b0f9ed7da0a89e0c3
4
- data.tar.gz: e8d246f7011bc118ba28706306065b823d18fb12
3
+ metadata.gz: 9fc40ef389b3a8f14b2f8c732553d9e4c02f0ce2
4
+ data.tar.gz: f99653d06b7373c3c05021d3f1d9db6e26a60185
5
5
  SHA512:
6
- metadata.gz: a1367f6f99b864818ddc7b98f6ffd04b8e3795cc3f797deed986ba8c86f3bc880c5be66d5b1bd7b17a6c7877a7b554ef944bbee473af3d30345055ce41925a06
7
- data.tar.gz: 6b67c6c0163aea888f5131e4cad4bc5c7bc3c7765462569a5fc37251b4d5d6482a77b01b9a06878b22a9c7c0523fe17bc0b04ca18daf64f7f6ca7dd8702381fd
6
+ metadata.gz: b2f8af36212e0abd4ad2663b4a288452072fd761e017d5e33c19b17dcac93befa562ac4439c69e7d5764fa59013fb5aab321db8836e4f9db4834b0150d1c3c96
7
+ data.tar.gz: 6ac9d1e4d97870f26dbd28cad4dde0c556d9cb301cec0c3a78775b36db585026d8249e852b71482c5fb65f81ecc2e6702580f776a6a8f8d24ca12f62bc8e8dde
@@ -1,3 +1,6 @@
1
+ # 0.3.3
2
+ - Hotfix older nvim clients' inability to hook into DirChanged
3
+
1
4
  # 0.3.2
2
5
  - Fix directory tracking in legacy Ruby provider
3
6
 
@@ -29,7 +29,7 @@ module Neovim
29
29
  def self.__define_ruby_execute(plug)
30
30
  plug.__send__(:rpc, :ruby_execute) do |nvim, ruby|
31
31
  __wrap_client(nvim) do
32
- eval(ruby, TOPLEVEL_BINDING, __FILE__, __LINE__)
32
+ eval(ruby, TOPLEVEL_BINDING, "eval")
33
33
  end
34
34
  end
35
35
  end
@@ -63,7 +63,7 @@ module Neovim
63
63
  __update_lines_in_chunks(__buffer, __start, __stop, 5000) do |__lines|
64
64
  __lines.map do |__line|
65
65
  $_ = __line
66
- eval(__ruby, binding, __FILE__, __LINE__)
66
+ eval(__ruby, binding, "eval")
67
67
  $_
68
68
  end
69
69
  end
@@ -74,8 +74,13 @@ module Neovim
74
74
 
75
75
  def self.__define_ruby_chdir(plug)
76
76
  plug.__send__(:setup) do |client|
77
- cid = client.channel_id
78
- client.command("au DirChanged * call rpcrequest(#{cid}, 'ruby_chdir', v:event)")
77
+ begin
78
+ cid = client.channel_id
79
+ client.command("au DirChanged * call rpcrequest(#{cid}, 'ruby_chdir', v:event)")
80
+ rescue ArgumentError
81
+ # Swallow this exception for now. This means the nvim installation is
82
+ # from before DirChanged was implemented.
83
+ end
79
84
  end
80
85
 
81
86
  plug.__send__(:rpc, :ruby_chdir) do |nvim, event|
@@ -88,10 +93,8 @@ module Neovim
88
93
  __with_globals(client) do
89
94
  __with_vim_constant(client) do
90
95
  __with_redirect_streams(client) do
91
- begin
96
+ __with_exception_handling(client) do
92
97
  yield
93
- rescue SyntaxError => e
94
- client.err_write(e.message)
95
98
  end
96
99
  end
97
100
  end
@@ -126,7 +129,7 @@ module Neovim
126
129
  end
127
130
 
128
131
  $stderr.define_singleton_method(:write) do |string|
129
- client.err_write(string)
132
+ client.report_error(string)
130
133
  end
131
134
 
132
135
  true
@@ -136,6 +139,15 @@ module Neovim
136
139
  end
137
140
  private_class_method :__with_redirect_streams
138
141
 
142
+ def self.__with_exception_handling(client)
143
+ begin
144
+ yield
145
+ rescue SyntaxError, StandardError => e
146
+ msg = [e.class, e.message].join(": ")
147
+ client.report_error(msg.lines.first.strip)
148
+ end
149
+ end
150
+
139
151
  def self.__update_lines_in_chunks(buffer, start, stop, size)
140
152
  (start..stop).each_slice(size) do |linenos|
141
153
  _start, _stop = linenos[0]-1, linenos[-1]
@@ -1,3 +1,3 @@
1
1
  module Neovim
2
- VERSION = Gem::Version.new("0.3.2")
2
+ VERSION = Gem::Version.new("0.3.3")
3
3
  end
@@ -72,13 +72,23 @@ RSpec.describe "ruby_provider" do
72
72
  }.from(Dir.pwd)
73
73
  end
74
74
 
75
- it "handles malformed ruby" do
75
+ it "handles standard errors" do
76
+ expect {
77
+ nvim.eval("rpcrequest(host, 'ruby_execute', 'raise')")
78
+ }.to raise_error(ArgumentError)
79
+
80
+ expect {
81
+ nvim.eval("rpcrequest(host, 'ruby_execute', '12')")
82
+ }.not_to raise_error
83
+ end
84
+
85
+ it "handles syntax errors" do
76
86
  expect {
77
87
  nvim.eval("rpcrequest(host, 'ruby_execute', 'puts[')")
78
88
  }.to raise_error(ArgumentError)
79
89
 
80
90
  expect {
81
- nvim.eval("rpcrequest(host, 'ruby_execute', 'puts \"12\"')")
91
+ nvim.eval("rpcrequest(host, 'ruby_execute', '12')")
82
92
  }.not_to raise_error
83
93
  end
84
94
  end
@@ -171,7 +181,21 @@ RSpec.describe "ruby_provider" do
171
181
  }.from(Dir.pwd)
172
182
  end
173
183
 
174
- it "handles malformed ruby" do
184
+ it "handles standard errors" do
185
+ File.write(script_path, "raise")
186
+
187
+ expect {
188
+ nvim.eval("rpcrequest(host, 'ruby_execute_file', '#{script_path}')")
189
+ }.to raise_error(ArgumentError)
190
+
191
+ File.write(script_path, "12")
192
+
193
+ expect {
194
+ nvim.eval("rpcrequest(host, 'ruby_execute_file', '#{script_path}')")
195
+ }.not_to raise_error
196
+ end
197
+
198
+ it "handles syntax errors" do
175
199
  File.write(script_path, "puts[")
176
200
 
177
201
  expect {
@@ -205,7 +229,19 @@ RSpec.describe "ruby_provider" do
205
229
  }.to change { nvim.current.buffer.lines.to_a }.to(ys)
206
230
  end
207
231
 
208
- it "handles malformed ruby" do
232
+ it "handles standard errors" do
233
+ nvim.current.buffer.lines = ["a", "b"]
234
+
235
+ expect {
236
+ nvim.eval("rpcrequest(host, 'ruby_do_range', 1, 1, 'raise')")
237
+ }.to raise_error(ArgumentError)
238
+
239
+ expect {
240
+ nvim.eval("rpcrequest(host, 'ruby_do_range', 1, 1, '12')")
241
+ }.not_to raise_error
242
+ end
243
+
244
+ it "handles syntax errors" do
209
245
  nvim.current.buffer.lines = ["a", "b"]
210
246
 
211
247
  expect {
@@ -213,7 +249,7 @@ RSpec.describe "ruby_provider" do
213
249
  }.to raise_error(ArgumentError)
214
250
 
215
251
  expect {
216
- nvim.eval("rpcrequest(host, 'ruby_do_range', 1, 1, 'puts')")
252
+ nvim.eval("rpcrequest(host, 'ruby_do_range', 1, 1, '12')")
217
253
  }.not_to raise_error
218
254
  end
219
255
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neovim
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Genco
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-18 00:00:00.000000000 Z
11
+ date: 2017-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack