LuaLS / LuaLS/lua-language-server

editor.codeActionsOnSave with extension slows down file saving in VS Code

Open
#2,297 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Lua
Stars
4.4k
Forks
442
PR merge metrics
No merged PRs in 30d

Description

### How are you using the lua-language-server?

Visual Studio Code Extension (sumneko.lua)

### Which OS are you using?

Windows 11 Pro 22H2 22621.2134

### What is the issue affecting?

Other

### Expected Behaviour

I have a huge lua file with a ~3k lines in a big workspace folder with ~1k lua files.
I expect that the file is saved instantly, as it was before when I used Windows 10.

### Actual Behaviour

But a week ago I switched to Windows 11 and now I noticed that saving the file takes about 2 seconds.
**When the lua-language-server extension is disabled in VS Code, the file is saved instantly.**
I tried to set `Workspace Event - None` and disable Diagnostics but it didn't help

### Reproduction steps

1. Change large lua file
2. Press Ctrl+S
3. Wait 2 seconds before the extension allows VS Code to save the file to disk

### Additional Notes

I found a stall message
![изображение](https://github.com/LuaLS/lua-language-server/assets/7351599/f8d95ef9-15da-4565-9b80-dad140331048)
```
File saving "sv_player.lua": Getting the code action from "'Lua'"
([configure] (command:workbench.action.openSettings?%5B%22editor.codeActionsOnSave%22%5D)).
```

### Log File

_No response_

Contributor guide

Open the contributing guide

Research direction

No source file or test is named. Reproduce the delay in Visual Studio Code with the large Lua file and workspace described, then trace the extension's editor.codeActionsOnSave handling and the "Getting the code action" stall. Done means saving no longer incurs the reported delay with the extension enabled, with regression coverage for the scenario.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua, vscode
Domain
devtools, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.