You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been looking for a good lua language server since I've found EmmyLua to be a little unreliable. I want to use this with vim, which just requires running the server, but I don't see instructions for how to build the server standalone.
Is it possible to run as a stdio server so I could use it with vim?
If you are on Windows, you can download this extension then copy the server folder. Otherwise, see readmeHow to use on macOS/Linux.
And then startup server like here.
So, I actually went through the steps by installing VSCode, and etc, but in that process I learned what the real build steps were. They were defined in .vscode/tasks.json:
git clone git@github.com:sumneko/lua-language-server.git
cd lua-language-server
# PreCompilecd 3rd/luamake/
ninja -f ninja/linux.ninja
cd ../../
# Compile
3rd/luamake/luamake rebuild
# Run
server/bin/lua-language-server -E -e LANG=en server/main.lua
You could put this in a Makefile for those of us who want to try this outside of VSCode.
For anyone finding these instructions now, @norcalli's comment needs two modifications:
You'll need git submodule update --init --recursive before you can run ninja for luamake.
Running the server (on Linux, at least) now requires running /path/to/lua-language-server/server/Linux/bin/lua -E -e LANG=en /path/to/lua-language-server/server/main.lua (the main difference is that the executable now seems to be called lua instead of lua-language-server, and that seemingly you can run it from outside of the root repo directory).
It would be really great if, as @MaskRay suggests, there was a wiki where we could put these build instructions, or section of the README, a Makefile, etc.
@wbthomason@MaskRay@sumneko Since opening this PR, I have since joined the neovim team and wrote the builtin client for neovim vim.lsp. I also started a project to add specific language server configs in https://github.com/neovim/nvim-lsp/, but I hope for it to be a reference for any 3rd party users as to how to configure servers since the configurations are very abstracted and you don't need a lot familiarity with Lua to use them.
I wrote a script to auto install it that you can reference, and it has the benefit that it will be maintained by the neovim contributors. I added a step to download ninja if you don't have it.
You may find our automatic extension scraping and settings generation especially useful. You can see it in the README.md. I scrape the package.json for settings.
I got the server running outside of VSCode. Like @sumneko suggests I copied the server folder from the extension and ran it with the command: bin\Windows\lua-language-server.exe -E main.lua
Now I just don't understand how I can access it? How do I send him the code of my file so that the Lua LS can send me his suggestions?
Context: I work with Angular 8 and the Monaco Editor (core of VSCode) on a IDE, it's only used locally. To connect Monaco to an LSP I use the Monaco Editor Language Client (https://github.com/TypeFox/monaco-languageclient), it provides a language client that establishes communication between Monaco editors and language servers over JSON-RPC via WebSockets.
I got it working with neovim, using the coc.nvim plugin, in my Linux machine. The steps are similar to @norcalli 's.
# Clone the repository recursively into a desired folder# in my case $HOME/.lua-language-server/
git clone --recursive git@github.com:sumneko/lua-language-server.git .lua-language-server/
# PreCompile with ninja, you must have this packagecd .lua-language-server/3rd/luamake/
ninja -f ninja/linux.ninja
# Compilecd ../../
3rd/luamake/luamake rebuild
# Runcd ../
.lua-language-server/bin/Linux/lua-language-server -E -e LANG=en .lua-language-server/main.lua
If everything went OK, the command won't return and wont' print anything, until you Ctrl+C.
Pay attention to the OS name in the path. And make sure to invoke this command in the parent directory, because main.lua uses the path argument.
To connect to coc.nvim, you must use edit coc-settings.json and include:
Do you need dotnet as an additional dependency ?
I'm trying to build it on Linux, and I can't build luamake (rewritten here because it's running on another laptop and reasons) :
# In 3rd/luamake with the submodules recursively initialized
[0/3] cd 3rd/bee.lua && ninja -f ninja/linux.ninja
[2/2] build/linux/bin/bootstrap test/test.lua
FAILED: build/linux/_/test
build/linux/bin/boootstrap test/test.lua
OS: Linux
Arch: 64
Compiler: GCC 10.1.0
CRT: libstdc++ 20200507
DEBUG: false
....
ninja: build stopped: subcommand fialed.
FAILED: build/linux/_/bee
cd 3rd/bee.lua && ninja -f ninja/linux.ninja
ninja: build stopped: subcommand failed.
Activity
sumneko commentedon Jul 11, 2019
If you are on Windows, you can download this extension then copy the
serverfolder. Otherwise, seereadmeHow to use on macOS/Linux.And then startup server like here.
norcalli commentedon Jul 12, 2019
So, I actually went through the steps by installing VSCode, and etc, but in that process I learned what the real build steps were. They were defined in
.vscode/tasks.json:You could put this in a
Makefilefor those of us who want to try this outside ofVSCode.Here's a 30 second version:
Note to others:
server/bin/lua-language-servermust be run from inside oflua-language-serveras it contains relative paths.norcalli commentedon Jul 12, 2019
Works well!
@sumneko consider adding the instructions I made above to the README. I could open a PR if you're interested.
MaskRay commentedon Oct 6, 2019
Drop-by comment. I was looking for a Lua language server and just came across this project.
@sumneko Please add a wiki page and probably make it publicly editable https://help.github.com/en/articles/changing-access-permissions-for-wikis Users of editors other than VSCode can benefit from the build instructions here.
wbthomason commentedon Nov 15, 2019
For anyone finding these instructions now, @norcalli's comment needs two modifications:
git submodule update --init --recursivebefore you can runninjaforluamake./path/to/lua-language-server/server/Linux/bin/lua -E -e LANG=en /path/to/lua-language-server/server/main.lua(the main difference is that the executable now seems to be calledluainstead oflua-language-server, and that seemingly you can run it from outside of the root repo directory).It would be really great if, as @MaskRay suggests, there was a wiki where we could put these build instructions, or section of the README, a Makefile, etc.
sumneko commentedon Nov 22, 2019
I have create a wiki page for building and runing.
@MaskRay Sorry I missed your message before, now everyone could edit wiki.
norcalli commentedon Nov 23, 2019
@wbthomason @MaskRay @sumneko Since opening this PR, I have since joined the neovim team and wrote the builtin client for neovim
vim.lsp. I also started a project to add specific language server configs in https://github.com/neovim/nvim-lsp/, but I hope for it to be a reference for any 3rd party users as to how to configure servers since the configurations are very abstracted and you don't need a lot familiarity with Lua to use them.I wrote a script to auto install it that you can reference, and it has the benefit that it will be maintained by the neovim contributors. I added a step to download ninja if you don't have it.
Here's the PR https://github.com/neovim/nvim-lsp/pull/49/files#diff-b4f1130fbd1295c6654d11c3dd94b1e7
And here's the install script https://github.com/neovim/nvim-lsp/blob/ddd62036c8509a8a9fd78595fdcf53884bd02f7f/lua/nvim_lsp/sumneko_lua.lua#L32
You may find our automatic extension scraping and settings generation especially useful. You can see it in the README.md. I scrape the package.json for settings.
teto commentedon Dec 29, 2019
mainstream packager for lua projects is https://luarocks.org/. It would be very cool to see a rockspec for it. It's quite simple to write.
weisa-san commentedon Mar 6, 2020
I got the server running outside of VSCode. Like @sumneko suggests I copied the server folder from the extension and ran it with the command: bin\Windows\lua-language-server.exe -E main.lua
Now I just don't understand how I can access it? How do I send him the code of my file so that the Lua LS can send me his suggestions?
Context: I work with Angular 8 and the Monaco Editor (core of VSCode) on a IDE, it's only used locally. To connect Monaco to an LSP I use the Monaco Editor Language Client (https://github.com/TypeFox/monaco-languageclient), it provides a language client that establishes communication between Monaco editors and language servers over JSON-RPC via WebSockets.
sumneko commentedon Mar 13, 2020
@weisa-san Currently the language server only supports connection by standard output and standard input.
rodamaral commentedon Mar 30, 2020
I got it working with neovim, using the coc.nvim plugin, in my Linux machine. The steps are similar to @norcalli 's.
If everything went OK, the command won't return and wont' print anything, until you Ctrl+C.
Pay attention to the OS name in the path. And make sure to invoke this command in the parent directory, because main.lua uses the path argument.
To connect to coc.nvim, you must use edit coc-settings.json and include:
gagbo commentedon Jun 3, 2020
Do you need dotnet as an additional dependency ?I'm trying to build it on Linux, and I can't build luamake (rewritten here because it's running on another laptop and reasons) :
gagbo commentedon Jun 3, 2020
That's actually this issue I was able to compile removing the tests (both on 3rd/luamake/3rd/bee and 3rd/bee).
The
unittests at the end of luamake fail though. Still trying to figure out why.But meanwhile, commenting out the
testin the default targets tomake.luaworks welllm:default { 'install', - 'test', + -- 'test', 'unittest', }wbthomason commentedon Jun 3, 2020
@gagbo: If you could try the steps in actboy168/bee.lua#8 (comment) and report if you get any more information in actboy168/bee.lua#8, that would be helpful!
sumneko commentedon Nov 23, 2020
Has been integrated into neovim.
gagbo commentedon Nov 23, 2020
But there are other editors than VSCode and neovim :(
Either way, I think the issue I mentionned earlier has been fixed, I didn't need extra steps to get it working after reinstalling recently. 👍
arnoson commentedon Nov 28, 2021
@weisa-san I also tried to connect this language server to a Monaco Editor running in the browser and finally got a working example: https://github.com/arnoson/monaco-lua-example
PaperPrototype commentedon Dec 1, 2025
@arnoson this is exactly was I was looking for!