kenkangxgwe / lsp-wl

A Wolfram Language Server
MIT License
214 stars 22 forks source link

ZeroMQLink exception thrown on init #36

Closed C-TWilliam closed 3 years ago

C-TWilliam commented 3 years ago

Just cloned lsp-wl to my Arch Linux system and, after following the paclet instructions, tried to run it.

With Mathematica 12.0 installed, I ran wolfram -script init.wls and got the following output:

[INFO  2021-02-01T21:09:06] Initializing Wolfram Language Server
[INFO  2021-02-01T21:09:07] Language server is connecting the client through
socket.

SocketConnect::zmqexception: 
   A ZeroMQLink exception was thrown - Connection refused (code 111)
[ERROR 2021-02-01T21:09:07] Cannot connect to client via socket.
BhuvaneshBhatt commented 3 years ago

I get the same error on my Mac. I haven't had time to investigate it, but I'm hoping to look into it later this week so I can provide more info to the developers.

bbhattmaclap:Downloads bbhatt$ /Applications/Mathematica.app/Contents/MacOS/wolfram -script /Users/bbhatt/WolframLanguageServer/init.wls
$Version      = 12.2.0 for Mac OS X x86 (64-bit) (January 23, 2021)
$CreationDate = Sat 23 Jan 2021 03:30:11AM
[INFO  2021-02-01T14:18:04] Initializing Wolfram Language Server
[INFO  2021-02-01T14:18:05] Language server is connecting the client through
socket.

SocketConnect::zmqexception:
   A ZeroMQLink exception was thrown - Connection refused (code 61)
[ERROR 2021-02-01T14:18:06] Cannot connect to client via socket.
bbhattmaclap:Downloads bbhatt$
kenkangxgwe commented 3 years ago

Hi @weeTC and @BhuvaneshBhatt , the error message indicates that the client is not running for the language server to communicate with. From step 3 of the Installation section in the README:

Install the client. Currently, we provide the VS Code extension on Visual Studio Marketplace: Wolfram Language Server For other editors, please refer to the wiki.

If you only run the server w/o a frontend editor as the client, the language server won't be usable (or only for debugging). I suggest starting with VS Code by reaching to vscode-lsp-wl.

Should you encounter any problem configuring the lsp-wl in VS Code, please feel free to let me know.

Gravifer commented 3 years ago

I am having this issue when trying to examine a deployed script on a server, via vscode-lsp-wl VS-Code remote SSH extension. I'll try to supply further info soon.

C-TWilliam commented 3 years ago

@kenkangxgwe Hi, thanks very much for the heads-up. I was looking into connecting to the server with Emacs, for which a specific client doesn't exist yet. I can have a look into VScode in the short term but let me know if you have any insight into how easy it would be to write an Emacs entry point.

kenkangxgwe commented 3 years ago

Hi @weeTC , Emacs configuration is in the wiki, though not for Windows, but you can take a look at it.

kenkangxgwe commented 3 years ago

Hi @Gravifer , did you open a remote file with a local VSCode. If so, can you open a local file with the server running correctly?

bloorr commented 3 years ago

I am running MacOS 11.2 Mathematica 12.2. Installed the server from git as recommended. Server passes (14/14) the --test from command line. Installed the vscode extension v.0.1.9 through the VS Code editor. The editor reports "Couldn't start client Wolfram Language Server". New to VS Code, so not sure how to debug further. Exiting the editor and reentering, opening a file, results in the same error message. Activated Developer Tools in the editor and found: Screen Shot 2021-02-04 at 11 50 23 AM

C-TWilliam commented 3 years ago

Hi @weeTC , Emacs configuration is in the wiki, though not for Windows, but you can take a look at it.

Thanks very much for this. This solved the question I asked but I'm still having problems. The hover etc. seems to work in VScode but the debug console doesn't. And the LSP doesn't seem to work at all in emacs. It says it connects but then immediately disconnects. I can open a new issue for these if that's easier?

kenkangxgwe commented 3 years ago

Hi @weeTC , Please create new issues if you have any trouble with Emacs and VSCode. Please provide some logs from the editors as well (for Emacs, the *message* and *lsp-xxx* buffers, for VS Code, the Output panel selecting Wolfram Language Server.)

