Skip to content

Latest commit

Β 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ•· Tarantool for Zed

Tarantool extension for the Zed editor providing Lua snippets, EmmyLua type annotations, LSP integration, and debugging support for Tarantool application development.

Features (Phase 1)

  • 40+ Tarantool-specific snippets covering:

    • box.space CRUD operations (select, insert, replace, update, delete, upsert, get, count, pairs)
    • Schema management (space creation, index creation, box.once)
    • Transaction management (box.begin, box.atomic)
    • Fiber operations (create, sleep, conditions, channels)
    • net.box remote connections and calls
    • crud module operations
    • vshard router calls
    • HTTP server patterns
    • Utility modules: log, json, yaml, clock, datetime, decimal, uuid, buffer
    • EmmyLua type annotations (---@class, ---@param, ---@return)
  • EmmyLua type annotations for Tarantool builtin modules:

    • box, buffer, clock, config, console, csv, datetime, decimal
    • errno, fiber, fio, fun, iconv, jit, json, log
    • socket, strict, string, tarantool, uri, uuid, xlog, yaml
    • http.client, net.box
    • vshard
  • LSP integration with lua-language-server (automatic detection from PATH)

    • LuaJIT runtime version
    • Tarantool globals (box, _TARANTOOL)
    • Auto-configures annotation library paths

Installation

Prerequisites

  1. Rust toolchain with rustup (Zed compiles extensions to WebAssembly):

    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

    After installation, restart your shell or run:

    source "$HOME/.cargo/env"

    Note for Homebrew users: If you previously installed Rust via brew install rust, the Homebrew package does not always include rustup. You can either uninstall it (brew uninstall rust) and use rustup instead, or install rustup alongside it:

    brew install rustup
    rustup-init
  2. WASM compilation target:

    rustup target add wasm32-wasip2
  3. lua-language-server:

    # macOS
    brew install lua-language-server
    
    # Linux
    # Download from: https://github.com/LuaLS/lua-language-server/releases

Install the extension

As a dev extension:

  1. Clone this repository with submodules:
    git clone --recursive https://github.com/tarantool/tarantool-zed.git
  2. In Zed, open the Extensions page (Cmd+Shift+X)
  3. Click "Install Dev Extension" and select the tarantool-zed directory

From the Zed marketplace (once published):

  1. Open the Extensions page (Cmd+Shift+X)
  2. Search for "Tarantool"
  3. Click Install

Usage

Snippets

Type the snippet prefix and press Tab to expand. Examples:

Prefix Description
box.select box.space select query
box.insert box.space insert a tuple
box.once Schema migration pattern
box.begin Begin/commit transaction
fiber.create Create and start a fiber
vshard.call vshard router call
crud.select CRUD select operation
---@func EmmyLua annotated function
---@class EmmyLua class type definition

LSP Configuration

The extension automatically configures lua-language-server with:

  • Runtime: LuaJIT
  • Library paths pointing to Tarantool type annotations
  • Global recognition of box and _TARANTOOL

To manually configure additional settings, create a .luarc.json in your project root:

{
  "$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json",
  "runtime.version": "LuaJIT",
  "workspace.library": [
    "tarantool-vscode/tarantool-annotations/Library",
    "tarantool-vscode/tarantool-annotations/Rocks"
  ],
  "diagnostics.globals": ["box", "_TARANTOOL"]
}

Project Structure

tarantool-zed/
β”œβ”€β”€ extension.toml              # Extension manifest
β”œβ”€β”€ Cargo.toml                  # Rust dependencies (WASM build)
β”œβ”€β”€ LICENSE                     # MIT License
β”œβ”€β”€ src/
β”‚   └── lib.rs                  # LSP configuration via Rust/WASM
β”œβ”€β”€ languages/
β”‚   └── lua/
β”‚       └── config.toml         # Extends the built-in Lua language
β”œβ”€β”€ snippets/
β”‚   └── tarantool-lua.json      # 47 Tarantool-specific code snippets
β”œβ”€β”€ tarantool-vscode/           # Git submodule β†’ tarantool/tarantool-vscode
β”‚   └── tarantool-annotations/  # EmmyLua type annotations (shared with VSCode ext)
β”‚       β”œβ”€β”€ Library/            # Tarantool builtin modules
β”‚       └── Rocks/              # Tarantool rock modules (vshard)

Roadmap

  • Phase 2: Debugger β€” EmmyLua debugger adapter integration
  • Phase 3: Tasks β€” Pre-configured Zed tasks for tt CLI commands
  • Phase 4: YAML β€” Schema validation for Tarantool cluster configs

Contributing

Contributions are welcome! Feel free to open issues or pull requests.

License

MIT β€” see LICENSE for details.

The EmmyLua type annotations in annotations/ are derived from the Tarantool VSCode extension.

About

πŸ•· Tarantool for Zed - Lua snippets, EmmyLua type annotations and LSP integration for Tarantool application development

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages