Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Indentation when formatting off for values inside square brackets

Open
#3,460 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
68/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
lua
Domain
tooling

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.

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

  1. In the Defold Editor's text editor, in a Lua script file, type
local v = t[
    key(1)
]
  1. Run the document formatter function with Alt+Shift+F or from the top menu Edit > Format Document/Selection
  2. key(1) falls back to previous column
Additional Notes

No response

Log File

No response

Dominant language
Lua
Stars
4.4k
Forks
442
Avg merge
8d 9h
Merged PRs (30d)
1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from LuaLS/lua-language-server

All issues in LuaLS/lua-language-server

Similar issues

More Lua issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.