Need help with running lua lsp in a docker container
Hi, this is what I am trying to do:
- I have a web editor made with react and monaco editor
- The editor is for writing lua code
- I want lua lsp autocompletions in the web editor
- I am trying to run the lua-language-server in a docker container which I hope to later run on a VPS and make the editor frontend connect to this remote lsp server to provide autocompletions
Setup:
- I used the homebrew docker image to install lua-language-server https://hub.docker.com/r/homebrew/brew
Issue faced:
When I run just the lua-language-server command, it seems to be running, but when I specify a socket, it does not start and gives a connection refused error.
moreover when I install the lsp on my mac machine and run the same command, it doesnot throw and error and seems to run silently
If anyone needs any additional details please let me know
Dockerfile:
# Use the official Homebrew Docker image as the base
FROM homebrew/brew:latest
# Install lua-language-server
RUN brew install lua-language-server
# Verify installation
RUN lua-language-server --version
# Set working directory
WORKDIR /workspace
# ENTRYPOINT ["lua-language-server --socket=5000"]
# CMD ["lua-language-server", "--socket=5000"]
EXPOSE 5000
CMD ["bash"]
tried both ENTRYPOINT and CMD, same results, which is why I used bash and interactive mode to debug
Thanks
Even if it is connected through a socket, luals must be in the same place as the runtime environment., because if the language server and the target workspace are not on the same machine, the language server cannot correctly load the workspace. LSP does not specify how to send workspace content to the LS, so general language server load the workspace by scanning the rootPath path passed in by LSP client. Currently, to truly support WebIDE, LuaLs must be compiled into wasm. There are no plans or progress in this regard at the moment.
I see.
Currently, to truly support WebIDE, LuaLs must be compiled into wasm
Could you point me to any resources regarding this? if any
Could you point me to any resources regarding this? if any
discuss in https://github.com/LuaLS/lua-language-server/issues/1689
Did you make any progress on this? I'm also looking to integrate with monaco client <---> server kind of setup
We have a monaco editor running on the client's machine in SaaS setup and we need reasonable code completion for our custom library.
Seems like https://luals.github.io/wiki/definition-files/ would be the way to go but there is no clear way to set this up remotely on docker 🤔 Any advice would be appreciated.
Did you make any progress on this? I'm also looking to integrate with monaco client <---> server kind of setup
We have a monaco editor running on the client's machine in SaaS setup and we need reasonable code completion for our custom library.
Seems like https://luals.github.io/wiki/definition-files/ would be the way to go but there is no clear way to set this up remotely on docker 🤔 Any advice would be appreciated. Perhaps I could talk to my boss to hire someone as a consultant on the subject.
Luals does not actually support communication via sockets. It appears to use sockets, but in reality, it uses Unix sockets.
There are a couple examples online https://github.com/arnoson/monaco-lua-example/tree/main they wrap the lls with a simple typescript websockets server. I'm trying that in docker. So far so good. Will keep updating in here. Here is clone of the example code: https://github.com/d-baranowski/monaco-lua-language-server-example
Even if it is connected through a socket, luals must be in the same place as the runtime environment., because if the language server and the target workspace are not on the same machine, the language server cannot correctly load the workspace. LSP does not specify how to send workspace content to the LS, so general language server load the workspace by scanning the rootPath path passed in by LSP client. Currently, to truly support WebIDE, LuaLs must be compiled into wasm. There are no plans or progress in this regard at the moment.
I wonder if we could bundle the correct workspaces inside the docker container to kind of dodge the issue. We only have a couple single file editors for simple scripting. No need for multi file proper editor in our use case.
We've managed to get it to work in Docker with monaco being hosted as part of our webapp with lua-ls making it work via websockets. So it seems to be possible. We've tried multiple users talking to the same language server. As long as the node wrapper spawns a new LS process for each socket connection it works like a charm
perhaps you can directly modify this project to achieve your goal. https://github.com/LuaLS/lua-language-server-rust