luafmt rewrites spacing in doc type expressions (`fns (fun…)[]` → `fns(fun…)[]`, `{…}[]` → `{…} []`, `-nil` → `- nil`)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 62/100
Research direction
The bug is in luafmt's handling of EmmyLua doc comments, so start by finding where the formatter treats ---@param, ---@return and ---@cast lines and their type expressions. Reproduce with the printf command in the issue and check each of the four spacing changes separately. Done means the three example inputs and the ---@class A : B and ---@type table -- why lines come out unchanged, with a test added for each.
Written by the indexing model from the issue text.
Description
luafmt rewrites spacing inside EmmyLua doc type expressions. emmylua_check reads the results the same way (verified), but they are harder to read and diverge from how these types are written everywhere else:
printf -- '---@param fns (fun(): integer)[] the racers\n---@return { x: string }[] r\n---@cast t -nil\n' | luafmt
Actual:
---@param fns(fun(): integer)[] the racers
---@return { x: string } [] r
---@cast t - nil
Expected: unchanged. In particular:
- the space between a parameter name and a parenthesized type is removed (
fns (fun…)→fns(fun…)); - an array suffix on a table literal type is split off (
{ … }[]→{ … } []); ---@cast x -nilbecomes- nil.
Also observed: ---@class A : B → ---@class A: B, and -- inside a description after the type (---@type table -- why) → --why.
luafmt 0.25.1, default config.
- Dominant language
- Rust
- Stars
- 523
- Forks
- 104
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 21
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing 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.
More from EmmyLuaLs/emmylua-analyzer-rust
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
EmmyLuaLs/emmylua-analyzer-rust#1276 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
EmmyLuaLs/emmylua-analyzer-rust#1249 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
EmmyLuaLs/emmylua-analyzer-rust#1247 · 3 comments ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
EmmyLuaLs/emmylua-analyzer-rust#1016 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 53/100
EmmyLuaLs/emmylua-analyzer-rust#1308 ·
Maintainers usually reply within 1 day
All issues in EmmyLuaLs/emmylua-analyzer-rust
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
home-assistant/installer#308 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
swc-project/swc-next#1053 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
linebender/resvg#1179 · 1 comment ·
Maintainers usually reply within 2 days
-
enhancement triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
zizmorcore/zizmor#2468 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
Maintainers usually reply within 2 days