LuaLS / LuaLS/lua-language-server
Adding global definitions always indents with 4 spaces
- Dominant language
- Lua
- Stars
- 4.4k
- Forks
- 442
- PR merge metrics
- No merged PRs in 30d
Description
### Which OS are you using?
Windows
### Expected Behaviour
When I use the VSCode function to define a variable as allowed global, it should re-use the formatting of the existing file (luarc.json) when adding it.
### Actual Behaviour
It always uses 4 spaces, instead of the 2 the file uses.
### Reproduction steps
1. Have a global in your file
2. Have a .luarc.json file in your project
3. Have the LSP complain about it being global
4. Use the VSC action to mark it as defined
### Additional Notes


### Log
_No response_
Contributor guide
Research direction
Start by tracing the VSCode action that adds an allowed global to .luarc.json, then inspect how the existing file's indentation is read or preserved. Reproduce the issue with a file using two-space indentation and confirm that marking a global as defined keeps that formatting rather than inserting four spaces.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua, vscode
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100