LuaLS / LuaLS/lua-language-server
Process types/annotations in a file but not it's actual content
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 4.4k
- Forks
- 442
- PR merge metrics
- No merged PRs in 30d
Description
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)
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?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the behavior with a large returned table listed in Lua.workspace.ignoreDir, then compare it with the reported effects of @meta, @diagnostic disable, and @return table. Trace how ignored files and annotations are processed after the file is closed. Done means a file can retain its exported type information while avoiding analysis and diagnostics for its actual content.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100