LuaLS / LuaLS/lua-language-server
Priority for function definitions in external files over local script
還沒有人認領這個 Issue。
- 主要語言
- Lua
- 星號
- 4.4k
- 分支
- 442
- PR 合併指標
- 30 天內沒有已合併 PR
描述
Description:
When a function is defined both in an external file (e.g., qlua.d.lua) and in the local script, Lua Language Server prioritizes the local definition. This behavior makes it difficult to use external annotations and documentation for functions that are implemented locally.
Steps to reproduce:
Define a function in qlua.d.lua with annotations:
lua
Copy
---@param index number
---@return number|nil
function OnCalculate(index) end
Define the same function in the local script without annotations:
lua
Copy
function OnCalculate(index)
-- Implementation
end
Hover over the function in the local script.
Expected behavior:
Lua Language Server should prioritize the definition from qlua.d.lua for tooltips and documentation.
Actual behavior:
Lua Language Server uses the local definition, ignoring the one from qlua.d.lua.
Proposed solution:
Add an option to prioritize definitions from external files over local ones. For example, a setting like:
json
Copy
{
"Lua.workspace.prioritizeExternalDefinitions": true
}
VS Code
Ver: 1.98.0 (user setup)
Фиксация: 6609ac3d66f4eade5cf376d1cb76f13985724bcb
Data: 2025-03-04T21:06:18.612Z
Electron: 34.2.0
ElectronBuildId: 11044223
Chromium: 132.0.6834.196
Node.js: 20.18.2
V8: 13.2.152.36-electron.0
OS: Windows_NT x64 10.0.19045
LUA:
ID- sumneko.lua
Ver- 3.13.6
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
先追蹤語言伺服器如何解析重複的函式定義,以及工作區設定如何宣告和讀取。重現 qlua.d.lua 和 local-script 範例,然後確認新的設定會讓 hover 文件使用外部定義,同時預設保留目前的行為。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- lua
- 領域
- devtools
- Issue 類型
- 功能
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 活躍
- 描述清晰度
- 基本清楚
- 新手友好度
- 48/100