fix: stop luarocks server list from being overwritten #542
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.
The constants
DEFAULT_ROCKS_SERVERS
andDEFAULT_DEV_SERVERS
are tables and theget_servers
/get_dev_servers
can return these values meaning that the exact table instance will be returned, not a copy. This means that if the returned table instance is modified, the constants will also be modified. Theget_all_servers
function usesvim.list_extend
which will modify the table of the first argument and so theDEFAULT_ROCKS_SERVERS
list will continue to grow each time this function is called appending the dev servers each time.May want to consider returning a copy of the constant tables OR just note to never modify the returned table values
For some reason, this was actually causing an issue when trying to install some rocks because it would actually prioritize the luarocks manifest over the rocks-binaries server (even though it's supposed to prioritize in the reverse order of the table). Maybe the server list passed to the luarocks cli is too long and it defaults to using luarocks? Not sure, but I didn't spend any time to investigate why appending additional dev server strings to the server list would cause the rocks-binaries server to get skipped. Either way, this change fixed it for me and now the rocks-binaries server is being prioritized when doing
tree-sitter-...
package installs.