Why is SourceKit-LSP on Swift so backward?

Compared with other languages, Swift lags behind in the development of LSP and receives little attention. So far, such basic functions as rename are not supported. It is impossible to imagine that this is a cross-platform language


i imagine it's probably because Apple was once heavily invested in XCode, so SKLSP did not get much attention until very recently. but things do seem to be improving at an encouraging pace, just one year ago SKLSP was completely unusable whereas now i can actually use it in my day to day programming.


Although the functions of SourceKit-LSP are available, the basic functions of SourceKit-LSP are backward and do not improve the efficiency. Let's hope Swift gets better and better

As @taylorswift already mentioned, improving SourceKit-LSP is a matter of resource allocation. Given infinite time, I would certainly love SourceKit-LSP to support the entire LSP feature set, not have any bugs and be as efficient as possible. But since time is limited there are always trade-offs to be made between SourceKit-LSP and other work. Note that some of the work that is being done outside of the SourceKit-LSP repository directly benefits SourceKit-LSP – just to name one example, I’m currently working on improving code completion correctness in invalid code apple/swift#63717.

Also note that Swift and SourceKit-LSP are open source projects, so if you are interested in improving SourceKit-LSP, contributions are always more than welcome. If you need help getting started, always feel free to ask and we are happy to help.


Why do the SourceKit-LSP consume so much memory and crashes frequently on the linux platform?

1 Like

I can’t answer that generic questions but would like to investigate why it’s using a lot of memory for you and which crashes you are seeing.

  • How much memory is “too much memory”? “much” is a rather subjective term and I’d like to put some numbers to it.
  • Do you have a specific project for which SourceKit-LSP uses a lot of memory? If so, can you share it?
  • Do you have steps to reproduce the crashes, ideally if you could share the project as well? That would really help us understand the problem and fix it
  • If you don’t have reproduction steps, do you have crash reports of SourceKit-LSP?
  • And finally: Which version of SourceKit-LSP are you using? You could try the more recent Swift 5.9 or main snapshots from Swift.org - Download Swift and there’s a chance that the crashes are already fixed in it.

I would really appreciate if you could file a bug report at Sign in to GitHub · GitHub for the issues that you are seeing.

1 Like

I would not say SourceKitLSP on linux consumes much more memory than Xcode on macOS. Subjectively :)
Regarding crashes - for last two years developing on linux I've never experienced LSP server crash that was not caused by crash in nightly build of swift itself. Release versions worked charming for me