Flecs Script for Visual Studio Code
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
.flecs files:
- Keywords (
using, with, template, prop, const, if, else, for, in, match, new, export, include, module, fn, prefab, slot)
- Type definitions (
struct, enum, bitmask, member, constant, ...)
- Primitive types (
bool, char, u8–u64, i8–i64, f32, f64, string, entity, id, ...)
- Components, tags, pairs
(Rel, Tgt) and inheritance (entity : Prefab)
- Variables (
$var, $ shorthand) and string interpolation ("$var", "{expr}")
- Annotations (
@brief, @color, @tree, ...)
- Line and block comments, numbers (including hex), multiline strings
- 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 from const/prop declarations 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
using flecs.meta
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
| |