A Lua language server
  • Lua 99.8%
  • Shell 0.2%
Find a file
2020-10-31 00:55:09 -04:00
.vim Add LSP settings, debug mode, non-self methods 2017-11-24 20:27:49 -05:00
bin package for rockspecs 2017-09-11 01:34:12 -04:00
lua-lsp Make lua-cjson optional until it works on all platforms 2020-10-17 15:07:11 -04:00
rockspecs fix lua 0.1.0 package 2020-10-31 00:45:53 -04:00
scripts Make lua-cjson optional until it works on all platforms 2020-10-17 15:07:11 -04:00
spec Switch to openresty/lua-cjson for json handling 2020-10-14 22:29:46 -04:00
.gitignore remove accidentally submitted rock file 2020-10-31 00:55:09 -04:00
.luacheckrc Add global variable scope 2018-03-21 09:34:48 -04:00
.luacompleterc Mark dirty states, misc output improvements 2017-10-03 09:14:28 -04:00
.travis.yml attempt to fix lua-cjson 2020-10-17 13:39:18 -04:00
editors.md Update editors.md 2017-10-14 16:37:08 -04:00
LICENSE.md Add readme, license 2017-09-01 21:09:41 -04:00
lua-lsp-scm-0.rockspec Add version updating infrastructure for 0.1.0 2020-10-31 00:39:40 -04:00
readme.md Make lua-cjson optional until it works on all platforms 2020-10-17 15:07:11 -04:00

lua-lsp

Build Status

A Language Server for Lua code, written in Lua.

It's still a work in progress, but it's usable for day-to-day. It currently supports:

  • Limited autocompletion
  • Goto definition
  • As you type linting and syntax checking
  • Code formatting
  • Supports Lua 5.1-5.3 and Luajit

Installation/Usage

lua-lsp can be installed using luarocks:

$ luarocks install --server=http://luarocks.org/dev lua-lsp

This will install the lua-lsp command. Language clients can then communicate with this process using stdio as a transport. See editors.md for more instructions specific to your editor of choice.

Plugins

lua-lsp automatically integrates with common lua packages, when they are installed. For linting, install luacheck:

$ luarocks install luacheck

For code formatting, we currently support Formatter and LCF. Formatter is 5.1 only, whereas lcf is 5.3 only. 5.1:

$ luarocks-5.1 install Formatter
$ luarocks-5.3 install lcf

If you have another package you'd like to see integrated, feel free to leave an issue/PR. Other plugins are always welcome, especially if they provide materially different results.

if lua-cjson is installed, we will optionally use it for a speed boost. It is unfortunately not supported by all versions of lua at the moment, but as soon as it is we will switch to making it mandatory.

$ luarocks install lua-cjson

Configuration

lua-lsp reads a few project-level configuration files to do its work.

To configure linting, we read your standard .luacheckrc file.

For autocomplete support, we reimplement the .luacompleterc format created by atom-autocomplete-lua. In particular, we need luaVersion to properly understand your code.

More LSP-specific configuration flags will hopefully be provided through your editor's configuration support.

TODO

The LSP spec is big, and we don't implement all of it. here's a quick wishlist ordered by roughly by priority/feasibility.

  • List references (textDocument/references)
  • Find symbols (workspace/symbol)
  • Function signature help (textDocument/signatureHelp)
  • Code links (textDocument/documentLink)
  • File events (workspace/didChangeWatchedFiles)