LuaLS / LuaLS/lua-language-server

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

Abierto
#2,935 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Lenguaje dominante
Lua
Estrellas
4.4k
Forks
442
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Empieza reproduciendo el comportamiento con los dos ejemplos de Lua del issue: exporta la documentación mediante la CLI, luego haz require de cada biblioteca en un workspace y compara la finalización, el hover y las referencias JSON generadas. Rastrea el tratamiento diferente de las definiciones a nivel de módulo y de las tablas devueltas; el trabajo estará terminado cuando un único formato de origen admita tanto la exportación de documentación como las funciones del editor sin perder testLib silenciosamente.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
lua
Área
devtools
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.