fix: runtimepath always updates lua package.path

This commit is contained in:
TJ DeVries
2020-07-13 17:20:22 -04:00
parent 602e7505e2
commit e797d0658c
3 changed files with 87 additions and 0 deletions

View File

@@ -543,6 +543,14 @@ static lua_State *nlua_enter(void)
return lstate;
}
/// Force an update of lua's package paths if runtime path has changed.
bool nlua_update_package_path(void)
{
lua_State *const lstate = nlua_enter();
return !!lstate;
}
static void nlua_print_event(void **argv)
{
char *str = argv[0];

View File

@@ -80,6 +80,7 @@
#ifdef WIN32
# include "nvim/os/pty_conpty_win.h"
#endif
#include "nvim/lua/executor.h"
#include "nvim/api/private/helpers.h"
#include "nvim/os/input.h"
#include "nvim/os/lang.h"
@@ -3344,6 +3345,10 @@ ambw_end:
if (!parse_winhl_opt(curwin)) {
errmsg = e_invarg;
}
} else if (varp == &p_rtp) { // 'runtimepath'
if (!nlua_update_package_path()) {
errmsg = (char_u *)N_("E970: Failed to initialize lua interpreter");
}
} else {
// Options that are a list of flags.
p = NULL;