Skip to content

tarantool/tarantool-vscode

Repository files navigation

Visual Studio Marketplace Downloads Build status

🕷 Tarantool VS Code Extension

Tarantool VS Code Extension helps you to develop Tarantool applications in VS Code. It enhances your text editor with completions, suggestions, snippets, and Lua debugger.


Features

This extension offers the following features.

  • Static type checks and documentation for the most popular Lua and Tarantool builtin modules.
  • Cluster configuration schema validation for Tarantool 3.0+.
  • tt cluster management utility inside the command palette.
  • Other auxiliary commands, e.g. install Tarantool of a specific version right from VS Code.
  • Debugger for Tarantool apps, allowing breakpoints, step-by-step execution, viewing local variables and Lua code execution.

Usage

That's how you use this extension.

  • Install the extension from the VS Code marketplace.
  • Open a Tarantool project in VS Code.

You may statically type your Lua functions as follows.

---@class user_info
---@field name string User's name.
---@field age? number User's age (optional).

---@alias user_tuple [string, number]

---@param tuples user_tuple[]
---@return user_info[]
local function deflatten_users(tuples)
    -- ...
end

---@type user_info
local unnamed_user = { name = 'Unnamed' }

For more examples, refer to the examples folder with tutorials on how to type your Lua code.

Using debugger

Tarantool VS Code extension provides debugger facility for developing Tarantool applications. It employs EmmyLuaDebugger that is a stop-the-world Lua debugger.

  • Insert debugger code in Tarantool application by pressing Ctrl+Shift+P (or Cmd+Shift+P on MacOS) and running Tarantool: Insert debugger code command.
  • Start single Tarantool instance.
  • Press F5 or run Debug: Start debugging command by pressing Ctrl+Shift+P (or Cmd+Shift+P on MacOS).
  • Choose EmmyLua New Debugger in the list. This debugging configuration would run automatically from now.
  • Set up breakpoints & access the Tarantool instance through Debug console in the bottom panel.

Contributing

Feel free to open issues on feature requests, wrong type annotations and bugs. If you're dealing with a problem related to LSP we'd appreciate addressing a direct issue to the used external Lua Language server.

We also appreciate contributions via pull requests.

Thank you for your interest in Tarantool and its development tools!

References & acknowledgments

This is an extension for the Tarantool database. It uses VS Code EmmyLua extension with emmylua-analyzer-rust under the hood and RedHat YAML extension dependencies as providers of Lua and YAML language servers and extend them with Tarantool-specific annotations.

A lot of the initial work has been done by Tarantool community in the original Tarantool VS Code annotations.