This project provides Odin programming language support, featuring syntax highlighting and code navigation via Tree-sitter, along with Language Server capabilities like autocompletion, diagnostics, and more.
- Tree Sitter: tree-sitter-odin
- Language Server: @DanielGavin/ols
This extension automatically updates to the latest OLS (Odin Language Server) nightly build on each startup.
If you want to use a specific OLS version or a locally built binary, you can override the automatic download:
{
"lsp": {
"ols": {
"binary": {
"path": "/path/to/your/ols",
"arguments": []
}
}
}
}
You can customize OLS behavior if needed:
Add OLS configuration directly in your Zed settings.json
. This approach works project-wide and doesn't require additional files:
{
"lsp": {
"ols": {
"initialization_options": {
"enable_hover": true,
"enable_snippets": true,
"enable_procedure_snippet": true,
"enable_completion_matching": true,
"enable_references": true,
"enable_document_symbols": true,
"enable_format": true,
"enable_document_links": true,
"collections": [
{
"name": "core",
"path": "/path/to/Odin/core"
}
]
}
}
}
}
Note: Replace /path/to/Odin/core
with the actual path to your Odin installation's core library.
Alternatively, create an ols.json
file at the root of your workspace:
{
"$schema": "https://raw.githubusercontent.com/DanielGavin/ols/master/misc/ols.schema.json",
"collections": [
{
"name": "core",
"path": "/path/to/Odin/core"
}
],
"enable_hover": true,
"enable_snippets": true,
"enable_procedure_snippet": true,
"enable_completion_matching": true,
"enable_references": true,
"enable_document_symbols": true,
"enable_format": true,
"enable_document_links": true
}
enable_hover
: Shows detailed documentation when hovering over symbolsenable_snippets
: Provides code templates and snippetsenable_procedure_snippet
: Auto-adds parentheses after function names for better UXenable_completion_matching
: Enables type-aware completions that match argument typesenable_references
: Allows finding all references to symbolsenable_document_symbols
: Enables better outline/symbol navigationenable_format
: Enables code formatting support viaodinfmt
enable_document_links
: Enables clickable documentation linkscollections
: Defines library paths that OLS indexes for completions (critical for core library support)
To find your Odin installation path:
# macOS/Linux
which odin
# Then navigate to ../core from the Odin binary location
# Or check ODIN_ROOT environment variable
echo $ODIN_ROOT
For more configuration options, see the OLS documentation.
You can define custom code snippets to speed up your Odin development workflow.
- Open the command palette (
Cmd/Ctrl+Shift+P
) - Run
snippets: configure snippets
- Create or edit
odin.json
in the snippets directory - Add your snippets in JSON format
Example snippet:
{
"Main procedure": {
"prefix": "main",
"body": [
"package main",
"",
"import \"core:fmt\"",
"",
"main :: proc() {",
"\t$0",
"}"
],
"description": "Creates a main package with imports"
}
}
For detailed information about creating and using snippets, see Zed's snippet documentation.