LuaLS / LuaLS/lua-language-server
Indentation when formatting off for values inside square brackets
Nobody has claimed this yet.
- 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?
Other (Defold's built-in text editor)
Which OS are you using?
Linux (also happens on other platforms)
What is the issue affecting?
Formatting
Expected Behaviour
Hello, thank you for LuaLS!
There is a small issue that we have found when formatting a Lua file and indentation;
local v = t[
key(1)
]
Actual Behaviour
This is how the formatter leaves it;
local v = t[
key(1)
]
Reproduction steps
https://github.com/defold/defold/pull/12995
- In the Defold Editor's text editor, in a Lua script file, type
local v = t[
key(1)
]
- Run the document formatter function with
Alt+Shift+For from the top menuEdit > Format Document/Selection key(1)falls back to previous column
Additional Notes
No response
Log File
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue in Defold's built-in text editor using the Lua snippet and the Format Document command, then trace the LuaLS formatting path that handles expressions inside square brackets. Done means formatting preserves the indentation before key(1), including in the linked Defold reproduction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100