untoldwind / KontrolSystem2

Autopilot scripting system for KSP2
Other
54 stars 14 forks source link

VSC extension went mad when it sees my code #124

Closed lefouvert closed 2 months ago

lefouvert commented 5 months ago

Kontrol version 0.5.2.6 (Ckan) VSC extention vresion 0.0.15 (Git release) assumed tag : question

Hi fellow dev'

I've just see than the VSIX package for Visual Studio Code reach the 0.0.15 version (Which answer the question «but how other dev' issuing here have thoses messages in their IDE ?») Since I was using the 0.0.1, I thought it could be a good idea to update it.

And OH GOD this poor little thing will have an heart attack ! Near every line I wrote seems to be suspect at it's eyes.

The most 'root' code is already tagged as wrong : VSCext_0

And when it comes to other struct referencies, things are not better : VSCext_1 VSCext_2

I have configured the parameters of the extention to reference to my dev' folder, however, I don't know what means npm i or npm run watch or even where to enter these commands.

I've surely done something wrong, but I have no idea how to correct it. But one thing I'm sure about is my code isn't wrong : compiler accept it, and execution is has expected.

So i'm seeking help here :)

untoldwind commented 4 months ago

Here is what I do:

With npm run watch running all changes in the client should be auto-reloaded. Changes in the server require a restart though.

lefouvert commented 4 months ago

Ok, I was missing the part where I should have node.js. I manage to install a node version manager, which could allow me to have node (11.13.0) and npm (6.9.0) version. After a close and open on all my workspaces to consider new environ variable, npm i command run smoothly. Howerver, when it come to npm run watch, I got this error :

C:\Users\lefou\OneDrive\Documents\Code\c#\KontrolSystem2\KontrolSystem2\Tools\vscode\to2-> syntax\node_modules\typescript\lib\tsc.js:93 for (let i = startIndex ?? 0; i < array.length; i++) { ^

SyntaxError: Unexpected token ? at Module._compile (internal/modules/cjs/loader.js:749:23) at Object.Module._extensions..js (internal/modules/cjs/loader.js:816:10) at Module.load (internal/modules/cjs/loader.js:672:32) at tryModuleLoad (internal/modules/cjs/loader.js:612:12) at Function.Module._load (internal/modules/cjs/loader.js:604:3) at Module.require (internal/modules/cjs/loader.js:711:19) at require (internal/modules/cjs/helpers.js:14:16) at Object. > (C:\Users\lefou\OneDrive\Documents\Code\c#\KontrolSystem2\KontrolSystem2\Tools\vscode\to2-> syntax\node_modules\typescript\bin\tsc:2:1) at Module._compile (internal/modules/cjs/loader.js:805:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:816:10) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! to2-syntax@0.0.15 watch: tsc -b -w npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the to2-syntax@0.0.15 watch script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\lefou\AppData\Roaming\npm-cache_logs\2024-02-06T08_11_54_010Z-debug.log

I found it was because my node.js wasn't up to date. So a nodist global 20.x install it and THEN, npm run watch could go. compiling seems to go as expected.

When it come to Launch debuger, if no file is open, it whine because it don't know what to debug, and I've tried to open ".\Tools\vscode\to2-syntax\server\out\lsp-server.js" and then debug it, and here I have this error :

C:\Program Files (x86)\Nodist\bin\node.exe .\Tools\vscode\to2-syntax\server\out\lsp-server.js Uncaught Error Error: Connection input stream is not set. Use arguments of createConnection or set command line parameters: '--node-ipc', '--stdio' or '--socket={number}' at _createConnection (file:///C:/Users/lefou/OneDrive/Documents/Code/c%23/KontrolSystem2/KontrolSystem2/Tools/vscode/to2-syntax/server/node_modules/vscode-languageserver/lib/node/main.js:192:15) at createConnection (file:///C:/Users/lefou/OneDrive/Documents/Code/c%23/KontrolSystem2/KontrolSystem2/Tools/vscode/to2-syntax/server/node_modules/vscode-languageserver/lib/node/main.js:137:12) at (file:///C:/Users/lefou/OneDrive/Documents/Code/c%23/KontrolSystem2/KontrolSystem2/Tools/vscode/to2-syntax/server/out/lsp-server.js:5:48) at Module._compile (node:internal/modules/cjs/loader:1376:14) at Module._extensions..js (node:internal/modules/cjs/loader:1435:10) at Module.load (node:internal/modules/cjs/loader:1207:32) at Module._load (node:internal/modules/cjs/loader:1023:12) at executeUserEntryPoint (node:internal/modules/run_main:135:12) at (node:internal/main/run_main_module:28:49) Process exited with code 1

I stopped my research here because I have to work, and I post this incompleted process because I'm affraid to forget something if I don't write it now :)

untoldwind commented 4 months ago

Yes, the banes of the node-environment. I guess https://github.com/nvm-sh/nvm is the commonly used way to handle different node versions per project. I added a .nvmrc to pin it down to node 20.

As for the connection/startup bug: This might be related to windows(?) ... though I am somewhat surprised that it seems to work for the bundled version. The startup of the LSP server should happen here: https://github.com/untoldwind/KontrolSystem2/blob/88d8520b87c9df7e94d385672a8230992b7fbd4b/Tools/vscode/to2-syntax/client/src/extension.ts#L39 Maybe the IPC transport does not work in dev-mode? I.e. you could try tweaking the server options: https://github.com/untoldwind/KontrolSystem2/blob/88d8520b87c9df7e94d385672a8230992b7fbd4b/Tools/vscode/to2-syntax/client/src/extension.ts#L21

github-actions[bot] commented 2 months ago

This issue is stale because it has been open for 60 days with no activity.

github-actions[bot] commented 2 months ago

This issue was closed because it has been inactive for 14 days since being marked as stale.