kenkangxgwe commented 3 years ago

Hi @bloorr , could you provide more logs in the OUTPUT Panel with Wolfram Language Server selected, like this:

image

bloorr commented 3 years ago

Hi, @kenkangxgwe:

Thanks. Went to the VSCode, Output, Wolfram Language Server after closing and reopening VSCode, and got:

Screen Shot 2021-02-06 at 4 09 55 PM

Probably not too much help.

Bloor

P.S. Here is the output of the test from a terminal window, showing some response times: Screen Shot 2021-02-06 at 4 16 45 PM

kenkangxgwe commented 3 years ago

Would you please show me the extension settings in the VS Code, especially these two fields: image

Gravifer commented 3 years ago

Hi @Gravifer , did you open a remote file with a local VSCode. If so, can you open a local file with the server running correctly?

Yes, the server is working smoothly on local files.

In the former comment, I was actually trying to link the server with a WolframEngine kernel on the remote machine, by modifying the remote:SSH settings.json, specifying the path of wolfram on the remote machine, as well as the path to the clone of this repo on the remote machine. There are several possible combinations:

kernel language server file current status
1 local local local neato ditto
2 remote remote remote ZMQ exception
3 local remote remote to try
4 remote local remote to try
5 remote local remote to try

I'll update my testing results here ASAP.

P.S.: At this point it seems that support for remoting could actually be a separate feature request, and may not really fit in the thread of this issue. Feel free to move this discussion to a new open issue if needed.

bloorr commented 3 years ago

Hi, @kenkangxgwe:

You solved the problem! I failed to Configure the Server in VSCode app. I realize now I was following the config in the Server and being new to VSCode, failed to realize that VSCode needs configuration, too. My apologies.

For future readers: I set the path to my lap-wl directory and the path to the Wolfram Language Server for MacOS as suggested in the configuration information for the VSCode Extension, and the Server Started. I have Outline, Hover, etc. So, the link is clearly working. I still don't have syntax color highlighting, but I'll explore that.

FYI, I am getting the following shadowing warning from Mathematica on the output panel: [INFO 2021-02-06T16:56:36] Initializing Wolfram Language Server

LogDebug::shdw: Symbol LogDebug appears in multiple contexts {ZeroMQLinkLogging, WolframLanguageServerLogger} ; definitions in context ZeroMQLinkLogging may shadow or be shadowed by other definitions.

LogInfo::shdw: Symbol LogInfo appears in multiple contexts {ZeroMQLinkLogging, WolframLanguageServerLogger} ; definitions in context ZeroMQLinkLogging may shadow or be shadowed by other definitions.

LogWarn::shdw: Symbol LogWarn appears in multiple contexts {ZeroMQLinkLogging, WolframLanguageServerLogger} ; definitions in context ZeroMQLinkLogging may shadow or be shadowed by other definitions.

LogError::shdw: Symbol LogError appears in multiple contexts {ZeroMQLinkLogging, WolframLanguageServerLogger} ; definitions in context ZeroMQLinkLogging may shadow or be shadowed by other definitions. [INFO 2021-02-06T16:56:40] Language server is connecting the client through socket. [INFO 2021-02-06T16:56:40] Server listening from port 6536... [INFO 2021-02-06T16:56:40] Debugger listening at port 56961 [INFO 2021-02-06T16:56:42] {InitialCheck, Quantity[1.312314, "Seconds"]} Upgrade not checked, only a few days after the last check. [INFO 2021-02-06T16:56:47] {textDocument/documentColor, Quantity[0.4926719172363292, "Seconds"]} [INFO 2021-02-06T16:56:47] {textDocument/documentColor, 0.012883}

Thanks again for your help!

kenkangxgwe commented 3 years ago

Hi @bloorr , The shadow message won't affect the normal use, though thanks for the feedback.


Hi @Gravifer , I will create another issue regarding your comment.


I will close this issue since the ZeroMQLink exception is due to misconfiguration from the client-side. Please feel free to create another issue if you encounter further problems.