neovim 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: 3699ba73810bb643b4a8412a6469d6c0ec95fb138248e4f9a391b7637681cb06
4
- data.tar.gz: 9d4e6c4513864df909a791eb23420918fe0426aeeb8d2f2929e6d52cb2b2f48e
2
+ SHA1:
3
+ metadata.gz: 97582ab6b5d7a61143cc0d0e3e1a5ffec8b6c292
4
+ data.tar.gz: 1b6c5905f2c870f4fd77490a144a32337f0eef11
5
5
  SHA512:
6
- metadata.gz: bf087be0814ddb1a5d765e84e462991bccef0ba8135691da379a22393d3743dcbef9cd65307f54cdbb16a8a87e5ccca72c7dbc845714b3035818f2f2108f121c
7
- data.tar.gz: e5b78dde7090c6ade20a1869ffacee5f3e1cefdd764be149a6db81fe2f3564c26f570f99b9f048ed3eb1fe9b8f5119febfa11fc01d42bad93a21f9a52caffda0
6
+ metadata.gz: 01f995a41e2ece2e05228762b8e0d9ca36428bbf6bf896eb388e19b34869ede4d972395d5300381e4f4706e0426bafc6f82f0abd053aab4fa157b232db190f15
7
+ data.tar.gz: e55008b53e7d042c631032455be96e81715256b1c2763c98f23a7891b44b89e88c1e4a449232bba9716a280844766c03666e346bc2943e6b025b9fc12a6234e8
data/.gitignore CHANGED
@@ -5,6 +5,7 @@
5
5
  .config
6
6
  .yardoc
7
7
  Gemfile.lock
8
+ VimFlavor.lock
8
9
  InstalledFiles
9
10
  _yardoc
10
11
  coverage
@@ -17,5 +18,6 @@ test/tmp
17
18
  test/version_tmp
18
19
  tmp
19
20
  spec/workspace
20
- spec/acceptance/runtime/rplugin.vim
21
+ spec/acceptance/runtime/flavors
22
+ spec/acceptance/runtime/rplugin_manifest.vim
21
23
  vendor/bundle
@@ -0,0 +1,118 @@
1
+ AllCops:
2
+ Exclude:
3
+ - _neovim/**/*
4
+ - spec/acceptance/**/*
5
+ - vendor/**/*
6
+ - script/**/*
7
+
8
+ Layout/EndOfLine:
9
+ EnforcedStyle: lf
10
+
11
+ Layout/SpaceAroundEqualsInParameterDefault:
12
+ EnforcedStyle: no_space
13
+
14
+ Layout/SpaceInsideHashLiteralBraces:
15
+ EnforcedStyle: no_space
16
+
17
+ Lint/AmbiguousBlockAssociation:
18
+ Exclude:
19
+ - spec/**/*
20
+
21
+ Lint/HandleExceptions:
22
+ Exclude:
23
+ - lib/neovim/ruby_provider.rb
24
+ - lib/neovim/logging.rb
25
+ - lib/neovim/connection.rb
26
+ - lib/neovim/line_range.rb
27
+
28
+ Lint/RescueException:
29
+ Exclude:
30
+ - lib/neovim/host.rb
31
+
32
+ Lint/UnderscorePrefixedVariableName:
33
+ Exclude:
34
+ - lib/neovim/ruby_provider.rb
35
+
36
+ Lint/UselessAccessModifier:
37
+ Exclude:
38
+ - lib/neovim/buffer.rb
39
+ - lib/neovim/client.rb
40
+
41
+ Lint/Void:
42
+ Exclude:
43
+ - lib/neovim/window.rb
44
+
45
+ Metrics/AbcSize:
46
+ Max: 20
47
+
48
+ Metrics/BlockLength:
49
+ Exclude:
50
+ - spec/**/*
51
+
52
+ Metrics/ClassLength:
53
+ Max: 500
54
+
55
+ Metrics/LineLength:
56
+ Max: 125
57
+
58
+ Metrics/MethodLength:
59
+ Max: 50
60
+
61
+ Metrics/ModuleLength:
62
+ Exclude:
63
+ - spec/**/*
64
+
65
+ Metrics/ParameterLists:
66
+ Max: 6
67
+
68
+ Naming/AccessorMethodName:
69
+ Exclude:
70
+ - lib/neovim/client.rb
71
+
72
+ Security/Eval:
73
+ Exclude:
74
+ - lib/neovim/ruby_provider.rb
75
+
76
+ Style/BlockComments:
77
+ Exclude:
78
+ - lib/neovim/buffer.rb
79
+ - lib/neovim/client.rb
80
+ - lib/neovim/tabpage.rb
81
+ - lib/neovim/window.rb
82
+
83
+ Style/ConditionalAssignment:
84
+ EnforcedStyle: assign_inside_condition
85
+ IncludeTernaryExpressions: false
86
+
87
+ Style/DoubleNegation:
88
+ Enabled: false
89
+
90
+ Style/FormatStringToken:
91
+ EnforcedStyle: unannotated
92
+
93
+ Style/GlobalVars:
94
+ Exclude:
95
+ - lib/neovim/ruby_provider/vim.rb
96
+ - spec/neovim/ruby_provider/vim_spec.rb
97
+
98
+ Style/ParallelAssignment:
99
+ Enabled: false
100
+
101
+ Style/RescueStandardError:
102
+ EnforcedStyle: implicit
103
+
104
+ Style/SpecialGlobalVars:
105
+ EnforcedStyle: use_perl_names
106
+
107
+ Style/StringLiterals:
108
+ EnforcedStyle: double_quotes
109
+
110
+ Style/SymbolArray:
111
+ EnforcedStyle: brackets
112
+
113
+ Style/WordArray:
114
+ EnforcedStyle: brackets
115
+
116
+ Style/ZeroLengthPredicate:
117
+ Exclude:
118
+ - lib/neovim/ruby_provider.rb
@@ -13,7 +13,7 @@ rvm:
13
13
  - ruby-head
