Language support for Flecs Script, the runtime interpreted DSL of the Flecs Entity Component System for defining scenes, assets and configuration.
Features
- Syntax highlighting for
.flecsfiles:- Keywords (
using,with,template,prop,mut,const,if,else,for,in,match,new,export,include,module,fn,await,try,catch,script,prefab,slot) - Type definitions (
struct Position(x: f32, y: f32),enum Color(Red, Green, Blue),bitmask) - Primitive types (
bool,char,u8–u64,i8–i64,f32,f64,string,entity,id, ...) - Components, tags, pairs
(Rel, Tgt), inheritance (entity : Prefab) andauto_override - Variables (
$var,$shorthand) and string interpolation ("$var","{expr}") - Annotations (
@brief,@color,@uuid,@tree, ...) - Line and block comments, numbers (including hex and binary), multiline strings
- Keywords (
- Code completion:
- Keywords, primitive types and builtin tags/relationships
- Builtin functions and constants (
flecs.script.core,flecs.script.math) - Entity methods after
.(name(),path(),parent(),has(),doc_*()) - Annotations after
@ - Variables after
$(scanned fromconst/prop/mutdeclarations in the document) - Components, templates and entities declared in the document
- Hover documentation for keywords, builtin functions and types
- Snippets for common constructs (
struct,template,prefab,for,match, ...) - Bracket matching, auto-closing pairs, auto-indentation and comment toggling
Example
struct Position(x: f32, y: f32)
template Tree {
prop height = 10
Trunk {
Position: {0, $height / 2}
}
}
prefab SpaceShip {
MaxSpeed: {value: 100}
}
my_spaceship : SpaceShip {
Position: {x: 10, y: 20}
}
for i in 0..10 {
"tree_$i" {
Tree: {height: $i + 5}
}
}
License
MIT