aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/vim.c
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2021-09-28 13:51:26 +0200
committerBjörn Linse <bjorn.linse@gmail.com>2021-10-17 16:21:42 +0200
commitea2023f689ad8f368faad6e52c85fbc9762a7296 (patch)
tree2e96efb7d71a8f3624af3924d6f28829a0e5e8df /src/nvim/api/vim.c
parentf19dc0608161622f7786eb3cddee27d086cc3ea3 (diff)
downloadrneovim-ea2023f689ad8f368faad6e52c85fbc9762a7296.tar.gz
rneovim-ea2023f689ad8f368faad6e52c85fbc9762a7296.tar.bz2
rneovim-ea2023f689ad8f368faad6e52c85fbc9762a7296.zip
fix(runtime): don't use regexes inside lua require'mod'
Fixes #15147 and fixes #15497. Also sketch "subdir" caching. Currently this only caches whether an rtp entry has a "lua/" subdir but we could consider cache other subdirs potentially or even "lua/mybigplugin/" possibly. Note: the async_leftpad test doesn't actually fail on master, at least not deterministically (even when disabling the fast_breakcheck throttling). It's still useful as a regression test for further changes and included as such.
Diffstat (limited to 'src/nvim/api/vim.c')
-rw-r--r--src/nvim/api/vim.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index 44552bcb26..847e142939 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -756,6 +756,11 @@ ArrayOf(String) nvim_list_runtime_paths(Error *err)
return nvim_get_runtime_file(NULL_STRING, true, err);
}
+Array nvim__runtime_inspect(void)
+{
+ return runtime_inspect();
+}
+
/// Find files in runtime directories
///
/// 'name' can contain wildcards. For example
@@ -794,6 +799,25 @@ String nvim__get_lib_dir(void)
return cstr_as_string(get_lib_dir());
}
+/// Find files in runtime directories
+///
+/// @param pat pattern of files to search for
+/// @param all whether to return all matches or only the first
+/// @param options
+/// is_lua: only search lua subdirs
+/// @return list of absolute paths to the found files
+ArrayOf(String) nvim__get_runtime(Array pat, Boolean all, Dict(runtime) *opts, Error *err)
+ FUNC_API_SINCE(8)
+ FUNC_API_FAST
+{
+ bool is_lua = api_object_to_bool(opts->is_lua, "is_lua", false, err);
+ if (ERROR_SET(err)) {
+ return (Array)ARRAY_DICT_INIT;
+ }
+ return runtime_get_named(is_lua, pat, all);
+}
+
+
/// Changes the global working directory.
///
/// @param dir Directory path