14
14
 
15
15
  before_install:
16
- - eval "$(curl -Ss https://raw.githubusercontent.com/neovim/bot-ci/master/scripts/travis-setup.sh) nightly-x64"
16
+ - eval "$(curl --connect-timeout 30 --retry 3 -Ss https://raw.githubusercontent.com/neovim/bot-ci/master/scripts/travis-setup.sh) nightly-x64"
17
17
  - gem update --system
18
18
  - gem update bundler
19
19
  - bundle --version
@@ -1,3 +1,8 @@
1
+ # 0.7.1
2
+
3
+ - Fix `uninitialized constant Neovim::RubyProvider::StringIO`
4
+ - Various backwards-compatible style changes to satisfy Rubocop rules
5
+
1
6
  # 0.7.0
2
7
 
3
8
  - Drop support for Ruby < 2.2.0, update syntax accordingly
data/Rakefile CHANGED
@@ -1,27 +1,40 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "rspec/core/rake_task"
3
+ require "rubocop/rake_task"
3
4
 
4
- desc "Generate Neovim remote API docs"
5
- task :docs do
6
- sh File.expand_path("../script/generate_docs", __FILE__)
7
- end
8
-
9
- desc "Dump nvim remote API"
10
- task :api do
11
- sh File.expand_path("../script/dump_api", __FILE__)
12
- end
5
+ RuboCop::RakeTask.new(:style)
13
6
 
14
7
  namespace :spec do
15
8
  desc "Run functional specs"
16
- RSpec::Core::RakeTask.new(:functional) do |t|
17
- t.exclude_pattern = "spec/acceptance_spec.rb,spec/acceptance/**/*"
18
- end
9
+ RSpec::Core::RakeTask.new(:functional)
19
10
 
20
11
  desc "Run acceptance specs"
21
- RSpec::Core::RakeTask.new(:acceptance) do |t|
22
- t.pattern = "spec/acceptance_spec.rb"
23
- t.rspec_opts = "--format documentation"
12
+ task acceptance: "acceptance:deps" do
13
+ run_script(:run_acceptance, "--reporter", "dot", "spec/acceptance")
14
+ end
15
+
16
+ namespace :acceptance do
17
+ desc "Install acceptance spec dependencies"
18
+ task :deps do
19
+ sh "bundle exec vim-flavor update --vimfiles-path=spec/acceptance/runtime"
20
+ end
24
21
  end
25
22
  end
26
23
 
27
- task default: ["spec:functional", "spec:acceptance"]
24
+ namespace :docs do
25
+ desc "Generate Neovim remote API docs"
26
+ task :generate do
27
+ run_script(:generate_docs)
28
+ end
29
+
30
+ desc "Validate generated documentation is up-to-date"
31
+ task :validate do
32
+ run_script(:validate_docs)
33
+ end
34
+ end
35
+
36
+ task default: [:style, "spec:functional", "spec:acceptance", "docs:validate"]
37
+
38
+ def run_script(script_name, *args)
39
+ ruby File.expand_path("../script/#{script_name}.rb", __FILE__), *args
40
+ end
@@ -0,0 +1 @@
1
+ flavor "thinca/vim-themis", branch: "master"
@@ -2,11 +2,13 @@ version: '{build}'
2
2
 
