Overview
GLuaLS includes an opinionated Lua formatter. Format the current file withShift+Alt+F (or right-click → Format Document).
Built-in presets
GLuaLS includes three presets for common GMod style choices:
Set the preset in
.gluarc.json:
.gluarc.json
Style overrides
UsestyleOverrides to change individual rules within a preset:
.gluarc.json
Key style options
See Configuration: Formatting for the full list.
External formatter
Use an external formatting tool, such asstylua or GLuaFixer, instead of the built-in formatter:
.gluarc.json
EditorConfig
GLuaLS can read.editorconfig indent settings. Those values can override matching styleOverrides entries based on your priority setting between .editorconfig and .gluarc.json.
Format on save
Enable format-on-save in VS Code:VS Code settings