Closed carsakiller closed 10 months ago
@sumneko I already checked that. That seems fine – but the problem seems to be with the language server, not the client. The server immediately throws an error when trying to launch in “socket mode”, it doesn't even seem to try connecting.
I also tried hard-coding the client, but it did not work:
const serverOptions: ServerOptions = {
command: command,
transport: { kind: TransportKind.socket, port: 5050 },
args: commandParam,
};
Using Wireshark, I can see traffic from the client on port 5050
, but when I launch the language server, there is no traffic at all.
I don't know, I have tried using the parameter on the Windows platform and it works fine for me. I am not sure about any differences on Linux.
@actboy168 is this potentially a problem with bee.socket
on Linux? I am also able to run it fine on Windows.
I looked at script/brave/work.lua
, and the use of socket is very rough and crude. It's a miracle that it works under windows. Obviously miracles don't always happen.
Every return value of every function of bee.socket should be nodiscard
. If you ignore any of them, it will definitely bring you errors at some point.
I am running into this issue as well on linux
./bin/lua-language-server --socket=5050
...ment/lua/lua-language-server/luaLS/script/brave/work.lua:65: socket closed!
stack traceback:
[C]: in function 'error'
...ment/lua/lua-language-server/luaLS/script/brave/work.lua:65: in function <...ment/lua/lua-language-server/luaLS/script/brave/work.lua:16>
[C]: in function 'xpcall'
...ent/lua/lua-language-server/luaLS/script/brave/brave.lua:57: in function 'brave.brave.start'
...ent/lua/lua-language-server/luaLS/script/brave/brave.lua:23: in function 'brave.brave.register'
[string "package.path = "/home/trey2k/Development/lua..."]:13: in main chunk
[C]: in ?
Should it not be binding with rfd:bind("127.0.0.1", socketPort)
?
https://github.com/LuaLS/lua-language-server/blob/ce964793afc6251673238c256a25e06502e487b8/script/proto/proto.lua#L241
Is there any documentation for bee.socket
? I am having to learn the implementation by the language server and guess what bee.socket
is doing.
The design concept of bee.socket is to keep the details of bsd socket as much as possible.
bsd socket is the cornerstone of all network programs, if you are familiar with bsd socket, you don't need any documentation to use bee.socket. if you are not familiar with bsd socket, it doesn't help if you have the documentation because the documentation won't teach you how to write the code.
You need to learn bsd socket to use bee.socket directly.
I would disagree. Good documentation can help guide someone who even only has a basic understanding of what they are trying to accomplish. A good explanation and example of common usage can be more than enough to help most people quickly understand. Even if the implementation is very similar to another project, this one is specifically for Lua and is deserving of documentation for its specific API and implementation.
Documentation may be useful, but documentation cannot teach you how to use socket. For people who want to learn to use socket through documentation and examples, what they need is a higher-level encapsulated library.
In one sentence, even with documentation, many errors in using bee.socket in luals cannot be solved.
Please try this commit
A different error is progress
How are you using the lua-language-server?
Command Line
Which OS are you using?
Linux
What is the issue affecting?
Other
Expected Behaviour
Using
--socket=5050
would start the language server and it would attempt to communicate with my VS Code client over a TCP socket on port5050
.Actual Behaviour
The language server almost immediately exits with the following error:
/workspaces/lua-language-server/script/brave/work.lua:65: socket closed!
Reproduction steps
./bin/lua-language-server --socket=5050
/workspaces/lua-language-server/script/brave/work.lua:65: socket closed!
Additional Notes
No response
Log File
Log File
``` [15:08:49.214][info] [#0:/workspaces/lua-language-server/main.lua:66]: Lua Lsp startup, root: /workspaces/lua-language-server [15:08:49.224][info] [#0:/workspaces/lua-language-server/main.lua:67]: ROOT: /workspaces/lua-language-server [15:08:49.225][info] [#0:/workspaces/lua-language-server/main.lua:68]: LOGPATH: /workspaces/lua-language-server/log [15:08:49.226][info] [#0:/workspaces/lua-language-server/main.lua:69]: METAPATH: /workspaces/lua-language-server/meta [15:08:49.268][info] [#0:/workspaces/lua-language-server/main.lua:70]: VERSION: 3.7.1-dev [15:08:50.943][info] [#0:script/service/service.lua:144]: ========= Medical Examination Report ========= --------------- Memory --------------- Total: 2.149 MB # 00 : 2.149 MB # 01 : 0.000 MB # 02 : 0.000 MB # 03 : 0.000 MB # 04 : 0.000 MB --------------- Coroutine --------------- Total: 0 Running: 0 Suspended: 0 Normal: 0 Dead: 0 --------------- Cache --------------- Total: 1 Dead: 0 --------------- RPC --------------- Holdon: 0 Waiting: 0 ============================================== [15:08:51.030][error][#3]: /workspaces/lua-language-server/script/brave/work.lua:65: socket closed! stack traceback: [C]: in function 'error' /workspaces/lua-language-server/script/brave/work.lua:65: in function [C]: in function 'xpcall' /workspaces/lua-language-server/script/brave/brave.lua:57: in function 'brave.brave.start' /workspaces/lua-language-server/script/brave/brave.lua:23: in function 'brave.brave.register' [string "package.path = "/workspaces/lua-language-ser..."]:13: in main chunk [C]: in ? ```