Annotations in inline comments do not recognize others on the same line
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 45/100
Línea de trabajo
Reproduce el problema en VSCode usando los ejemplos de anotaciones inline de Lua del informe y, después, compara las anotaciones divididas entre varias líneas con varias anotaciones en una sola línea. Rastrea cómo el language server asocia anotaciones relacionadas, como genéricos, parámetros, valores de retorno, clases, campos y alias; se considera terminado cuando las anotaciones en la misma línea se interpretan de forma coherente con las anotaciones en líneas separadas.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
How are you using the lua-language-server?
Visual Studio Code Extension (sumneko.lua)
Which OS are you using?
Linux
What is the issue affecting?
Annotations, Type Checking
Expected Behaviour
Placing multiple annotations in inline comments like so works fine: the generics are interpreted correctly.
--[[@generic C]]
--[[@param any C]]
--[[@return C]]
local function exampleGeneric(any) return any end
So one would expect grouping them together on the same line (like this) would also work:
--[[@generic C]] --[[@param any C]] --[[@return C]]
local function exampleGeneric(any) return any end
Actual Behaviour
In the previous example, the generic seems to be defined, but doesn't carry over properly to the other two annotations. Similarly, adding a line break between the first and second annotation like this
--[[@generic C]]
--[[@param any C]] --[[@return C]]
local function exampleGeneric(any) return any end
allows the generic to be recognized by the second annotation, but not the third. This behavior is also visible in other annotations that require others to be nearby, such as with classes and fields, and aliases.
Reproduction steps
- Open VSCode
- Paste either of the following examples into an empty lua file:
--[[@class amazingClass]] --[[@field field1 string]] --[[@field field2 number]]
--[[@generic C]] --[[@param any C]] --[[@return C]]
local function exampleGeneric(any) return any end
Additional Notes
While I realize there is little practical use for some of these cases, such as the class definition (as it starts to take up a lot of horizontal space really quickly when defining new fields), this is especially useful when creating a plugin that allows for inline annotation definitions like the following:
local width: integer, height: integer = screen.width, screen.height
local logo: love.Image = textures["logo.png"]
which generates inline comments like so in order to preserve syntax coloring, as well as line numbers during runtime:
local width --[[@type integer ]], height --[[@type integer ]] = screen.width, screen.height
local logo --[[@type love.Image ]] = textures["logo.png"]
Log File
No response
- Lenguaje dominante
- Lua
- Estrellas
- 4.4k
- Forks
- 442
- Merge medio
- 8 d 9 h
- PR fusionados (30 d)
- 1
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de LuaLS/lua-language-server
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
LuaLS/lua-language-server#1776 ·
-
泛型for迭代器的类型推导漏掉了带__call的类 Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 65/100
LuaLS/lua-language-server#3463 · 5 comentarios ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
LuaLS/lua-language-server#3461 ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
LuaLS/lua-language-server#3460 · 1 comentario · 1 reacción ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
LuaLS/lua-language-server#3459 · 1 reacción ·
Todos los issues de LuaLS/lua-language-server
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
LandSandBoat/server#11579 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
ArchiveTeam/sinavideo-grab#7 · 3 reacciones ·
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
mailcow/mailcow-dockerized#7480 ·
-
Mapper: a failed area image export crashes Mudlet if the profile closed while it was running Abiertomapper bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100