LuaLS / LuaLS/lua-language-server
Require paths not resolved when external library is loaded and using custom require path
未關閉
還沒有人認領這個 Issue。
- 主要語言
- Lua
- 星號
- 4.4k
- 分支
- 442
- PR 合併指標
- 30 天內沒有已合併 PR
描述
How are you using the lua-language-server?
NeoVim
Which OS are you using?
Windows
What is the issue affecting?
Completion, Hover, Libraries
Expected Behaviour
Hovering above lib should find lua/lib.lua.
Actual Behaviour
Hovering above lib yields 3 bytes, and only finds the path if either the file has not been loaded or no extra workspace library directory has been found.
Reproduction steps
- Setup the files:
-- lua/lib.lua
return {
test = "hello"
}
-- cmd/test.lua
local lib = require 'lib'
assert(lib.test == "hello")
-- .luarc.json
{
"runtime.path": [
"lua/?.lua",
"lua/?/init.lua"
],
"workspace.library": [
"${3rd}/love2d/library"
]
}
- Close NeoVim.
- Reopen NeoVim and open only the file
cmd/test.lua - Hover above lib and see bug.
- Open
lua/lib.lua - Go back to
cmd/test.lua - Completion is now available again.
Additional Notes
I could not reproduce this behaviour in VSCode.
Log File
Log file generated using the reproduction steps: https://pastebin.com/4VXMJjjB
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
使用 .luarc.json 搭配 lua/lib.lua 和 cmd/test.lua 重現此問題,依照列出的 NeoVim 步驟操作並檢查連結的日誌。追蹤外部程式庫載入後 custom runtime.path 和 workspace.library 的處理方式;完成的標準是在不先開啟 lua/lib.lua 的情況下,懸停和補全都能一致地解析 lib。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- lua
- 領域
- tooling
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100