WebAssembly Language Tools aims to provide and improve the editing experience of WebAssembly Text Format. It also provides an out-of-the-box formatter (a.k.a. pretty printer) for WebAssembly Text Format.
Code Completion
Go to Definition
Find References
Hover
Rename
Document Symbols
Diagnostics
Inlay Hint
Code Action
Formatting
Semantic Highlighting
Call Hierarchy
Signature Help
We've provided pre-built binaries on GitHub Releases. You can download it according to your platform, then extract it from the compressed file.
Or, if you've installed Rust, you can run Cargo to install it globally:
cargo install wat_server
- Visual Studio Code: Install the WebAssembly Language Tools extension.
- Neovim: You need to configure manually at the moment:
vim.api.nvim_create_autocmd("FileType", { pattern = "wat", callback = function(args) vim.lsp.start({ name = "wasm-language-tools", cmd = { "wat_server" }, -- or the absolute path to the binary settings = { -- this section is optional wasmLanguageTools = { -- must be under the key "wasmLanguageTools" format = {}, lint = { unused = "warn" }, }, }, }) end, }) -- Optional: Format on save vim.api.nvim_create_autocmd("LspAttach", { callback = function(args) local client = vim.lsp.get_client_by_id(args.data.client_id) if client.name == "wasm-language-tools" then vim.api.nvim_create_autocmd("BufWritePre", { buffer = args.buf, callback = function() vim.lsp.buf.format({ bufnr = args.buf, id = client.id }) end, }) end end, })
- Zed: Coming soon.
- Helix: Add the following lines to
<config_dir>/helix/languages.toml
:[language-server.wasm-language-tools] command = "wat_server" # or the absolute path to the binary args = [] config = { format = {}, lint = { unused = "warn" } } # this section is optional [[language]] name = "wat" language-servers = ["wasm-language-tools"]
MIT License
Copyright (c) 2024-present Pig Fang