lua-language-server icon indicating copy to clipboard operation
lua-language-server copied to clipboard

Cannot parse big files despite setting `preloadFileSize`

Open TracerDS opened this issue 2 years ago • 11 comments

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 image

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

  1. Install VSCode extension
  2. Go to a directory with huge lua files
  3. The warning pops up

Additional Notes

No response

Log File

No response

TracerDS avatar Nov 01 '23 19:11 TracerDS

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

sumneko avatar Nov 06 '23 03:11 sumneko

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?

TracerDS avatar Nov 06 '23 06:11 TracerDS

This is a precautionary measure. After loading a 10MB file, the language server will become very slow.

sumneko avatar Nov 06 '23 06:11 sumneko

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

TracerDS avatar Nov 06 '23 09:11 TracerDS

You can try modifying the restrictions yourself first.

sumneko avatar Nov 06 '23 09:11 sumneko

You can try modifying the restrictions yourself first.

by modifying source code? Thats not an easy nor flexible way

TracerDS avatar Nov 06 '23 09:11 TracerDS

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.

sumneko avatar Nov 06 '23 09:11 sumneko

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

TracerDS avatar Nov 06 '23 09:11 TracerDS

You can find the file at (Windows) <USER>\.vscode\extensions\sumneko.lua-3.7.0-win32-x64\server\script\files.lua

sumneko avatar Nov 06 '23 09:11 sumneko

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

TracerDS avatar Nov 06 '23 09:11 TracerDS

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.

sumneko avatar Nov 06 '23 09:11 sumneko