LuaLS / LuaLS/lua-language-server

Doc export format requirements break auto-completion, and vice-versa

Offen
#2,935 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
Lua
Sterne
4.4k
Forks
442
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

How are you using the lua-language-server?

Visual Studio Code Extension (sumneko.lua)

Which OS are you using?

MacOS

What is the issue affecting?

Annotations, Completion, Hover, Other

Expected Behaviour

The format LLS expects to export documentation and handle autocompletion & hover should be the same. I'd like to export documentation from the same set of definition files I'm shipping as an Addon, and keeping them synced to the same source of truth seems the sensible way to go.

Actual Behaviour

This example is valid as far as documentation export, in that the JSON file generated as output contains references to the functions defined. However, this breaks tooltips/popovers/autocompletion, which require testLib to be defined and returned from this module to function:

---@meta cradle.basic.text

---This is test function 1.
---@param a number This is a number.
---@param b number This is another number.
---@return number This is the sum of a and b.
function testLib.add(a, b) end

---This is test function 2.
---@param a number This is a number.
---@param b number This is another number.
---@return number This is the difference of a and b.
function testLib.sub(a, b) end

Conversely, this other example allows tooltips/popovers/autocompletion to function properly, documentation generated via CLI seems to succeed with no errors, however the actual JSON containing the references is missing any reference to testLib entirely:

---@meta cradle.basic.text

local testLib = {}

---This is test function 1.
---@param a number This is a number.
---@param b number This is another number.
---@return number This is the sum of a and b.
function testLib.add(a, b) end

---This is test function 2.
---@param a number This is a number.
---@param b number This is another number.
---@return number This is the difference of a and b.
function testLib.sub(a, b) end

return testLib
Reproduction steps
  1. Save each of the two examples above as a Lua file somewhere
  2. Modify LLS config to include them
  3. Export documentation via CLI and try to require the library in the workspace
  4. Observe that depending on the example tested, either documentation exporting silently fails, or popovers don't work anymore
Additional Notes

No response

Log File

No response

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne damit, das Verhalten mit den beiden Lua-Beispielen im Issue zu reproduzieren: Exportiere die Dokumentation über die CLI, fordere anschließend jede Bibliothek in einem Workspace an und vergleiche Completion, Hover und generierte JSON-Referenzen. Verfolge die unterschiedliche Behandlung von Definitionen auf Modulebene und zurückgegebenen Tabellen; abgeschlossen ist die Aufgabe, wenn ein Quellformat sowohl den Dokumentationsexport als auch die Editorfunktionen unterstützt, ohne testLib stillschweigend zu verlieren.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
lua
Bereich
devtools
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.