lua-language-server
                                
                                 lua-language-server copied to clipboard
                                
                                    lua-language-server copied to clipboard
                            
                            
                            
                        Adding global definitions always indents with 4 spaces
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
- Have a global in your file
- Have a .luarc.json file in your project
- Have the LSP complain about it being global
- Use the VSC action to mark it as defined
Additional Notes
Log
No response
I have the same issue: the extension always indents 4 spaces instead of 2 although all settings are set to use 2 spaces.
I already disabled the Lua.diagnostics.globals in settings to map the behavior to your description, but without any luck.
Still it indents 4 spaces.
One extension that handles this well AND sorts the entries that get added A-Z is https://github.com/streetsidesoftware/vscode-spell-checker/
I also have the same issue :(
Same issue. This has been extremely frustrating for me and I finally tracked it down to the extension I least wanted to be causing it.
edit: perhaps my issue is slightly different. I use tab indents and if I have, say, 3 lines of indented code, then I put my cursor at the end of the middle line and press enter, it converts the middle line to 4 a space indentation. It happens for me without any regard to globals.