No autocomplete for the "submodules" of a library when those included from init.lua
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 52/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- lua
调研方向
从提供的 init.lua 模块和 rockspec 开始,然后使用所示的 workspace.library 设置在 LuaLS 中复现两种 require 模式。跟踪动态 require 路径的解析方式,以及返回的表字段如何获得类型;当 ui. 为 init.lua 导出的模块提供已知且带类型的字段时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Dear developers, I've read similar existing issues but didn't find the answer.
I have a library (which I am the developer of) which has this structure:
and init.lua is
local UI = (...) .. '.'
return {
Block = require(UI .. 'Block'),
Image = require(UI .. 'Image'),
Label = require(UI .. 'Label'),
Layout = require(UI .. 'Layout'),
Rectangle = require(UI .. 'Rectangle'),
Stack = require(UI .. 'Stack'),
ImageButton = require(UI .. 'ImageButton'),
TextField = require(UI .. 'TextField'),
utils = require(UI .. 'utils')
}
and the rockspec contains this:
build = {
type = 'builtin',
modules = {
['likelihud'] = 'likelihud/init.lua',
['likelihud.Block'] = 'likelihud/Block.lua',
['likelihud.Image'] = 'likelihud/Image.lua',
['likelihud.Label'] = 'likelihud/Label.lua',
['likelihud.Layout'] = 'likelihud/Layout.lua',
['likelihud.Rectangle'] = 'likelihud/Rectangle.lua',
['likelihud.Stack'] = 'likelihud/Stack.lua',
['likelihud.ImageButton'] = 'likelihud/ImageButton.lua',
['likelihud.TextField'] = 'likelihud/TextField.lua',
['likelihud.utils'] = 'likelihud/utils.lua',
},
}
So after install I have
Coc-config:
{
"suggest.noselect": true,
"Lua.workspace.library" : [
"/usr/local/share/lua/5.1"
]
}
The problem
If I write
local Button = require('likelihud.ImageButton')
I get autocomplete for Button.
But if instead I do
local ui = require('likelihud')
I get only those fields when I do ui., but the fields are unknown. :
So the problem LSP doesn't resolve this (...) .. '.' inside init.lua. Should I somehow change how init.lua provides those files or how to fix that ?
- 主要语言
- Lua
- 星标
- 4.4k
- 派生
- 442
- 平均合并
- 8 天 9 小时
- 30 天内合并 PR
- 1
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
LuaLS/lua-language-server 的其他 Issue
-
enhancement
难度 2/5 1-3 小时 新手友好度 62/100
LuaLS/lua-language-server#1776 ·
-
难度 3/5 1-2 天 新手友好度 65/100
LuaLS/lua-language-server#3463 · 5 条评论 ·
-
难度 4/5 3-5 天 新手友好度 55/100
LuaLS/lua-language-server#3461 ·
-
难度 3/5 1-2 天 新手友好度 68/100
LuaLS/lua-language-server#3460 · 1 条评论 · 1 个 reaction ·
-
难度 3/5 1-2 天 新手友好度 68/100
LuaLS/lua-language-server#3459 · 1 个 reaction ·
查看 LuaLS/lua-language-server 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
-
bug
难度 2/5 1-3 小时 新手友好度 68/100
LandSandBoat/server#11579 ·
-
难度 2/5 1-3 小时 新手友好度 76/100
ArchiveTeam/sinavideo-grab#7 · 3 个 reaction ·
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
mailcow/mailcow-dockerized#7480 ·
-
mapper bug
难度 2/5 1-3 小时 新手友好度 88/100