nim-lang/langserver

ready compiled nimlangserver binaries

dreamflow opened this issue · 12 comments

it would be great if ready compiled nimlangserver
binaries could be provided as downloads .

i'm trying in vscode 1.85.1 to get the extension nim-lang.org
to work .
on they way to debug the compilation
of the nimlangserver is tough .
although i managed to compile it ,
i still couldn't get the vscode extension nim-lang.org
to work .

having ready compiled nimlangserver binaries
available as downloads , would be tremendously helpful .

Check out the latest binaries, they are automatically compiled after every commit:
https://github.com/nim-lang/langserver/releases
The CI scripts that generated them used to be broken, but I fixed them and even added some more platforms (i686-linux, arm64-linux, arm64-macos). Hope we have your OS and CPU covered. Please test and report if you have any issues with them. We're planning to release a new stable version soon (v1.2.0), and we'll be relying on the CI build to provide the binaries for this version as well.

Please test and report

test of the latest nimlangserver.exe
from "nimlangserver-windows-amd64.tar.gz"
from https://github.com/nim-lang/langserver/releases

nimlangserver.exe --version
results in

Shutting down due to an error: cannot open:
<dir-path-of-nimlangserver.exe>\nimlangserver.nimble
syncio.nim(767)          open

after downloading & placing "nimlangserver.nimble"
in the dir-path of nimlangserver.exe , i can run
nimlangserver.exe --version
and get the output
1.1.0

in vscode 1.85.1 now i have syntax-highlighting ,
but seemingly no other features are working ,
like : goto definition , symbol rename , ...

nimlangserver.exe , nimsuggest.exe , nim.exe
are all reachable via the %Path% env var .

installed is :

vscode extension "nim-lang.org" version 0.8.2

nim.exe --version
Nim Compiler Version 2.1.1 [Windows: amd64]
Compiled at 2024-01-24

What project (i.e. what nim file) are you using to test the server? Are there any error messages on the screen? The first time you open a .nim file, do you see a "Nimsuggest initialized for ' popup in the lower right part of the screen? When you go the output window (Ctrl+K Ctrl+H), from the drop down in the upper right area of the window, is there a "Nim Language Server" item? Can you attach the log output that appears, when you select this item?

What project (i.e. what nim file) are you using to test the server?

i tested only projectless *.nim files , here for this test i use
https://github.com/nim-lang/langserver/blob/master/nimlangserver.nim

When you go the output window (Ctrl+K Ctrl+H), from the drop down
in the upper right area of the window, is there a "Nim Language Server" item?

there is no "Nim Language Server" item in the drop down
at the upper right side of the output window , if i have the line
"nim.provider" : "nimsuggest",
in my vscode settings.json .

but if i comment out the "nim.provider" ... line , then
there is the "Nim Language Server" item in the drop down
at the upper right side of the output window
and the first time i open a *.nim file , at the right bottom ,
a popup appears : "nim language server crashed 5 times ..."
and the output of the "Nim Language Server" item is :

DBG Router: dispatching                        method=initialize id=0
DBG Initialize received...                    
DBG Router: sending response                   method=initialize id=0
DBG Router: dispatching                        method=initialized id=null
DBG Client initialized.                       
DBG Requesting configuration from the client  
DBG Router: dispatching                        method=textDocument/didOpen id=null
DBG New document opened for URI:               uri=file:///d%3A/nimlangserver.nim
Shutting down due to an error: Invalid hostname: C, only empty hostname is supported
utils.nim(92)            uriToPath
asyncfutures.nim(385)    read
asyncfutures.nim(385)    read
asyncfutures.nim(385)    read
???                      route (Async)
asyncfutures.nim(385)    read
asyncfutures.nim(385)    read
[Info  - 7:15:18 PM] Connection to server got closed. Server will restart.
true
[Error - 7:15:18 PM] Server process exited with code 1.
[Error - 7:15:19 PM] Server process exited with code 1.
[Error - 7:15:19 PM] The Nim Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.

I could not reproduce the problem under Windows 11 and Visual Studio Code 1.85.2. Both the i686 and amd64 builds worked fine for me, so there is something that is specific to your system. Can you provide some additional info:

  1. your .vscode/settings.json file
  2. go to the extension settings of the nim-lang.org extension and set Nimlangserver>Trace:Server to "verbose". Then restart VS code and try opening the .nim file again and please attach the full "Nim Language Server" log from the Output window.
  1. Your global settings.json file (File->Preferences->Settings; In the upper right corner click the "Open Settings (JSON)" icon)
  1. your .vscode/settings.json file
  2. Your global settings.json file (File->Preferences->Settings;
    In the upper right corner click the "Open Settings (JSON)" icon)

i only use & have the vscode global settings.json file .
in this global settings.json now i've deleted everything ,
except the "nimlangserver.trace.server"... line , so that
now my global settings.json now only contains this :
{ "nimlangserver.trace.server": "verbose" }

and i've uninstalled all vscode extensions ,
except the vscode extension "nim-lang.org" .

  1. please attach the full "Nim Language Server" log from the Output window

i've attached the log in verbose mode
output.log

could the not empty hostname be the origin of the problem ? :

Shutting down due to an error:
Invalid hostname: C, only empty hostname is supported
utils.nim(92)            uriToPath

my updated current environment :

  • Win10 64bit 22H2
  • vscode 64bit 1.85.2
    specific/different in my vscode installation is ,
    that i install and run it in the vscode portable mode
  • vscode extensions :
    installed is now only(!) the extension "nim-lang.org" 0.8.2
  • nim.exe --version
    Nim Compiler Version 2.1.1 [Windows: amd64]
    Compiled at 2024-01-26
  • latest nimlangserver.exe
    from "nimlangserver-windows-amd64.zip"
    from https://github.com/nim-lang/langserver/releases

Tried VS Code in portable mode and still cannot reproduce the bug. :(

Another difference is that I'm testing with Nim 2.0.2 - the latest stable version.

Can you try again with the latest nimlangserver build. Even though the problem isn't fixed, I've added the actual URI to the exception message in case of this error, so we'll get more helpful diagnostic information.

Can you try again with the latest nimlangserver build

the following tests were all done with the nimlangserver.exe
containing the uriToPath commit :

tested file : nimlangserver.nim , result :
output(nimlangserver with nim-2.0.3).log

for the 2. test i used the file test.nim , consisting only of the one line

let test = 1

this resulted in : output(nimlangserver with nim-2.1.1).log
but on repetition i sometimes also got this different result :
nimlangserver errors
with a much shorter output.log :

[Error - 2:42:43 PM] Stopping server failed
  Message: Cannot call write after a stream was destroyed
  Code: -32099
[Error - 2:42:43 PM] Server process exited with code 1.
[Error - 2:42:43 PM] Client Nim Language Server: connection to server is erroring.
Cannot call write after a stream was destroyed
[Error - 2:42:43 PM] Request textDocument/documentSymbol failed.
  Message: Cannot call write after a stream was destroyed
  Code: -32099

I've commited a fix: 4979bb0
Can you try again and see if it works now?

Can you try again and see if it works now?

i'm very happy 🙂 to report , that with your newest commit
fixed crash in getRootPath on Windows
it now works with nim 2.0.3 .

when opening the test-file test.nim , it appears the fine
nimsuggest initialized
and the output.log doesn't contain any errors .
output(nimlangserver with nim-2.0.3).log

i'll open a new issue , to report the different result with nim-2.1.1 .

developing my project in nim-2.1.1 and in vscode
running the nimlangserver on nim-2.0.3 works .

i'll close this issue as successfully completed .

thank you 🙂