I'm trying to develop a small application on Linux that makes use of libgpiod.
I've declared a Package.swift file that contains a systemLibrary target (as described in SE-0208).
My language server is sending a diagnostic of "no such module" with the textDocument/publishDiagnostics notification. Does that means that system library targets are not supported yet in the language server or do I need to provide extra configuration to enable this feature?
I would have expected it to work since to sourcekit it’s just compiler arguments from swiftpm, but haven’t tested it. Is there an easy way to reproduce on either maxOS or Ubuntu?
tl;dr My current work around is to stop the language server after adding an import statement to a systemLibrary. Then restart it.
So I kept playing with it last night. I finally got it working. Sort of. I think there is some bug but I'm not quite sure how to describe it or where it comes from yet. I'm still trying to come up with a minimal reproduction of it. I'm also not sure if it is just systemLibrary targets or all.
I noticed that whenever adding a new file that contains an import to a systemLibrary I have to stop the language server and restart it. Then the diagnostics disappear.
Preliminary Reproduction Steps
I've gone ahead and pushed the scaffold of the library here. It is presumed that VSCode and sourcekit-lsp are already properly configured.
Note: Before doing this 2nd git checkout do not close VSCode or sourcekit-lsp.
I typically run the git checkout on a terminal external to VSCode but I don't think this is necessary.
With main.swift still open there should now be an error use of unresolved identifier 'Chip' originating from sourcekitd.
Open Chip.swift there is now an error no such module 'Clibgpiod' originating from sourcekitd.
Also note that at this time and at every step previously swift build and swift run worked fine.
Now close VSCode and re-launch. All the diagnostic errors are gone and the language server works as expected (until a new file importing Clibgpiod is made).
This was all done on Ubuntu 19.10 with a daily build of the master branch of the Swift toolchain from 17 March 2020.