Skip to main content

Overview

The format section controls how the language server formats Lua files. Use a built-in preset, customize individual style rules, or delegate formatting to an external tool like StyLua.

Top-level options


Presets


External formatter

Delegate all formatting to an external tool:
.gluarc.json
GLuaLS passes the file contents through stdin. The formatter writes the result to stdout.

Style overrides

styleOverrides keys use snake_case matching the EmmyLuaCodeStyle style. They are applied on top of the selected preset.
This page shows common settings. For the complete list, inspect the JSON schema at crates/glua_code_analysis/resources/schema.json under EmmyrcFormatStyleOverrides.

Basic

Space

Operator space

Alignment

Indent

Line spacing

These keys accept string expressions: "keep", "fixed(n)", "min(n)", "max(n)".

Line break

Preference


VS Code extension settings

GLuaLS does not provide gluals.format.* VS Code settings. Configure formatting through .gluarc.json. You can enable format-on-save with these built-in VS Code settings:

Example

.gluarc.json