A godot/gdscript formatter and linter extension for VSCode. It uses GDScript-formatter by GDQuest.
This extension provides:
- Formatting: Standard VSCode formatter capabilities including format command and autoformatting on save
- Linting: Highlights style and convention issues in your GDScript files
The linter runs automatically when you save a file and displays warnings and errors inline with your code.
This extension ships with the gdscript formatter binary for your specific platform at version 0.18.2 and uses it by default.
If you want to provide your own binary, you can retrieve the one for your platform here. You can either add it to your system's PATH for autodiscovery or specify the path to the executable in the extension settings (see below). If the binary is added to PATH, make sure to remove the version tag, platform and architecture from the filename, e.g. rename gdscript-formatter-0.17.0-windows-x86_64.exe to gdscript-formatter.exe or gdscript-formatter-0.17.0-linux-aarch64 to gdscript-formatter. Then disable the useBuiltInBinary setting.
This extension supports the following settings:
godotFormatter.enable: Enable/disable formatting with this extensiongodotFormatter.useBuiltInBinary: Whether to use the built-in formatter binary that ships with the extension.godotFormatter.gdscriptFormatterPath:The path to the gdscript formatter executable. Leave this empty if it's in your system's PATH. If using PATH, make sure to remove the architecture/platform suffix if you copied the binary from the releases page. Only used if useBuiltInBinary is false.godotFormatter.useSpaces: Whether to use spaces. If disabled will use tabs.godotFormatter.indentSize: How many spaces to use for indentation. This is only used ifuseSpacesis enabledgodotFormatter.reorderCode:Whether to allow reordering code blocks, like exported variables vs constants etc. This only applies if safe mode is disabled.godotFormatter.safe: Whether to enable safe mode. Safe mode tries to preserve existing syntax and structure where possible and otherwise does not format the file. If this enabled,reorderCodeis ignored. Slightly less performant.godotFormatter.enableLinter: Enable/disable linting with this extensiongodotFormatter.linterMaxLineLength: Configure the maximum line length for the liner. Default: 100.godotFormatter.linterIgnoredRules: Comma-separated list of rules to ignore.- See the GDScript-formatter README for a full list of rules
- NOTE: Rules can also be ignored with a
# gdlint-ignore-next-line (rules)above a line or# gdlint-ignore (rules)next to a line.
None so far
See changelog
- Run
get-binary.sh (architecture)- See versions here
- Supported architectures:
linux-x86_64linux-aarch64windows-x86_64windows-aarch64macos-x86_64macos-aarch64
- This places the binary at
binaries/gdscript-formatter
- Run
npm install - Run
npx @vscode/vsce package- This will generate a
.vsixfile at the root of this project - Install the
.vsixfrom the VSCode extension menu
- This will generate a
Alternatively if you are using VSCode for development you can run the extension in debug mode from VSCode's built-in "Run and Debug" dialog.