Language server and other tools for WebAssembly.
Find a file
2024-12-19 23:20:02 +08:00
.github ci: setup GitHub Release (#1) 2024-12-09 11:23:38 +08:00
crates chore(service): add doc comments 2024-12-19 12:28:23 +08:00
media chore: add logo 2024-12-19 23:20:02 +08:00
.editorconfig chore: update EditorConfig 2024-09-21 09:45:56 +08:00
.gitattributes chore: add .gitattributes 2024-09-24 11:44:53 +08:00
.gitignore chore: ignore VS Code settings 2024-09-10 16:07:17 +08:00
Cargo.lock fix(service): allow to fall back to global config 2024-12-13 18:08:51 +08:00
Cargo.toml fix(service): allow to fall back to global config 2024-12-13 18:08:51 +08:00
LICENSE init 2024-09-07 11:14:32 +08:00
README.md chore: add logo 2024-12-19 23:20:02 +08:00

WebAssembly Language Tools

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.

📌 Features

Code Completion
Go to Definition
Find References
Hover
Rename
Document Symbols
Diagnostics
Inlay Hint
Code Action
Formatting
Semantic Highlighting
Call Hierarchy

🍵 Usage

We don't provide pre-built binaries at the moment.

If you have installed Rust, you can run Cargo to install:

cargo install --git https://github.com/g-plane/wasm-language-tools.git wat_server

Editor Support

  • 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"]
    

📜 License

MIT License

Copyright (c) 2024-present Pig Fang