nim-lang / vscode-nim

A VS Code plugin for the Nim language
Other
63 stars 5 forks source link

Starting the extension is a hit-and-miss operation #47

Closed janflyborg closed 4 months ago

janflyborg commented 4 months ago

Sometime when I launch my project in VS Code I receive no language support. If I stop it and start it again, it sometimes works. It even seems like letting VS Code rest for a while helps. Cannot really figure out what is wrong, so any assistance is appreciated.

This is for the latest version of VS Code, running with the latest version of this plugin on Debian Bullseye (AMD64).

Have this in my exthost.log:

2024-02-26 12:36:45.923 [info] ExtensionService#_doActivateExtension vscode.emmet, startup: false, activationEvent: 'onLanguage'
2024-02-26 12:36:45.926 [info] ExtensionService#_doActivateExtension NimLang.nimlang, startup: false, activationEvent: 'onLanguage:nim'
2024-02-26 12:36:46.038 [error] Activating extension NimLang.nimlang failed due to an error:
2024-02-26 12:36:46.038 [error] TypeError: Cannot read properties of undefined (reading 'has')
    at isSome_2063598084 (/home/janf/.vscode/extensions/nimlang.nimlang-0.9.0/out/nimvscode.js:15418:41)
    at getLatestReleasedLspVersion_2063597794 (/home/janf/.vscode/extensions/nimlang.nimlang-0.9.0/out/nimvscode.js:15565:21)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async startLanguageServer_2063598370 (/home/janf/.vscode/extensions/nimlang.nimlang-0.9.0/out/nimvscode.js:15893:39)
    at async activate_536871932 (/home/janf/.vscode/extensions/nimlang.nimlang-0.9.0/out/nimvscode.js:17433:6)
    at async c.n (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:140:6256)
    at async c.m (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:140:6219)
    at async c.l (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:140:5676)
janflyborg commented 4 months ago

It seems like it cannot start the language server, but it is there, updated to the latest version, and I can start it from the command line. Have the same problem when running VS Code in WSL2 on Windows.

jmgomez commented 4 months ago

Sounds like a bug in the jsgen.

janflyborg commented 4 months ago

Thanks for the quick help. I side loaded the extension (with your fix) and it seems to help.

janflyborg commented 4 months ago

I apologize for opening up this again, but it seemed to help on my WSL2 instance, but not so for my Debian machine. When building and sideloading the extension, it now fails to start with this message in exthost.log:

2024-02-27 15:05:43.350 [info] ExtensionService#_doActivateExtension NimLang.nimlang, startup: false, activationEvent: 'onLanguage:nim'
2024-02-27 15:05:43.481 [error] Activating extension NimLang.nimlang failed due to an error:
2024-02-27 15:05:43.481 [error] TypeError: Cannot read properties of undefined (reading 'val')
    at nimCopyAux (/home/janf/.vscode/extensions/nimlang.nimlang-0.9.0/out/nimvscode.js:2049:102)
    at nimCopyAux (/home/janf/.vscode/extensions/nimlang.nimlang-0.9.0/out/nimvscode.js:2055:7)
    at nimCopy (/home/janf/.vscode/extensions/nimlang.nimlang-0.9.0/out/nimvscode.js:1236:7)
    at isSomeSafe_2164261089 (/home/janf/.vscode/extensions/nimlang.nimlang-0.9.0/out/nimvscode.js:15417:16)
    at getLatestReleasedLspVersion_2164261107 (/home/janf/.vscode/extensions/nimlang.nimlang-0.9.0/out/nimvscode.js:15572:21)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async startLanguageServer_2164261695 (/home/janf/.vscode/extensions/nimlang.nimlang-0.9.0/out/nimvscode.js:15954:39)
    at async activate_553649155 (/home/janf/.vscode/extensions/nimlang.nimlang-0.9.0/out/nimvscode.js:17492:6)
    at async c.n (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:140:6256)
    at async c.m (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:140:6219)
    at async c.l (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:140:5676)
jmgomez commented 4 months ago

Im looking at the generated code and it doesnt look like yours, you sure the extension is the latest build? Can you upload your nimvscode.js. It's inside the extension on the out directory (the extension is a zip file)

janflyborg commented 4 months ago

Sorry for the slow response. This was probably a false alarm. I removed the extension and side loaded it again (with your changes) and it has worked ever since.