LuaLS / LuaLS/lua-language-server

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

Aperta
#2,426 4 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

feat/diagnostics feat/type check
Lingua principale
Lua
Stelle
4.4k
Fork
442
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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](https://github.com/LuaLS/lua-language-server/assets/61470425/353bbce1-c0ad-4660-b167-6ae0c457b8cf)
![image](https://github.com/LuaLS/lua-language-server/assets/61470425/eefa97bc-8b40-4f02-87d9-6b3831588786)
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?

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia riproducendo il comportamento con una grande tabella restituita elencata in Lua.workspace.ignoreDir, quindi confrontalo con gli effetti segnalati di @meta, @diagnostic disable e @return table. Traccia il modo in cui i file ignorati e le annotazioni vengono elaborati dopo la chiusura del file. Il lavoro è completo quando un file può conservare le informazioni sui tipi esportati evitando al contempo l’analisi e la diagnostica del suo contenuto effettivo.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
lua
Ambito
devtools
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.