odoo-lsp
Features
Completion, definition and references for models, XML IDs and model fields
Works for record
s, template
s, env.ref()
and other structures.
Browse models and XML records as workspace symbols
For more features check out the wiki.
Install
The VSCode extension handles downloading the latest releases automatically; other editors need odoo-lsp
on the path. Nightly binaries are also available for major platforms, please check Releases for the latest downloads.
# One-line
wget -qO- "https://github.com/Desdaemon/odoo-lsp/releases/download/nightly-$(date +'%Y%m%d')/odoo-lsp-x86_64-unknown-linux-musl.tgz" | \
tar --transform 's/^dbt2-0.37.50.3/dbt2/' -xvz
# With cargo-binstall
cargo binstall odoo-lsp
# Install from source
cargo install odoo-lsp
Setup
For usage instructions please check the wiki (work in progress).
VSCode
odoo-lsp is available from the Visual Studio Marketplace and the Open VSX Registry. Alternatively, you can grab the latest nightly builds from Releases.
Helix
- Ensure that you have
odoo-lsp
on your path - Determine your Helix runtime folder, e.g.
~/.config/helix/
on Linux - Modify
languages.toml
in your Helix runtime folder (create one if none exists) to include these lines:
[language-server]
# Update the path to match your setup
odoo-lsp.command = "odoo-lsp"
[[language]]
name = "xml"
language-servers = ["odoo-lsp"]
roots = [".odoo_lsp", ".odoo_lsp.json"]
[[language]]
name = "python"
roots = [
".odoo_lsp", ".odoo_lsp.json",
# add the default roots here
]
# Order is important here
language-servers = [
"odoo-lsp",
# add the default language servers here
"pylsp",
# and any you need
]
- Alternatively, modify
$ROOT/.helix/languages.toml
where$ROOT
is your Odoo modules root to include the above lines.
Development
pnpm i
cargo build
- In VSCode, press F5 or change to the Debug panel and click
Launch Client
Note
If encountered errors like Cannot find module '/xxx/xxx/dist/extension.js'
please try run command tsc -b
manually, you could refer IWANABETHATGUY/tower-lsp-boilerplate#6 for more details