3
3
  environment:
4
4
  matrix:
5
+ - RUBY_VERSION: 25
5
6
  - RUBY_VERSION: 24
6
7
  - RUBY_VERSION: 23
7
8
  - RUBY_VERSION: 22
8
9
 
9
10
  install:
11
+ - set SSL_CERT_FILE=C:/ruby24-x64/ssl/cert.pem
10
12
  - set PATH=C:\Ruby%RUBY_VERSION%\bin;C:\tools\neovim\Neovim\bin;%PATH%
11
13
  - set NVIM_RUBY_LOG_LEVEL=DEBUG
12
14
  - set NVIM_RUBY_LOG_FILE=%cd%\ci.log
@@ -32,7 +32,7 @@ module Neovim
32
32
 
33
33
  # Truncate the output of inspect so console sessions are more pleasant.
34
34
  def inspect
35
- "#<#{self.class}:0x%x @channel_id=#{@channel_id.inspect} @types={...} @functions={...}>" % (object_id << 1)
35
+ format("#<#{self.class}:0x%x @channel_id=#{@channel_id.inspect}>", object_id << 1)
36
36
  end
37
37
 
38
38
  private
@@ -67,6 +67,7 @@ module Neovim
67
67
  end
68
68
  end
69
69
 
70
+ # @api private
70
71
  class Function
71
72
  attr_reader :name
72
73
 
@@ -55,7 +55,7 @@ module Neovim
55
55
  # @return [String]
56
56
  def [](index)
57
57
  check_index(index)
58
- @lines[index-1]
58
+ @lines[index - 1]
59
59
  end
60
60
 
61
61
  # Set the given line (1-indexed).
@@ -65,7 +65,7 @@ module Neovim
65
65
  # @return [String]
66
66
  def []=(index, str)
67
67
  check_index(index)
68
- @lines[index-1] = str
68
+ @lines[index - 1] = str
69
69
  end
70
70
 
71
71
  # Delete the given line (1-indexed).
@@ -74,7 +74,7 @@ module Neovim
74
74
  # @return [void]
75
75
  def delete(index)
76
76
  check_index(index)
77
- @lines.delete(index-1)
77
+ @lines.delete(index - 1)
78
78
  nil
79
79
  end
80
80
 
@@ -100,9 +100,7 @@ module Neovim
100
100
  #
101
101
  # @return [String, nil]
102
102
  def line
103
- if active?
104
- @session.request(:nvim_get_current_line)
105
- end
103
+ @session.request(:nvim_get_current_line) if active?
106
104
  end
107
105
 
108
106
  # Set the current line of an active buffer.
@@ -110,18 +108,14 @@ module Neovim
110
108
  # @param str [String]
111
109
  # @return [String, nil]
112
110
  def line=(str)
113
- if active?
114
- @session.request(:nvim_set_current_line, str)
115
- end
111
+ @session.request(:nvim_set_current_line, str) if active?
116
112
  end
117
113
 
118
114
  # Get the current line number of an active buffer.
119
115
  #
120
116
  # @return [Integer, nil]
121
117
  def line_number
122
- if active?
123
- @session.request(:nvim_get_current_win).get_cursor[0]
124
- end
118
+ @session.request(:nvim_get_current_win).get_cursor[0] if active?
125
119
  end
126
120
 
127
121
  # Determine if the buffer is active.
@@ -134,9 +128,7 @@ module Neovim
134
128
  private
135
129
 
136
130
  def check_index(index)
137
- if index < 0
138
- raise ArgumentError, "Index out of bounds"
139
- end
131
+ raise ArgumentError, "Index out of bounds" if index < 0
140
132
  end
141
133
 
142
134
  public
@@ -30,15 +30,15 @@ module Neovim
30
30
 
31
31
  # Intercept method calls and delegate to appropriate RPC methods.
32
32
  def method_missing(method_name, *args)
33
- if func = @api.function_for_object_method(self, method_name)
33
+ if (func = @api.function_for_object_method(self, method_name))
34
34
  func.call(@session, *args)
35
35
  else
36
36
  super
37
37
  end
38
38
  end
39
39
 
