Skip to content

New Formatter #998

@CppCXY

Description

@CppCXY

The current formatter is not directly integrated into emmylua_ls for use. It is currently distributed as a binary, and you can use it by configuring it as an external tool.

The current version is still quite rudimentary. After receiving sufficient feedback, I will continue improving the formatter and officially release it in the May 1st version, integrating it into emmylua_ls as the default formatter.

Download cli from https://github.com/EmmyLuaLs/emmylua-analyzer-rust/actions/runs/23744280571
config in .emmyrc.json:

{
  "format": {
    "externalTool": {
      "program": "path/to/luafmt",
      "args": [
        "--stdin"
      ]
    }
  }
}

config style in .luafmt.toml:

[layout]
max_line_width = 100
table_expand = "Auto"
call_args_expand = "Auto"
func_params_expand = "Auto"

[output]
quote_style = "Preserve"
trailing_table_separator = "Multiline"
single_arg_call_parens = "Preserve"

config docs see: https://github.com/EmmyLuaLs/emmylua-analyzer-rust/blob/main/docs/emmylua_formatter/options_EN.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions