LuaLS / LuaLS/lua-language-server
[Question] Large size type annotation file cause low performance. Is it possible to fix it?
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 4.4k
- Forks
- 442
- PR merge metrics
- No merged PRs in 30d
Description
In my project I have a special Lua file used to give type hint, it defines many field such as:
```
---@class UnityEngine.TransitionType
---@field Normal UnityEngine.TransitionType
---@field Entry UnityEngine.TransitionType
---@field Exit UnityEngine.TransitionType
UnityEngine.TransitionType = {}
---@class UnityEngine.StateInfoIndex
---@field CurrentState UnityEngine.StateInfoIndex
---@field NextState UnityEngine.StateInfoIndex
---@field ExitState UnityEngine.StateInfoIndex
---@field InterruptedState UnityEngine.StateInfoIndex
UnityEngine.StateInfoIndex = {}
--- ...more below
```
It contains all type using in my project so it's very large (about 5000KB), and caused low diagnostic speed when LLS runs.
Is it possible to optimize performance for those special type annotation file? Or I have to simplify this Lua file.
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
Reproduce the slowdown with the reported 5,000 KB Lua type-annotation file and compare diagnostic speed against a smaller file. Trace the diagnostic path that processes the annotations; done means the large-file case has substantially improved performance without losing type information.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- devtools, performance
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100