jonnyboyC / kos-language-server

A language server for the Kerboscript (kOS) a language for Kerbal Space Program
MIT License
27 stars 6 forks source link

[BUG] KSP fails to load when launched by VS Code unless VS Code is ran as administrator. #150

Open kaufman-bryce opened 4 years ago

kaufman-bryce commented 4 years ago

Describe the bug When launching KSP via 'KOS: Start Kerbal Space Program', KSP loads files at a drastically reduced rate. During loading, KSP seems to stall and no further loading progress is made. In older KSP versions (1.3.1) this stall occurs when the loading bar is full. On newer versions (1.8.1 and 1.9.1), this stall occurs when the bar is ~75% full. The backgrounds continue to cycle, as does the loading text, but no further loading occurs and the main menu is never reached. Somehow, it also fails to produce it's own log file when called from VS Code as well, so I'm not sure how to troubleshoot. Works fine if VS Code is launched as administrator. Game loads at full speed, reaches menu, performs as normal.

To Reproduce

  1. Configure "kos-vscode.kerbalSpaceProgramPath" to point to desired location (or don't, doesn't seem to matter)
  2. While editing a .ks file, open command palette and select the command to start KSP.
  3. Observe slower than normal file loading
  4. Get stuck after all files have loaded, have no log to read.
  5. After closing the stuck KSP, open it by hand via Windows Explorer. Loads quickly, reaches menu, writes log.

Expected behavior KSP launches the same as if it were manually launched.

Editor (please complete the following information):

Additional context I have tried multiple versions of KSP, in custom directories on multiple drives and the default Steam install. This issue occurs with all of them. All of them load successfully when launched normally (via Windows Explorer or a shortcut). I have checked the Event Viewer (no events), double-checked file permissions. The only Extension Host log item in VS Code for your extension is it's initial activation for that session, and the only contents of it's own log are warnings about references to other KS files in my kerboscript files that it can't resolve, all of which are valid errors. Those .ks files are, in fact, absent.

jonnyboyC commented 4 years ago

I'll have to fire up my windows machine to investigate. Likely it has to do with node's spawn method in this file https://github.com/jonnyboyC/kos-language-server/blob/master/clients/vscode/src/commands/kspProvider.ts. I'll try to investigate both the admin needs as well as the slow loading times.

kaufman-bryce commented 4 years ago

I suspect the slow load time is the same issue as being unable to write it's own log file, and that it is caused by some sort of permission error. I just don't know enough about Node to be helpful in diagnosing. I think I remember seeing a forum thread years and years ago with a similar issue and the root cause was permissions, but I can't seem to locate it again.