#lua #kailua #language #language-server

archived kailua_langsvr

Language server implementation for Kailua

4 stable releases

Uses old Rust 2015

1.1.0 Jul 18, 2017
1.0.7 Jun 2, 2017
1.0.5 Jun 1, 2017
1.0.4 Apr 25, 2017

#3 in #kailua

35 downloads per month
Used in kailua

MIT/Apache

135KB
2.5K SLoC

🌴 Kailua (crates.io)

한국어

Kailua is an experimental type checker and integrated development environment (IDE) for the Lua programming language (currently only Lua 5.1 is supported).

The detailed documentation is available here.

Installation and Usage

Kailua can be used as a standalone checker or an IDE plugin.

Standalone Checker

To install a standalone checker, install Rust first (1.15 or later required), then type the following:

cargo install -f kailua

(-f will cause the existing installation to be upgraded.)

You can run kailua check <path to the entry point> now.

You can also run kailua check <path to the directory>, if you have kailua.json or .vscode/kailua.json in that directory. The configuration format is described in the later section.

Visual Studio Code

Kailua can be used as an IDE support for Visual Studio Code. Install Kailua by typing ext install kailua from the Quick Launch (Ctrl-P). If you are not on Windows, you should also install the standalone checker as above.

You will see a warning that the configuration file is missing when you open a folder containing Lua codes. You need it for real-time checking.

You can either create .vscode/kailua.json by hand, or search "Kailua" from the Command Palette (Ctrl-Shift-P) to edit one.

The following content is required for .vscode/kailua.json, in case you are editing it by hand:

{
    "start_path": "<path to the entry point>",

    "preload": {
        // This indicates that we are using Lua 5.1 and all built-in libraries of it.
        "open": ["lua51"],
    },
}

You need to reload the current window (Ctrl-R or Cmd-R) to apply the configuration.

Your First Kailua Code

Once you've set the entry point, you can write your first Kailua code:

--# open lua51
print('Hello, world!')

If you are using the configuration file, the first code can be made much simpler:

print('Hello, world!')

Play a bit with this code to see which errors Kailua can detect.

License

Kailua is dual-licensed under the MIT license and Apache license 2.0 at your option. By contributing to Kailua you agree that your contributions will be licensed under these two licenses.


lib.rs:

Language server implementation for Kailua.

This crate provides a bulk of implementation details for the language server, but itself is not an executable. The external crate is expected to parse the command-line options and completely delegate to this crate to switch to the language server mode.

Dependencies

~5MB
~123K SLoC