neovim 0.3.2 → 0.3.3
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/neovim/ruby_provider.rb +20 -8
- data/lib/neovim/version.rb +1 -1
- data/spec/acceptance/ruby_provider_spec.rb +41 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9fc40ef389b3a8f14b2f8c732553d9e4c02f0ce2
|
4
|
+
data.tar.gz: f99653d06b7373c3c05021d3f1d9db6e26a60185
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2f8af36212e0abd4ad2663b4a288452072fd761e017d5e33c19b17dcac93befa562ac4439c69e7d5764fa59013fb5aab321db8836e4f9db4834b0150d1c3c96
|
7
|
+
data.tar.gz: 6ac9d1e4d97870f26dbd28cad4dde0c556d9cb301cec0c3a78775b36db585026d8249e852b71482c5fb65f81ecc2e6702580f776a6a8f8d24ca12f62bc8e8dde
|
data/CHANGELOG.md
CHANGED
data/lib/neovim/ruby_provider.rb
CHANGED
@@ -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,
|
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,
|
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
|
-
|
78
|
-
|
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
|
-
|
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.
|
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]
|
data/lib/neovim/version.rb
CHANGED
@@ -72,13 +72,23 @@ RSpec.describe "ruby_provider" do
|
|
72
72
|
}.from(Dir.pwd)
|
73
73
|
end
|
74
74
|
|
75
|
-
it "handles
|
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', '
|
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
|
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
|
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, '
|
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.
|
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-
|
11
|
+
date: 2017-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|