Method: Neovim::Connection#start

Defined in:
lib/neovim/connection.rb

#start(comm) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/neovim/connection.rb', line 36

def start comm
  comm.notify :nvim_set_client_info, comm.client_name, INFO.version_h, comm.client_type, comm.client_methods||{}, INFO.attributes
  channel_id, api_info = *(comm.request :nvim_get_api_info)
  @client = Client.new comm, channel_id
  prefixes = {}
  api_info[ "types"].each do |type,info|
    type = type.to_sym
    prefixes[ type] = info[ "prefix"]
    register_type type, info[ "id"]
  end
  @client.add_functions api_info[ "functions"], prefixes
  api_info[ "error_types"].each { |type,info|
    register_error type, info[ "id"]
  }
  if api_info["version"]["api_level"] < 13 then
    log :warn, "Using nvim_err_writeln() which is deprecated in since Neovim 0.11.0"
    @client.define_singleton_method :message_err do |msg|
      call_api :err_writeln, msg
    end
  end
  nil
end