tarantool / tarantool/tarantool

lua: add support for Lua Language Server

Open
#11,035 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

epic feature
Dominant language
Lua
Stars
3.7k
Forks
419
Avg merge
1d 23h
Merged PRs (30d)
88

Description

Introduction

Lua used by Tarantool has dynamic type system. It may complicate the development of the Tarantool applications because of lack of static checks and absence of IDE/text editor autocomplete support since types of the values can't be inferred before script execution. There are tools such as Lua Language Server (ex. Sumneko Lua Server) [1] allowing providing type annotations and class definitions for performing some static checks. There is a Tarantool VSCode extension [2] for Lua Language Server with type definitions for the most of the Tarantool functions. The problem is that the extension is maintained externally. It means some of the type definitions are deprecated and aren't used in the internal code during the development.

Suggestion

It's suggested to migrate the type definitions inside the Tarantool itself and to provide a straightforward way to supply IDE with type definitions for performing static checks when developing Tarantool. It'd good to reuse the language server checks during the development to make new code more reliable, simplify the development and review process. Also, this type definitions may involve documentation on the functions thus they can be reused for exporting documentation reference.

Implementation

Adding the support includes the following tasks.

  • Migrate and actualize type definitions for C-defined Lua functions and Lua modules from the VSCode extension [2]. Since there are a lot of modules it's suggested to work in three iterations.
    • box, clock, config, decimal, fiber, json, log, net.box, string, table, uri, uuid, yaml modules (#11038).
    • buffer, csv, datetime, digest, fio, fun, http, merger, pickle, socket, utf8.
    • crypto, iconv, popen, strict, swim, xlog.
  • Support exporting definition files for Lua Language Server [3] for developing Tarantool applications (#11038).
  • Migrate and provide type definitions for popular Tarantool modules.
    • vshard
    • luatest
    • crud
    • queue
    • expirationd
    • kafka
    • Likely, something else.
  • Implement building plugins for popular text editors: Neovim, VSCode.
  • Bulid a PoC of exporting Lua function documentation reference from type definitions.
  • Add type definitions for internal Lua methods and classes.
  • Add support for explicitly specifying space schema for providing static checks of the database tuples.
  • Include static checks of the Lua Language Server in CI.
  • Require the developer to supply type definitions for new Lua functions.
Iterations

Since the task is even too big for a single epic, it's split into iterations.

  1. #11038
Reference list

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading iteration #11038 and the Lua Language Server definition-file guidance, then compare the Tarantool VSCode extension definitions referenced in the issue. The issue spans migration, editor integration, documentation, and CI without naming project files or tests; a contribution needs one explicitly scoped iteration with its validation criteria defined.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
developer-experience, documentation, testing-qa, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.