untoldwind / KontrolSystem2

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

resolve type imports #102

Closed kbleeke closed 6 months ago

kbleeke commented 6 months ago

I don't know if this is all there is to it but this makes imports from local modules such as

use { MyType} from to2Local::mymodule

work in the LSP server

kbleeke commented 6 months ago

I just realized that the to2Local prefix here is wrong.

The language server seems to only resolve to2Local::mymodule where as the game expects mymodule

Edit: Ah I realize this is because didn't open the "to2Local" directory in vscode

untoldwind commented 6 months ago

Currently the lsp-server does not make an attempt to find/parse files that are not opened in the editor - mostly because I did not wanted to preemptively crawl the entire workspace folder. There probably should be some logic to lookup a specific file if a module name could not be resolved.

As for the type lookup: Your patch works, but there is still an issue with structs ... I'm looking into that.