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] Language server doesn't recognize the existence of ksconfig.json until you open that file #167

Open scimas opened 3 years ago

scimas commented 3 years ago

Describe the bug As the title says, the options specified in ksconfig.json aren't applied until I actually open the ksconfig.json file. Even then, it only appears to apply the linting options, the "file doesn't exist" warnings stay in place even though the archive option is set. I have to make some change in the .ks file for it to recognize that the paths are actually correct (a dummy change like press backspace once is enough to "refresh" the state of paths).

To Reproduce Steps to reproduce the behavior: This is my directory structure

KOS-Scripts
|-- ksconfig.json
|-- Script
|   |-- library
|   |   |-- lib_navigation.ks
|   |-- scripts
|   |   |-- node_execute.ks

ksconfig.json has

{
    "archive": "Script",
    "linting": {
        "file-loading": "hint"
    }
}

And node_execute.ks makes reference to lib_navigation.ks through

// #include "0:/library/lib_navigation.ks"

But as soon as I start vscode, the extension outputs [Warn - <timestamp>] Error: ENOENT: no such file or directory, open 'KOS-Scripts\library\lib_navigation.ks'.

If I open ksconfig.json in an editor tab at this point, the file warnings go from warn to hint, but it still complains that the file doesn't exist. It is only after I make a dummy edit to the file node_execute.ks or close and reopen it does the server make the warnings go away and start showing the function definitions and such.

This problem has existed for as long as the ksconfig.json has been introduced, as far as I can tell. I just got around to reporting it now.

Expected behavior I shouldn't need to open ksconfig.json for the options defined there to come into effect.

Editor (please complete the following information):

jonnyboyC commented 3 years ago

I appreciate the report, especially all the detailed reproduction. I'll try to dust this project off this weekend and get this and a few other pending bugs dealt with.

Tahvohck commented 1 year ago

Been dealing with this myself. Any chance on an update to fix it?