Skip to main content

Overview

GLuaLS includes an opinionated Lua formatter. Format the current file with Shift+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:
Use the settings menu instead of editing the JSON file directly. This helps you avoid config mistakes.
.gluarc.json

Style overrides

Use styleOverrides to change individual rules within a preset:
Use the settings menu instead of editing the JSON file directly. This helps you avoid config mistakes.
.gluarc.json

Key style options

See Configuration: Formatting for the full list.

External formatter

Use an external formatting tool, such as stylua or GLuaFixer, instead of the built-in formatter:
Use the settings menu instead of editing the JSON file directly. This helps you avoid config mistakes.
.gluarc.json
The external formatter receives file content over stdin and must write the formatted result to stdout.

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