neovim 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -1
- data/CHANGELOG.md +9 -3
- data/CODE_OF_CONDUCT.md +46 -0
- data/README.md +2 -2
- data/Rakefile +6 -6
- data/lib/neovim.rb +8 -7
- data/lib/neovim/api.rb +87 -0
- data/lib/neovim/buffer.rb +7 -1
- data/lib/neovim/client.rb +32 -6
- data/lib/neovim/event_loop.rb +114 -0
- data/lib/neovim/event_loop/connection.rb +78 -0
- data/lib/neovim/event_loop/message_builder.rb +127 -0
- data/lib/neovim/event_loop/serializer.rb +37 -0
- data/lib/neovim/host.rb +28 -28
- data/lib/neovim/logging.rb +41 -19
- data/lib/neovim/plugin/dsl.rb +6 -6
- data/lib/neovim/remote_object.rb +2 -2
- data/lib/neovim/ruby_provider.rb +8 -6
- data/lib/neovim/ruby_provider/vim.rb +2 -2
- data/lib/neovim/session.rb +42 -79
- data/lib/neovim/tabpage.rb +1 -1
- data/lib/neovim/version.rb +1 -1
- data/lib/neovim/window.rb +1 -1
- data/script/dump_api +4 -2
- data/script/generate_docs +2 -1
- data/spec/{integration → acceptance}/rplugin_autocmd_spec.vim +1 -1
- data/spec/{integration → acceptance}/rplugin_command_spec.vim +6 -2
- data/spec/{integration → acceptance}/rplugin_function_spec.vim +5 -2
- data/spec/{integration → acceptance}/ruby_spec.vim +18 -0
- data/spec/{integration → acceptance}/rubydo_spec.vim +0 -0
- data/spec/{integration → acceptance}/rubyfile/call_foo.rb +0 -0
- data/spec/{integration → acceptance}/rubyfile/curbuf_ivar_get.rb +0 -0
- data/spec/{integration → acceptance}/rubyfile/curbuf_ivar_set.rb +0 -0
- data/spec/{integration → acceptance}/rubyfile/define_foo.rb +0 -0
- data/spec/acceptance/rubyfile/nested.rb +1 -0
- data/spec/acceptance/rubyfile/nested_inner.rb +1 -0
- data/spec/{integration → acceptance}/rubyfile/raise_standard_error.rb +0 -0
- data/spec/{integration → acceptance}/rubyfile/raise_syntax_error.rb +0 -0
- data/spec/acceptance/rubyfile/ruby_interface.rb +8 -0
- data/spec/{integration → acceptance}/rubyfile/set_pwd_after.rb +0 -0
- data/spec/{integration → acceptance}/rubyfile/set_pwd_before.rb +0 -0
- data/spec/{integration → acceptance}/rubyfile_spec.vim +9 -0
- data/spec/acceptance/runtime/init.vim +8 -0
- data/spec/acceptance/runtime/rplugin.vim +37 -0
- data/spec/{integration → acceptance}/runtime/rplugin/ruby/autocmds.rb +1 -1
- data/spec/{integration → acceptance}/runtime/rplugin/ruby/commands.rb +9 -1
- data/spec/{integration → acceptance}/runtime/rplugin/ruby/functions.rb +9 -1
- data/spec/{integration → acceptance}/runtime/vader.vim/autoload/vader.vim +0 -0
- data/spec/{integration → acceptance}/runtime/vader.vim/autoload/vader/assert.vim +0 -0
- data/spec/{integration → acceptance}/runtime/vader.vim/autoload/vader/helper.vim +0 -0
- data/spec/{integration → acceptance}/runtime/vader.vim/autoload/vader/parser.vim +0 -0
- data/spec/{integration → acceptance}/runtime/vader.vim/autoload/vader/syntax.vim +0 -0
- data/spec/{integration → acceptance}/runtime/vader.vim/autoload/vader/window.vim +0 -0
- data/spec/{integration → acceptance}/runtime/vader.vim/plugin/vader.vim +0 -0
- data/spec/acceptance_spec.rb +74 -0
- data/spec/helper.rb +2 -32
- data/spec/neovim/api_spec.rb +59 -0
- data/spec/neovim/buffer_spec.rb +161 -2
- data/spec/neovim/client_spec.rb +18 -4
- data/spec/neovim/event_loop/connection_spec.rb +63 -0
- data/spec/neovim/event_loop/message_builder_spec.rb +105 -0
- data/spec/neovim/event_loop/serializer_spec.rb +63 -0
- data/spec/neovim/event_loop_spec.rb +81 -0
- data/spec/neovim/host/loader_spec.rb +0 -1
- data/spec/neovim/host_spec.rb +130 -161
- data/spec/neovim/logging_spec.rb +77 -5
- data/spec/neovim/session_spec.rb +54 -127
- data/spec/neovim/window_spec.rb +46 -0
- metadata +81 -81
- data/lib/neovim/session/api.rb +0 -95
- data/lib/neovim/session/event_loop.rb +0 -100
- data/lib/neovim/session/notification.rb +0 -19
- data/lib/neovim/session/request.rb +0 -31
- data/lib/neovim/session/rpc.rb +0 -95
- data/lib/neovim/session/serializer.rb +0 -62
- data/spec/integration/ruby_buffer_spec.rb +0 -151
- data/spec/integration/ruby_vim_spec.rb +0 -27
- data/spec/integration/ruby_window_spec.rb +0 -56
- data/spec/integration/runtime/init.vim +0 -9
- data/spec/integration_spec.rb +0 -119
- data/spec/neovim/session/api_spec.rb +0 -70
- data/spec/neovim/session/event_loop_spec.rb +0 -152
- data/spec/neovim/session/notification_spec.rb +0 -20
- data/spec/neovim/session/request_spec.rb +0 -36
- data/spec/neovim/session/rpc_spec.rb +0 -120
- data/spec/neovim/session/serializer_spec.rb +0 -62
@@ -1,36 +0,0 @@
|
|
1
|
-
require "helper"
|
2
|
-
|
3
|
-
module Neovim
|
4
|
-
class Session
|
5
|
-
RSpec.describe Request do
|
6
|
-
let(:serializer) { double(:serializer) }
|
7
|
-
let(:reqid) { 1 }
|
8
|
-
let(:request) { Request.new(:method, ["arg"], serializer, reqid) }
|
9
|
-
|
10
|
-
it "has readers" do
|
11
|
-
expect(request.method_name).to eq("method")
|
12
|
-
expect(request.arguments).to eq(["arg"])
|
13
|
-
end
|
14
|
-
|
15
|
-
describe "#sync?" do
|
16
|
-
it "is true" do
|
17
|
-
expect(request.sync?).to be(true)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
describe "#respond" do
|
22
|
-
it "writes an RPC response to serializer" do
|
23
|
-
expect(serializer).to receive(:write).with([1, reqid, nil, "val"])
|
24
|
-
request.respond("val")
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe "#error" do
|
29
|
-
it "writes an RPC error response to serializer" do
|
30
|
-
expect(serializer).to receive(:write).with([1, reqid, "err", nil])
|
31
|
-
request.error("err")
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,120 +0,0 @@
|
|
1
|
-
require "helper"
|
2
|
-
|
3
|
-
module Neovim
|
4
|
-
class Session
|
5
|
-
RSpec.describe RPC do
|
6
|
-
shared_context "rpc behavior" do
|
7
|
-
it "receives requests" do
|
8
|
-
serializer = Serializer.new(event_loop)
|
9
|
-
rpc = RPC.new(serializer)
|
10
|
-
|
11
|
-
server_thread = Thread.new do
|
12
|
-
client = server.accept
|
13
|
-
client.write(
|
14
|
-
MessagePack.pack(
|
15
|
-
[0, 123, "func", [1, 2, 3]]
|
16
|
-
)
|
17
|
-
)
|
18
|
-
end
|
19
|
-
|
20
|
-
request = nil
|
21
|
-
rpc.run do |msg|
|
22
|
-
request = msg
|
23
|
-
rpc.shutdown
|
24
|
-
end
|
25
|
-
|
26
|
-
server_thread.join
|
27
|
-
|
28
|
-
expect(request).to be_a(Request)
|
29
|
-
expect(request.method_name).to eq("func")
|
30
|
-
expect(request.arguments).to eq([1, 2, 3])
|
31
|
-
end
|
32
|
-
|
33
|
-
it "receives notifications" do
|
34
|
-
serializer = Serializer.new(event_loop)
|
35
|
-
rpc = RPC.new(serializer)
|
36
|
-
|
37
|
-
server_thread = Thread.new do
|
38
|
-
client = server.accept
|
39
|
-
client.write(
|
40
|
-
MessagePack.pack(
|
41
|
-
[2, "func", [1, 2, 3]]
|
42
|
-
)
|
43
|
-
)
|
44
|
-
end
|
45
|
-
|
46
|
-
notification = nil
|
47
|
-
rpc.run do |message|
|
48
|
-
notification = message
|
49
|
-
rpc.shutdown
|
50
|
-
end
|
51
|
-
|
52
|
-
server_thread.join
|
53
|
-
|
54
|
-
expect(notification).to be_a(Notification)
|
55
|
-
expect(notification.method_name).to eq("func")
|
56
|
-
expect(notification.arguments).to eq([1, 2, 3])
|
57
|
-
end
|
58
|
-
|
59
|
-
it "receives responses to requests" do
|
60
|
-
serializer = Serializer.new(event_loop)
|
61
|
-
rpc = RPC.new(serializer)
|
62
|
-
request = nil
|
63
|
-
|
64
|
-
server_thread = Thread.new do
|
65
|
-
client = server.accept
|
66
|
-
request = client.readpartial(1024)
|
67
|
-
|
68
|
-
client.write(
|
69
|
-
MessagePack.pack(
|
70
|
-
[1, 0, [0, "error"], "result"]
|
71
|
-
)
|
72
|
-
)
|
73
|
-
end
|
74
|
-
|
75
|
-
error, result = nil
|
76
|
-
rpc.request("func", 1, 2, 3) do |err, res|
|
77
|
-
error, result = err, res
|
78
|
-
rpc.shutdown
|
79
|
-
end.run
|
80
|
-
|
81
|
-
expect(error).to eq("error")
|
82
|
-
expect(result).to eq("result")
|
83
|
-
|
84
|
-
server_thread.join
|
85
|
-
rpc.shutdown
|
86
|
-
|
87
|
-
expect(request).to eq(
|
88
|
-
MessagePack.pack([0, 0, "func", [1, 2, 3]])
|
89
|
-
)
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
context "tcp" do
|
94
|
-
let!(:server) { TCPServer.new("0.0.0.0", 0) }
|
95
|
-
let!(:event_loop) { EventLoop.tcp("0.0.0.0", server.addr[1]) }
|
96
|
-
|
97
|
-
include_context "rpc behavior"
|
98
|
-
end
|
99
|
-
|
100
|
-
context "unix" do
|
101
|
-
let!(:server) { UNIXServer.new(Support.socket_path) }
|
102
|
-
let!(:event_loop) { EventLoop.unix(Support.socket_path) }
|
103
|
-
|
104
|
-
include_context "rpc behavior"
|
105
|
-
end
|
106
|
-
|
107
|
-
describe "#run" do
|
108
|
-
it "logs exceptions" do
|
109
|
-
serializer = instance_double(Serializer)
|
110
|
-
rpc = RPC.new(serializer)
|
111
|
-
|
112
|
-
expect(serializer).to receive(:run).and_raise("BOOM")
|
113
|
-
expect(rpc).to receive(:fatal).with(/BOOM/)
|
114
|
-
|
115
|
-
rpc.run
|
116
|
-
end
|
117
|
-
end
|
118
|
-
end
|
119
|
-
end
|
120
|
-
end
|
@@ -1,62 +0,0 @@
|
|
1
|
-
require "socket"
|
2
|
-
require "helper"
|
3
|
-
|
4
|
-
module Neovim
|
5
|
-
class Session
|
6
|
-
RSpec.describe Serializer do
|
7
|
-
shared_context "serializer behavior" do
|
8
|
-
it "sends and receives data" do
|
9
|
-
serializer = Serializer.new(event_loop)
|
10
|
-
request = nil
|
11
|
-
|
12
|
-
server_thread = Thread.new do
|
13
|
-
client = server.accept
|
14
|
-
request = client.readpartial(1024)
|
15
|
-
|
16
|
-
client.write(MessagePack.pack(["res"]))
|
17
|
-
client.close
|
18
|
-
server.close
|
19
|
-
end
|
20
|
-
|
21
|
-
response = nil
|
22
|
-
serializer.write(["req"]).run do |message|
|
23
|
-
response = message
|
24
|
-
serializer.shutdown
|
25
|
-
end
|
26
|
-
|
27
|
-
server_thread.join
|
28
|
-
expect(request).to eq(MessagePack.pack(["req"]))
|
29
|
-
expect(response).to eq(["res"])
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
context "tcp" do
|
34
|
-
let!(:server) { TCPServer.new("0.0.0.0", 0) }
|
35
|
-
let!(:event_loop) { EventLoop.tcp("0.0.0.0", server.addr[1]) }
|
36
|
-
|
37
|
-
include_context "serializer behavior"
|
38
|
-
end
|
39
|
-
|
40
|
-
context "unix" do
|
41
|
-
let!(:server) { UNIXServer.new(Support.socket_path) }
|
42
|
-
let!(:event_loop) { EventLoop.unix(Support.socket_path) }
|
43
|
-
|
44
|
-
include_context "serializer behavior"
|
45
|
-
end
|
46
|
-
|
47
|
-
describe "#run" do
|
48
|
-
it "logs exceptions" do
|
49
|
-
unpacker = instance_double(MessagePack::Unpacker)
|
50
|
-
event_loop = instance_double(EventLoop)
|
51
|
-
serializer = Serializer.new(event_loop, unpacker)
|
52
|
-
|
53
|
-
expect(event_loop).to receive(:run).and_yield("data")
|
54
|
-
expect(unpacker).to receive(:feed_each).with("data").and_raise("BOOM")
|
55
|
-
expect(serializer).to receive(:fatal).with(/BOOM/)
|
56
|
-
|
57
|
-
serializer.run
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|