LuaLS / LuaLS/lua-language-server

Indentation when formatting off for values inside square brackets

未关闭
#3,460 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
Lua
星标
4.4k
派生
442
PR 合并指标
30 天内没有已合并 PR

描述

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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

使用 Lua 代码片段和 Format Document 命令在 Defold 的内置文本编辑器中重现该问题,然后跟踪处理方括号内表达式的 LuaLS 格式化路径。完成标准是格式化保留 key(1) 前的缩进,包括在链接的 Defold 重现中。

由索引模型根据 Issue 内容生成。

评估

技术栈
lua
领域
tooling
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
活跃
描述清晰度
基本清楚
新手友好度
68/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。