nim-lang / vscode-nim

A VS Code plugin for the Nim language
Other
78 stars 8 forks source link

New version of the plugin does not work on Windows #78

Closed AngelEzquerra closed 3 months ago

AngelEzquerra commented 3 months ago

The new version of the plugin does not work well on Windows. The syntax highlighting works, put none of the nimlanguageserver based features work. In particular:

These problems happen for every nim file I open. I ran nimble dump on the folder of one of the files and I got the following result:

C:\repositories\nim_tests\impulse\impulse>nimble dump packageinfo.nim(280) findNimbleFile

Error:  Could not find a file with a .nimble extension inside the specified directory: C:\repositories\nim_tests\impulse\impulse
jmgomez commented 3 months ago

Can you install this custom version? (you need to unzip it). On startup it should print in the Nim output log "The value of ext.nimDir.." which will help debugging your issue nimvscode-1.0.0.vsix.zip Thanks!

AngelEzquerra commented 3 months ago

Thanks for creating this debug version for me, and sorry for taking a while to be able to test it. This is what I got on the Nim panel after installing that debug version:

2024-07-02 0012:0013:0057.000225 - nimlangserver found: C:\Tools\Development\.nimble\bin\nimlangserver.exe
2024-07-02 0012:0013:0057.000225 - Starting nimlangserver.
2024-07-02 0012:0013:0057.000831 - Nim Language Server started
2024-07-02 0012:0013:0057.000835 - The value of ext.nimDir is `` and isSet is `false`
2024-07-02 0012:0013:0057.000975 - [info] Extension Activated
2024-07-02 0012:0014:0036.000705 - Your lsp version is updated

And on the Nim Language Server Panel I see the following:

DBG Router: dispatching                        method=initialize id=0
DBG Initialize received...                    
DBG Registering monitor for process            pid=51632
DBG Initialize completed. Trying to start nimsuggest instances
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 Shutting down due to an error:             msg="input(1, 0) Error: { expected"
DBG Stack trace:                               stack_trace="parsejson.nim(518)       raiseParseErr\n???                      start (Async)\nasyncfutures.nim(381)    read\n"
Shutting down due to an error: input(1, 0) Error: { expected
parsejson.nim(518)       raiseParseErr
???                      start (Async)
asyncfutures.nim(381)    read

[Info  - 12:13:57 PM] Connection to server got closed. Server will restart.
true
[Error - 12:13:57 PM] Server process exited with code 1.
DBG Shutting down due to an error:             msg="input(1, 0) Error: { expected"
DBG Stack trace:                               stack_trace="parsejson.nim(518)       raiseParseErr\n???                      start (Async)\nasyncfutures.nim(381)    read\n"
[Error - 12:13:58 PM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Info  - 12:13:58 PM] Connection to server got closed. Server will restart.
true
[Error - 12:13:58 PM] Nim Language Server client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 12:13:58 PM] Server process exited with code 1.
DBG Shutting down due to an error:             msg="input(1, 0) Error: { expected"
DBG Stack trace:                               stack_trace="parsejson.nim(518)       raiseParseErr\n???                      start (Async)\nasyncfutures.nim(381)    read\n"
[Error - 12:14:36 PM] Server process exited with code 1.
[Error - 12:14:36 PM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Info  - 12:14:36 PM] Connection to server got closed. Server will restart.
true
[Error - 12:14:36 PM] Nim Language Server client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 12:14:36 PM] Restarting server failed
  Message: Pending response rejected since connection got disposed
  Code: -32097 
DBG Router: dispatching                        method=initialize id=0
DBG Initialize received...                    
DBG Registering monitor for process            pid=51632
DBG Initialize completed. Trying to start nimsuggest instances
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 Shutting down due to an error:             msg="input(1, 0) Error: { expected"
DBG Stack trace:                               stack_trace="parsejson.nim(518)       raiseParseErr\n???                      start (Async)\nasyncfutures.nim(381)    read\n"
Shutting down due to an error: input(1, 0) Error: { expected
parsejson.nim(518)       raiseParseErr
???                      start (Async)
asyncfutures.nim(381)    read

[Info  - 12:14:36 PM] Connection to server got closed. Server will restart.
true
[Error - 12:14:36 PM] Server process exited with code 1.
DBG Shutting down due to an error:             msg="input(1, 0) Error: { expected"
DBG Stack trace:                               stack_trace="parsejson.nim(518)       raiseParseErr\n???                      start (Async)\nasyncfutures.nim(381)    read\n"
[Error - 12:14:37 PM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 12:14:37 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.
[Error - 12:14:37 PM] Nim Language Server client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 12:14:37 PM] Server process exited with code 1.
AngelEzquerra commented 3 months ago

The issue was fixed by cloning the nim language server repo, building it and replacing nimlangserver.exe with the result of that build. With that the extension does not generate any errors and mostly works although a few things don't (e.g. inline hints). Thanks to @jmgomez for helping me fix the issue!