40
- # Extend +respond_to?+ to support RPC methods.
41
- def respond_to?(method_name, *)
40
+ # Extend +respond_to_missing?+ to support RPC methods.
41
+ def respond_to_missing?(method_name, *)
42
42
  super || rpc_methods.include?(method_name.to_sym)
43
43
  end
44
44
 
@@ -17,12 +17,11 @@ module Neovim
17
17
  new(socket, socket)
18
18
  end
19
19
 
20
- def self.child(_argv)
21
- argv = _argv.include?("--embed") ? _argv : _argv + ["--embed"]
20
+ def self.child(argv)
21
+ argv = argv.include?("--embed") ? argv : argv + ["--embed"]
22
22
 
23
- io = ::IO.popen(argv, "rb+").tap do |_io|
24
- Process.detach(_io.pid)
25
- end
23
+ io = ::IO.popen(argv, "rb+")
24
+ Process.detach(io.pid)
26
25
 
27
26
  new(io, io)
28
27
  end
@@ -50,10 +49,10 @@ module Neovim
50
49
  end
51
50
  end
52
51
 
53
- def register_type(id, &block)
52
+ def register_type(id)
54
53
  @unpacker.register_type(id) do |data|
55
54
  index = MessagePack.unpack(data)
56
- block.call(index)
55
+ yield index
57
56
  end
58
57
  end
59
58
 
@@ -67,15 +67,15 @@ module Neovim
67
67
  write(:notification, method, args)
68
68
  end
69
69
 
70
- def run(&callback)
70
+ def run
71
71
  @running = true
72
72
 
73
73
  loop do
74
- break if !@running
74
+ break unless @running
75
75
  break if @shutdown
76
76
 
77
77
  begin
78
- callback.call(read)
78
+ yield read
79
79
  rescue EOFError => e
80
80
  log_exception(:debug, e, __method__)
81
81
  shutdown
@@ -1,4 +1,5 @@
1
1
  module Neovim
2
+ # Object representing the `nvim` executable.
2
3
  class Executable
3
4
  VERSION_PATTERN = /\ANVIM v?(.+)$/
4
5
 
@@ -31,9 +31,9 @@ module Neovim
31
31
  def handle(message)
32
32
  log(:debug) { message.to_h }
33
33
 
34
- @handlers.
35
- fetch(message.method_name, default_handler).
36
- call(@client, message)
34
+ @handlers
35
+ .fetch(message.method_name, default_handler)
36
+ .call(@client, message)
37
37
  rescue Exception => e
38
38
  log_exception(:error, e, __method__)
39
39
 
@@ -43,22 +43,22 @@ module Neovim
43
43
  @client.err_writeln("Exception handling #{message.method_name}: (#{e.class}) #{e.message}")
44
44
  end
45
45
 
46
- raise unless StandardError === e
46
+ raise unless e.is_a?(StandardError)
47
47
  end
48
48
 
49
49
  private
50
50
 
51
51
  def poll_handler
52
- @poll_handler ||= -> (_, req) {
52
+ @poll_handler ||= lambda do |_, req|
53
53
  initialize_client(req.id)
54
54
  initialize_plugins
55
55
 
56
56
  @session.respond(req.id, "ok")
57
- }
57
+ end
58
58
  end
59
59
 
60
60
  def specs_handler
61
- @specs_handler ||= -> (_, req) {
61
+ @specs_handler ||= lambda do |_, req|
62
62
  source = req.arguments.fetch(0)
63
63
 
64
64
  if @specs.key?(source)
@@ -66,14 +66,14 @@ module Neovim
66
66
  else
67
67
  @session.respond(req.id, nil, "Unknown plugin #{source}")
68
68
  end
69
- }
69
+ end
70
70
  end
71
71
 
72
72
  def default_handler
73
- @default_handler ||= -> (_, message) {
73
+ @default_handler ||= lambda do |_, message|
74
74
  next unless message.sync?
75
75
  @session.respond(message.id, nil, "Unknown request #{message.method_name}")
76
- }
76
+ end
77
77
  end
78
78
 
79
79
  def initialize_client(request_id)
@@ -93,12 +93,12 @@ module Neovim
93
93
  end
94
94
 
95
95
  def wrap_plugin_handler(handler)
96
- -> (client, message) {
96
+ lambda do |client, message|
97
97
  args = message.arguments.flatten(1)
98
98
  result = handler.call(client, *args)
99
99
 
100
100
  @session.respond(message.id, result) if message.sync?
101
- }
101
+ end
102
102
  end
103
103
  end
104
104
  end