perf: Lazily require adapter mappings #70
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Because
vim.fn.exepath
can potentially be very slow if the searched for executable cannot be found, loading every adapter mapping at startup is not ideal. This change moves the adapter mappings into their own files and then lazily requires them fromlua/mason-nvim-dap/mappings/adapters/init.lua
.While looking for non existing adapters on cluttered paths will still be slow this will avoid looking until they are needed. Which should usually mean that not all of them are searched for at startup but also that uninstalled adapters will probably not be looked for that often (given that users hopefully aren't in the habit of setting up DAP adapters they have not installed).
Users on none cluttered or slow paths will probably also see a small improvement in startup times as the system calls searching for just one non existing executable will almost certainly take more time than any additional overhead created from splitting up the adapter mappings.
Related Issues: #69 #67