Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(plugin): Make the local_spec check reject similar config module names #1524

Closed
wants to merge 2 commits into from

Conversation

pynappo
Copy link

@pynappo pynappo commented Jun 16, 2024

Fixes a bug found by a user on r/neovim introduced by e2e10d9 where a modname such as user.lazy.lualine would match the local_spec check for .lazy.lua.

I've modified the check to account for modnames such as user.lazy.lualine and plugins.lazy.lua. Although while I was doing this, I was wondering if the spec should store a psuedo-private bool about being a local_spec or not instead? I didn't want to make the diff too big though and this seems performant enough to me so I'm just submitting this for now.

(e.g. config modules named `lazy.lualine`, `user.lazy.lua`, etc. will
not be treated as local specs)
A valid local import spec never has `spec.import == M.LOCAL_SPEC`
because by the time we do the check, we know that `find_local_spec()`
succeeded (if it didn't, the spec:cond() check would have failed). Thus
we only need to check if the modname ends with `'/' .. M.LOCAL_SPEC`.
@folke folke closed this in be5dfba Jun 16, 2024
@folke
Copy link
Owner

folke commented Jun 16, 2024

Thank you for reporting!
I've changed it so that it no longer needs to check for certain modnames

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants