Skip to content

Commit 4313958

Browse files
committed
add docs
1 parent 6a0ad54 commit 4313958

File tree

4 files changed

+60
-1
lines changed

4 files changed

+60
-1
lines changed

.luarc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json",
33
"workspace.library": [
4-
"assets"
4+
"assets/definitions"
55
],
66
"runtime.version": "Lua 5.4",
77
"hint.enable": false,

docs/src/SUMMARY.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
- [Callbacks](./Summary/callbacks.md)
1313
- [Script Systems](./ScriptSystems/introduction.md)
1414
- [Examples](./Examples/introduction.md)
15+
- [Scripting IDE Integrations](./ScriptTooling/summary.md)
16+
17+
# Script Tooling
18+
19+
- [Ladfiles](./ScriptTooling/summary.md)
1520

1621
# Script Pipeline
1722

docs/src/ScriptTooling/summary.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
## Ladfiles
2+
BMS provides a custom Language Agnostic Declaration format (LAD), which can be used to integrate with other tooling.
3+
4+
If you use `#[script_bindings]` macros, these files will magically contain your code comments, bindings as well as everything else required to drive other powerful integrations.
5+
6+
The declaration file is generated from the type registry and serves as a light abstraction layer simplifying the traversal of all
7+
available types and globals as well as functions.
8+
9+
You can customize how / where and if these files are stored using the main BMS plugin group:
10+
```rust,ignore
11+
app.add_plugins(BMSPlugin.set::<ScriptingFilesGenerationPlugin>(
12+
ScriptingFilesGenerationPlugin::new(
13+
true, // enabled, you can use a compilation feature to disable this here
14+
PathBuf::from("assets").join("definitions"),
15+
Some(PathBuf::from("bindings.lad.json")), // do also save the ladfile itself
16+
"Core BMS framework bindings",
17+
true,
18+
true,
19+
),
20+
));
21+
```
22+
23+
This plugin is only available when one of the sub features (like `lua_language_server_files`) mentioned in this chapter is enabled.
24+
25+
26+
You might not want to run this pipeline in your final binary, but rather bundle some of the generated files into some sort of development pack for modding. You can use compiler flags like `#[cfg(not(debug_assertions))]` to disable ladfile generation at runtime, or simply disable the lower level features within BMS to avoid compiling related dependencies too.
27+
28+
## Lua Language Server
29+
30+
<div class="Warning">
31+
This feature is in early stages, the definitions provide 90% of the way there, but there are rough edges that will need to be worked out
32+
</div>
33+
34+
[Luals](https://github.com/LuaLS/lua-language-server) or LLS, is an open source language server which integrates with many IDE's.
35+
36+
It is powered by lua specific annotation or definition files which BMS can generate directly from its own LADfiles.
37+
38+
To enable this simply enable the `lua_language_server_files` feature, and a `bindings.lua` definition file will be generated in the LADfile output directory in the `Startup` schedule.
39+
40+
Script writers can then use this generated file by pointing their `.luarc.json` file to these definitions:
41+
```json
42+
{
43+
"$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json",
44+
"workspace.library": [
45+
"assets/definitions"
46+
],
47+
"runtime.version": "Lua 5.4",
48+
"hint.enable": false,
49+
}
50+
```
51+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Scripting IDE Integrations
2+
3+
See the [script tooling](../ScriptTooling/summary.md) section to find out more about how BMS integrates with other tooling to make scripting easier.

0 commit comments

Comments
 (0)