A syntax-highlighting package for GDScript, the scripting language used by the Godot game engine. Targets GDScript 2.0 (Godot 4) while keeping Godot 3 keywords highlighted so older projects still look right.
Works with Sublime Text 4 (Build 4000+).
.sublime-syntaxv2 grammar covering:#comments and##documentation comments- Single, double, triple, raw (
r"..."),StringName(&"...") andNodePath(^"...") string literals - Integer, float, hex (
0xff), binary (0b1010) and underscore-separated numeric literals - All control-flow, declaration, modifier, and operator keywords
- Annotations (
@tool,@export,@onready,@rpc,@warning_ignore, …) - Function definitions with parameter types, default values, and return types
class/class_name/extendshighlighted as class declarationsenum,signal,var,constdeclarations- Built-in types (
Vector2,Dictionary,PackedByteArray, …) and built-in functions (print,lerp,clamp, …) - Node-path sugar:
$Node,$Parent/Child,$"Quoted Name",%UniqueName - Lambdas (
func(...): ...) andmatch/whenguards
- Comment toggling with Ctrl+/ (
#) - Python-style auto-indent after
: - Goto Symbol (Ctrl+R) lists functions, classes, and signals
- Tab-based indentation by default, matching the official GDScript style guide
- A handful of snippets:
ready,process,physics,input,class,export,onready
Not yet on Package Control. Use Option 2 for now.
- Download
GDScript.sublime-package. - In Sublime Text, open the menu Preferences → Browse Packages…
- Navigate up one level, then into the
Installed Packagesfolder. - Drop
GDScript.sublime-packageinto that folder. - Restart Sublime Text.
- Preferences → Browse Packages…
- Copy the entire
GDScriptfolder (with all the files in this repo) into thePackagesdirectory. - Restart Sublime Text.
Open any .gd file (or tests/sample.gd in this package) and confirm the bottom-right of the Sublime status bar shows GDScript. If it shows something else, switch with View → Syntax → GDScript.
To override per-syntax settings, open a .gd file and choose Preferences → Settings — Syntax Specific. The defaults can be found in GDScript.sublime-settings.
Colour mapping uses standard TextMate scopes (keyword.control, support.type, entity.name.function, variable.annotation, etc.), so every Sublime colour scheme will produce reasonable output. The annotation scope (variable.annotation) is also used by some Python packages, so @export will pick up whatever your theme uses for decorators.
GDScript/
├── GDScript.sublime-syntax # the grammar
├── GDScript.sublime-settings # default editor settings for .gd files
├── Comments.tmPreferences # Ctrl+/ uses '#'
├── Indentation Rules.tmPreferences
├── Symbol List - Function.tmPreferences
├── Symbol List - Class.tmPreferences
├── Symbol List - Signal.tmPreferences
├── snippets/
│ ├── ready.sublime-snippet
│ ├── process.sublime-snippet
│ ├── physics_process.sublime-snippet
│ ├── input.sublime-snippet
│ ├── class.sublime-snippet
│ ├── export.sublime-snippet
│ └── onready.sublime-snippet
├── tests/
│ └── sample.gd
└── README.md