LuaLS / LuaLS/lua-language-server

Priority for function definitions in external files over local script

オープン
#3,106 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、language server が重複する関数定義をどのように解決するか、またワークスペース設定がどのように宣言され読み取られるかを追跡します。qlua.d.lua と local-script の例を再現し、新しい設定によって hover のドキュメントが外部定義を使用する一方で、デフォルトでは現在の動作が維持されることを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
lua
領域
devtools
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
活発
明瞭さ
おおむね明確
初心者へのやさしさ
48/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。