kenkangxgwe / lsp-wl

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

init.wls 运行出错 #66

Closed fjh3646 closed 2 years ago

fjh3646 commented 3 years ago

win 12.3.1运行init.wls 出错

[INFO  2021-10-22T21:36:13] Initializing Wolfram Language Server

StringJoin::string:
   String expected at position 1 in
    (Keys::usage)<>
                                                                       .
      Keys[typename] gives a list of the keys field_i in type typename.

MessageName::messg:
   Keys::usage cannot be set to
    (Keys::usage)<>
                                                                       . It
      Keys[typename] gives a list of the keys field_i in type typename.
     must be set to a string.
[INFO  2021-10-22T21:36:16] Language server is connecting the client through
socket.
[INFO  2021-10-22T21:36:18] Server listening from port 6536...

DataType`TypeCheck::mispat:
   Failed socket operation: << 40 >> doesn't match the pattern of "client" in
    WolframLanguageServer`Server`Private`WorkState.
[ERROR 2021-10-22T21:36:18] Which[Undefined message SocketReadyQ::notsocket with
arguments {Failed socket operation: << 40 >>},
WolframLanguageServer`Server`Private`handleMessageList[WolframLanguageServer`Ser
ver`Private`ReadMessages[Failed socket operation: << 40 >>],
WolframLanguageServer`Server`Private`WorkState[<|initialized -> False,
openedDocs -> <||>, debugSession ->
WolframLanguageServer`Server`Private`DebugSession[<|initialized -> False, server
-> Null, client -> Null|>], scheduledTasks -> {}, caches ->
<|textDocument/signatureHelp -> <||>, textDocument/documentSymbol -> <||>,
textDocument/documentColor -> <||>, textDocument/codeLens -> <||>,
textDocument/publishDiagnostics -> <||>|>, pendingServerRequests -> <||>, config
-> <|configFileConfig -> WolframLanguageServer`Server`Private`loadConfig[]|>,
client -> Failed socket operation: << 40 >>|>]],
WolframLanguageServer`Server`Private`DebugSession[<|initialized -> False, server
-> Null, client -> Null|>][server] =!= Null &&
WolframLanguageServer`Server`Private`DebugSession[<|initialized -> False, server
-> Null, client -> Null|>][client] === Null &&
Length[WolframLanguageServer`Server`Private`DebugSession[<|initialized -> False,
server -> Null, client -> Null|>][server][ConnectedClients]] > 0, {Continue,
DataType`ReplaceKey[WolframLanguageServer`Server`Private`WorkState[<|initialized
[INFO  2021-10-22T21:36:18] Closing socket connection...

DataType`TypeCheck::mispat:
   Failed socket operation: << 40 >> doesn't match the pattern of "client" in
    WolframLanguageServer`Server`Private`WorkState.
[ERROR 2021-10-22T21:36:18] Server stopped abnormally.
[ERROR 2021-10-22T21:36:18] Which[Undefined message SocketReadyQ::notsocket with
arguments {Failed socket operation: << 40 >>},
WolframLanguageServer`Server`Private`handleMessageList[WolframLanguageServer`Ser
ver`Private`ReadMessages[Failed socket operation: << 40 >>],
WolframLanguageServer`Server`Private`WorkState[<|initialized -> False,
openedDocs -> <||>, debugSession ->
WolframLanguageServer`Server`Private`DebugSession[<|initialized -> False, server
-> Null, client -> Null|>], scheduledTasks -> {}, caches ->
<|textDocument/signatureHelp -> <||>, textDocument/documentSymbol -> <||>,
textDocument/documentColor -> <||>, textDocument/codeLens -> <||>,
textDocument/publishDiagnostics -> <||>|>, pendingServerRequests -> <||>, config
-> <|configFileConfig -> WolframLanguageServer`Server`Private`loadConfig[]|>,
client -> Failed socket operation: << 40 >>|>]],
WolframLanguageServer`Server`Private`DebugSession[<|initialized -> False, server
-> Null, client -> Null|>][server] =!= Null &&
WolframLanguageServer`Server`Private`DebugSession[<|initialized -> False, server
-> Null, client -> Null|>][client] === Null &&
Length[WolframLanguageServer`Server`Private`DebugSession[<|initialized -> False,
server -> Null, client -> Null|>][server][ConnectedClients]] > 0, {Continue,
DataType`ReplaceKey[WolframLanguageServer`Server`Private`WorkState[<|initialized
yqwu905 commented 2 years ago

我也遇到了相同的问题, Windows, Wolfram 13.0.0

kenkangxgwe commented 2 years ago

可以试一下 develop 分支吗?

yqwu905 commented 2 years ago

ok,这是develop分支的所有报错信息:

PacletInstall::newervers: A paclet named ZeroMQLink with a newer version number (1.2.5) is already installed. If you wish to install an older version, use PacletUninstall to remove the existing version first, or call PacletInstall with ForceVersionInstall->True.

Get::noopen: Cannot open ZeroMQLink`.
[INFO  2021-12-20T21:23:14] Initializing Wolfram Language Server

Get::noopen: Cannot open ZeroMQLinkLoader`.
[INFO  2021-12-20T21:23:21] Language server is connecting the client through
socket.
[INFO  2021-12-20T21:23:21] Server listening from port 6536...

DataType`TypeCheck::mispat:
   SocketConnect[6536, TCP] doesn't match the pattern of "client" in
    WolframLanguageServer`Server`Private`WorkState.
[ERROR 2021-12-20T21:23:21] Which[SocketReadyQ[SocketConnect[6536, TCP]],
WolframLanguageServer`Server`Private`handleMessageList[WolframLanguageServer`Ser
ver`Private`ReadMessages[SocketConnect[6536, TCP]],
WolframLanguageServer`Server`Private`WorkState[<|initialized -> False,
openedDocs -> <||>, debugSession ->
WolframLanguageServer`Server`Private`DebugSession[<|initialized -> False, server
-> Null, client -> Null|>], scheduledTasks -> {}, caches ->
<|textDocument/signatureHelp -> <||>, textDocument/documentSymbol -> <||>,
textDocument/documentLink -> <||>, textDocument/documentColor -> <||>,
textDocument/codeLens -> <||>, textDocument/publishDiagnostics -> <||>|>,
pendingServerRequests -> <||>, config -> <|configFileConfig ->
WolframLanguageServer`Server`Private`loadConfig[]|>, client ->
SocketConnect[6536, TCP]|>]],
WolframLanguageServer`Server`Private`DebugSession[<|initialized -> False, server
-> Null, client -> Null|>][server] =!= Null &&
WolframLanguageServer`Server`Private`DebugSession[<|initialized -> False, server
-> Null, client -> Null|>][client] === Null &&
Length[WolframLanguageServer`Server`Private`DebugSession[<|initialized -> False,
server -> Null, client -> Null|>][server][ConnectedClients]] > 0, {Continue,
DataType`ReplaceKey[WolframLanguageServer`Server`Private`WorkState[<|initialized
[INFO  2021-12-20T21:23:21] Closing socket connection...

DataType`TypeCheck::mispat:
   SocketConnect[6536, TCP] doesn't match the pattern of "client" in
    WolframLanguageServer`Server`Private`WorkState.
[ERROR 2021-12-20T21:23:21] Server stopped abnormally.
[ERROR 2021-12-20T21:23:21] Which[SocketReadyQ[SocketConnect[6536, TCP]],
WolframLanguageServer`Server`Private`handleMessageList[WolframLanguageServer`Ser
ver`Private`ReadMessages[SocketConnect[6536, TCP]],
WolframLanguageServer`Server`Private`WorkState[<|initialized -> False,
openedDocs -> <||>, debugSession ->
WolframLanguageServer`Server`Private`DebugSession[<|initialized -> False, server
-> Null, client -> Null|>], scheduledTasks -> {}, caches ->
<|textDocument/signatureHelp -> <||>, textDocument/documentSymbol -> <||>,
textDocument/documentLink -> <||>, textDocument/documentColor -> <||>,
textDocument/codeLens -> <||>, textDocument/publishDiagnostics -> <||>|>,
pendingServerRequests -> <||>, config -> <|configFileConfig ->
WolframLanguageServer`Server`Private`loadConfig[]|>, client ->
SocketConnect[6536, TCP]|>]],
WolframLanguageServer`Server`Private`DebugSession[<|initialized -> False, server
-> Null, client -> Null|>][server] =!= Null &&
WolframLanguageServer`Server`Private`DebugSession[<|initialized -> False, server
-> Null, client -> Null|>][client] === Null &&
Length[WolframLanguageServer`Server`Private`DebugSession[<|initialized -> False,
server -> Null, client -> Null|>][server][ConnectedClients]] > 0, {Continue,
DataType`ReplaceKey[WolframLanguageServer`Server`Private`WorkState[<|initialized
kenkangxgwe commented 2 years ago

我这边没有问题,你可以运行一下这几个命令吗 ?

PacletObject["ZeroMQLink"]
FindFile["ZeroMQLink`"]
<<ZeroMQLink`
yqwu905 commented 2 years ago

似乎是因为没有安装ZeroMQLink导致的,我用PacletInstall安装后不再出现上述的报错了。但是现在会报新的错误:

[INFO  2021-12-25T22:08:50] Initializing Wolfram Language Server
[INFO  2021-12-25T22:08:55] Language server is connecting the client through
socket.

SocketConnect::zmqexception:
   A ZeroMQLink exception was thrown -
    No connection could be made because the target machine actively refused
       it.

     (code 10061)
[ERROR 2021-12-25T22:08:57] Cannot connect to client via socket.

我怀疑是Windows系统设置的问题, 稍后我在Linux上测试一次试试.

kenkangxgwe commented 2 years ago

你需要安装 ZeroMQLink 1.1.22 版本 并且禁用 1.2.*

yqwu905 commented 2 years ago

现在的配置:

Wolfram Language 13.0.0 Engine for Linux x86 (64-bit)
Copyright 1988-2021 Wolfram Research, Inc.

In[1]:= PacletObject["ZeroMQLink"]

Out[1]= PacletObject[ZeroMQLink, 1.1.22, <>]

In[2]:= FindFile["ZeroMQLink`"]

Out[2]= /home/yqwu/.WolframEngine/Paclets/Repository/ZeroMQLink-1.1.22/Kernel/ZeroMQLink.wl

In[3]:= <<ZeroMQLink`

In[4]:= 

新的报错:

❯ wolframscript -f init.wls

PacletInstall::newervers: A paclet named ZeroMQLink with a newer version number (1.2.5) is already installed. If you wish to install an older version, use PacletUninstall to remove the existing version first, or call PacletInstall with ForceVersionInstall->True.
[INFO  2021-12-28T07:34:58] Initializing Wolfram Language Server
[INFO  2021-12-28T07:35:01] Language server is connecting the client through
socket.

SocketConnect::zmqexception:
   A ZeroMQLink exception was thrown - Connection refused (code 111)
[ERROR 2021-12-28T07:35:01] Cannot connect to client via socket.
kenkangxgwe commented 2 years ago

你有试过从 vscode 端开启嘛? https://github.com/kenkangxgwe/vscode-lsp-wl 如果你只运行 init.wls 没有编辑器, 是会连不上的。

yqwu905 commented 2 years ago

It does work! 我按照Issue53的处理方式 现在一切都正常了, 我测试了所有功能都正常工作了. 非常感谢!

kenkangxgwe commented 2 years ago

官方解决了这个问题,请升级至最新的 ZeroMQLink 版本:

PacletInstall["ZeroMQLink"]

参考:https://github.com/kenkangxgwe/lsp-wl/wiki#working-with-mathematica-123130