Sourcekit-lsp multiple files in target



I have multiple files in one target folder. LSP (suggestions, analysis, other modules etc.) works great in every single file. However, it does not recognize any piece of code (types, methods, etc.) declared in other files within the target.
Code does compile and run, only the LSP doesn’t think it should.

My friends and I work on a small linux-macos portable project. We have set up our environments using this article with some changes (swift 5.1, slightly different folders, swift path exporting in .bashrc). We’re all using Ubuntu MATE 18.04. It works great, however, I was not able to solve the problem described above so far.

I would be grateful for any help or advice,

1 Like

I'm having this same problem -- after a lot of work to get all the versions of everything happy and get the LSP set up, it works fine but only within a single source file. Whenever I reference a class or protocol from another file in the same target folder, it says "Use of undeclared type."

[edit to add:] I'm using swift 5.1 on macOS 10.14.5.

I suspect that I have done nothing wrong. I've "reinstalled" the lsp multiple times and with some builds it always worked and with other builds it didn't.

Is this a swiftpm project? SourceKitLSP currently only supports getting compiler arguments for swiftpm packages and clang's json compilation databases. From what you described, we are probably failing to find a swift package.

Terms of Service

Privacy Policy

Cookie Policy