Plenary's global `busted` definitions get picked up by LuaLS
还没有人认领这个 Issue。
评估
调研方向
Start by locating Plenary's bundled busted implementation and the global assignments it exposes, then reproduce how LuaLS indexes those definitions. Decide on a solution that prevents the bundled globals from being selected while preserving existing plugin behavior; done means real busted definitions are used for navigation without breaking Plenary tests.
由索引模型根据 Issue 内容生成。
描述
Hello.
Plenary has its own implementation of busted, and just like the real busted it defines a bunch of global variables. This is a problem when using LuaLS because these definitions will be added to the global namespace even if I never require their source file because LuaLS sees a global assignment and adds the variable regardless of whether the file is ever sourced. I use the real busted for my tests, so this means that jumping to the definition will jump to the wrong functions.
How can we fix this? I can think of two solutions:
- Use string variables and indices to assign to
_G, i.e. instead ofdescribe = mod.describeuselocal name = 'describe'; _G[name] = mod.describe, this will stop the language server from adding the definition. - Move the plenary busted functionality to a separate plugin that plugin authors can
packaddbefore running tests. Then I don't have to install the plenary busted plugin and everything is fine.
Personally I think the second option would be better because it does not disrupt any existing plugins that depend on it, but it is a bit uglier in the code. What do you think? Any other idea?
- 主要语言
- Lua
- 星标
- 3.5k
- 派生
- 340
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
我们还没有检查这个项目的环境配置文件。先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
nvim-lua/plenary.nvim 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 88/100
nvim-lua/plenary.nvim#682 ·
-
难度 1/5 1 小时以内 新手友好度 72/100
nvim-lua/plenary.nvim#680 ·
-
难度 2/5 1-3 小时 新手友好度 45/100
nvim-lua/plenary.nvim#675 ·
-
难度 4/5 3-5 天 新手友好度 28/100
nvim-lua/plenary.nvim#672 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 25/100
nvim-lua/plenary.nvim#671 · 1 条评论 ·
查看 nvim-lua/plenary.nvim 的全部 Issue
相似的 Issue
-
Unconfirmed bug
难度 1/5 1 小时以内 新手友好度 88/100
luanti-org/luanti#17605 · 1 条评论 ·
维护者通常 2 天内回复
-
agent-in-progress agent-research-recommend enhancement
难度 2/5 1-3 小时 新手友好度 78/100
codymikol/multiverse.nvim#337 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 2 天内回复
-
bug good first issue
难度 2/5 1-3 小时 新手友好度 78/100
nickjvandyke/opencode.nvim#336 ·
-
needs-triage
难度 2/5 1-3 小时 新手友好度 84/100
coder/claudecode.nvim#321 ·