lua-language-server
lua-language-server copied to clipboard
Cannot parse big files despite setting `preloadFileSize`
How are you using the lua-language-server?
Visual Studio Code Extension (sumneko.lua)
Which OS are you using?
Windows
What is the issue affecting?
Diagnostics/Syntax Checking, Libraries, Plugins, Other
Expected Behaviour
Parse all files within the limits. If Lua.workspace.preloadFileSize is 1MB then parse all files up to 1MB.
Make it configurable
Actual Behaviour
For performance reasons, the parsing of this file has been stopped
This file weights 11.6 MB.
settings.json for the workspace Lua Server works in:
{
"Lua.codeLens.enable": true,
"Lua.runtime.version": "LuaJIT",
"Lua.workspace.preloadFileSize": 209715201,
"Lua.workspace.library": [
"D:\\MyPath\\libs"
],
"Lua.workspace.maxPreload": 10000
}
Reproduction steps
- Install VSCode extension
- Go to a directory with huge lua files
- The warning pops up
Additional Notes
No response
Log File
No response
10M is a hard limit, you can modify the source code if necessary:
https://github.com/LuaLS/lua-language-server/blob/4088f567051cb83b74e95b879f0c7543930d2918/script/files.lua#L235
10M is a hard limit, you can modify the source code if necessary:
https://github.com/LuaLS/lua-language-server/blob/4088f567051cb83b74e95b879f0c7543930d2918/script/files.lua#L235
why not make it editable via vsc settings?
This is a precautionary measure. After loading a 10MB file, the language server will become very slow.
This is a precautionary measure. After loading a 10MB file, the language server will become very slow.
for low-end PC's. That isnt an issue for better computers
You can try modifying the restrictions yourself first.
You can try modifying the restrictions yourself first.
by modifying source code? Thats not an easy nor flexible way
The source code is Lua and doesn't require compilation. I've also provided you with the location, so modifying it should be straightforward. I just suggest you try it out first, as it might change your mind.
The source code is Lua and doesn't require compilation. I've also provided you with the location, so modifying it should be straightforward. I just suggest you try it out first, as it might change your mind.
the limit might differ from the workspace. And I dont really know how to provide custom settings for vsc extensions (via coding I mean). So just a special setting would be great instead of editing the extension every time you go to other folder
You can find the file at (Windows) <USER>\.vscode\extensions\sumneko.lua-3.7.0-win32-x64\server\script\files.lua
Whats the issue with providing custom limit instead? Why are you so hesitant on it?
I think Im gonna create a PR to do it and copy code for the config
Because I believe the correct way to do things is to first validate with a quick method and test if there are any obvious issues with the idea, and then spend time packaging it into a formal feature and handling things like configuration files and translations. I'm just worried that if you do all of the latter work and find that the performance is unacceptable, you will have wasted your effort.