It's currently possible to add a port file to s:repl_portfiles that doesn't have a connection key (ie. when trying to eval something in a project that still has an old .nrepl-port in it).
Unfortunately, there's a couple places that expect that connection key to be there, leading to a Vim(call):E716: Key not present in Dictionary: connect) error on any subsequent eval, even if the REPL does get started.
This pull fixes this behaviour by only adding an entry into s:repl_portfiles after successfully connecting to the REPL.
An alternative fix would have been to guard each of those dictionary accesses with has_key(..., 'connection') but then the port file would get registered once and then would never get tried again, even after the REPL has started. The solution submitted above makes more sense to me.
It's currently possible to add a port file to
s:repl_portfiles
that doesn't have aconnection
key (ie. when trying to eval something in a project that still has an old.nrepl-port
in it).Unfortunately, there's a couple places that expect that
connection
key to be there, leading to aVim(call):E716: Key not present in Dictionary: connect)
error on any subsequent eval, even if the REPL does get started.This pull fixes this behaviour by only adding an entry into
s:repl_portfiles
after successfully connecting to the REPL.An alternative fix would have been to guard each of those dictionary accesses with
has_key(..., 'connection')
but then the port file would get registered once and then would never get tried again, even after the REPL has started. The solution submitted above makes more sense to me.