LuaLS / LuaLS/lua-language-server

Process types/annotations in a file but not it's actual content

Abierto
#2,426 4 comentarios 1 reacción 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

feat/diagnostics feat/type check
Lenguaje dominante
Lua
Estrellas
4.4k
Forks
442
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

I use Lua both as programming language and as file format for storing data and dynamicaly loading it into Lua enviroment. Usually this data is generated, saved and loaded during a single script execution. These files are pretty big and contain a single value of known type which is returned.
Since these files are huge, they shouldn't be processed in a usual manner. Thus, they should be put into Lua.workspace.ignoreDir list. However, in that case the type of returned value will not processed as well (actually, it is processed as long as the file is opened, but once it's closed, language server forgets its type. Here is an example of such behaviour. filters.lua is a big table of words that are to be filtered during text processing)
image
image
I tried to put ---@meta annotation in that file in hopes that contents of returned table would not be processed but they were which was unexpected. I tried to use ---@diagnostic disable annotation but it seems that the file still is being diagnosted. I also tried to put ---@return table annotation on top of the file (since each lua file is basically a function) but this annotation is ignored.
So right now, it seems that a file can be either ignored or processed entirely. Is there a way to somehow specify types in a file but disable all other processing of it?

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

Comienza reproduciendo el comportamiento con una tabla grande devuelta que figure en Lua.workspace.ignoreDir y compáralo después con los efectos reportados de @meta, @diagnostic disable y @return table. Rastrea cómo se procesan los archivos ignorados y las anotaciones después de cerrar el archivo. La tarea estará terminada cuando un archivo pueda conservar la información de tipos que exporta y, al mismo tiempo, evitar el análisis y los diagnósticos de su contenido real.

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

Evaluación

Stack tecnológico
lua
Área
devtools
Tipo de issue
Nueva funcionalidad
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.