Editor support
Toolang provides syntax highlighting and editor integration through Tree-sitter. The following editors are supported through extensions or manual configuration.
Zed
The Toolang extension provides .too file detection, syntax highlighting, indentation, bracket matching, and an outline.
Clone the extension:
git clone --branch v0.4.0 --depth 1 https://github.com/openhat-ai/zed-toolang.gitIn Zed, run zed: install dev extension and select the cloned directory. Open a .too file to verify highlighting and the outline. Reload Zed if the file type is not recognized.
The extension's v0.4.0 release uses the corresponding Toolang 0.4.0 grammar.
Vim
Use the Toolang CLI to format the current file:
:write
:!too fmt %:S
:editTo check formatting without modifying the file:
:!too fmt --check %:S%:S shell-quotes the current filename. Save before formatting and reload afterward.
Neovim
Neovim supports Tree-sitter highlighting using the Toolang grammar.
Install the Tree-sitter CLI and a C compiler. Then clone the grammar:
npm install --global tree-sitter-cli@0.24.7
git clone --branch v0.4.0 --depth 1 https://github.com/openhat-ai/tree-sitter-toolang.git
cd tree-sitter-toolangBuild the parser and install its highlight queries:
mkdir -p ~/.config/nvim/parser ~/.config/nvim/queries/toolang
tree-sitter build -o ~/.config/nvim/parser/toolang.so
cp queries/highlights.scm ~/.config/nvim/queries/toolang/Add the following to your init.lua:
vim.filetype.add({ extension = { too = "toolang" } })
vim.api.nvim_create_autocmd("FileType", {
pattern = "toolang",
callback = function(args)
vim.treesitter.start(args.buf, "toolang")
end,
})Reopen a .too file and use :set filetype? to verify that Neovim recognizes toolang.
This configuration requires Neovim 0.9 or later and uses the default ~/.config/nvim directory. See Neovim's Tree-sitter documentation for custom parser and query paths.
The grammar is also distributed as tree-sitter-toolang on npm, PyPI, and Cargo. Use version 0.4.0 for Toolang 0.4 source. Installing a parser binding or the too CLI alone does not configure editor highlighting.