nvim-neorocks / rocks-config.nvim

Allow rocks.nvim to help configure your plugins.
GNU General Public License v3.0
55 stars 2 forks source link

perf: only search `package.preloaded` and `package.path` for configs #16

Closed mrcjkb closed 4 months ago

mrcjkb commented 5 months ago

require searches the package.path, the package.cpath, Neovim's runtimepath, etc . It has a total of 6 loaders. To load conigs in lua/<plugins_dir>/lua, we only need the first 2 loaders:

See also: https://pgl.yoyo.org/luai/i/package.loaders

I doubt this has any measurable impact, but it's cleaner than pcall(require, ...) and analysing the error message.

Note: I haven't directly tested this in rocks-config.nvim, but I've tested the logic on modules in my lua directory.

github-actions[bot] commented 5 months ago

Review Checklist

Does this PR follow the Contribution Guidelines? Following is a partial checklist:

Proper conventional commit scoping:

If applicable:

vhyrro commented 4 months ago

LGTM!