34. Documentation
IDE Support
Editor Support via LSP
Braid provides editor support through the braid-lsp Language Server Protocol implementation, built in Rust under tools/bstudio/braid-lsp/. It communicates over stdio using JSON-RPC.
File Types
| Extension | Purpose |
|---|---|
.br | Braid source file (compilable module) |
.bd | Braid script file (runnable without explicit main) |
.bx | Braid bytecode (compiled binary artifact) |
Syntax Highlighting
Braid syntax is similar to C-style languages with Python-like keywords. A TextMate grammar is available. Key highlighting categories include:
- Keywords:
fn,let,struct,enum,match,diameter,model - Decorators:
@autograd,@layer,@param - Types:
int,float,bool,string,tensor - Literals: numbers, strings, booleans, nil
- Comments:
//line comments,/* */block comments,#hash comments
Configuring VSCode
To use braid-lsp with VSCode, create a .vscode/settings.json in your project:
{'{'}
"braidLsp.path": "/path/to/braid-lsp",
"braidLsp.enabled": true,
"files.associations": {'{'}
"*.br": "braid",
"*.bd": "braid",
"*.bx": "braid-bytecode"
{'}'}
{'}'}Add a braid-language-configuration.json for bracket matching, auto-closing, and comment toggling. For Neovim, use the built-in LSP client:
lua << EOF
vim.api.nvim_create_autocmd('FileType', {'{'}
pattern = 'braid',
callback = function()
vim.lsp.start({'{'}
name = 'braid-lsp',
cmd = {'/path/to/braid-lsp'}
{'}'})
end
{'}'})
EOF