Skip to content

Codegen: emitted lines have no width bound #276

Description

@Unisay

Problem

Found while linting pslua-generated Lua in a downstream application (OpenResty, with luacheck and lua-language-server). Cosmetic only: the code runs and passes luac -p. Re-confirmed on current main.

Line length is unbounded: the Golden.LongBindFlipped output has a single line of 3149 characters. The printer optimises for correctness (luac -p), not width, so long call chains and table literals print on one line. Downstream luacheck run with --max-line-length 130 (the value the ecosystem's own FFI CIs use) flags them.

Approach

If in scope, add a width-aware break for long call chains and table literals.

Prerequisites / Relations

None.

Verification / Measurement

luacheck with --max-line-length 130 passes on the golden outputs.

Open questions

Whether this is in scope at all: consumers can raise --max-line-length, so it may be wontfix by design. Lowest priority.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: codegenLua code generation / printingenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions