Open wojciech-kulik opened 2 months ago
on my side sourcekit-lsp crashing almost always (9 times from 10) when i insert some autocomplete suggestions from copilot (as example), or making bunch of copy/paste in insert mode. Didn't found how to fix it, so i just restarting sourcekit manually each time whenever it falls
Swift may compile slowly (stuck) or crash for some complex boundary scenes. You can diff the code to observe the behavior of the Swift compiler. Most of the slow compilation problems of Swift can be avoided by supplementing type information and splitting expressions. If the compilation problem is reproducible, you can prepare a minimal reproducible demo and submit an issue to Apple.
I'm still experiencing constantly failing LSP. Next week I will be disabling plugins like Copilot to figure out what's going on.
@wojciech-kulik did your cpu ok? lsp may stuck on complex syntax and consume a lot of cpu, and unresponsive to any request. if so, you may check what syntax make it crazy
Yes, my CPU is ok. Currently it happens with every project. I suspect that some plugin update messed up something.
I'm also experiencing that, it works well for a few minutes but then sourcekitd starts erroring out and it never recovers.
@SolaWing It's not complicated syntax, even just a very straightforward View in SwiftUI in a very simple project breaks it.
@akaralar do you use the Copilot plugin? Maybe we can start by disabling it, as it is directly related with LSP.
No I don't use Copilot, I doubt that's the problem.
Maybe we could try downgrading lsp-config then?
Mine usually fails with
sourcekit: -32001: sourcekitd request failed: error response (Request Failed): Loading the standard library failed
Although right now it wants to work again 🤷♂️ Definitely there is some flakiness but can't say if it's LSP or something else.
On my side the same, today it works well so far, but even yesterday it was constantly crashing... I will be observing the issue
Weird thing, this week I'm not experiencing this issue. I switched to another project for iOS (before I was working a lot on macOS app) and also in the meantime I updated all plugins.
Maybe the problem has been resolved in some update, or it occurs perhaps only with macOS apps?
I use only coc.nvim and xcode-build-server, and rarely encounter sourcekit-lsp crashes, except some wired syntax which make build also crash. so I think you should first try found a stable reproduce path, and minimum your environment, to figure out what is the issue..
Maybe the problem has been resolved in some update, or it occurs perhaps only with macOS apps?
I don't think that's the case, I've updated all my plugins just a few days ago and I only develop for iOS. I've also found that for me if it happens at some point – it will always happen in the same place. Like I can restart LSP and repeat my actions 10 times in a row, and it will crash 10 times in a row.
However since the crash log points at something within swift-syntax maybe it only happens in projects/files that use it?
Isn't swift-syntax used for Swift Macros? Maybe macros are causing issues in your case?
Probably, but I wasn't able to see a direct connection, it happens even with completions not related to macros and even in files where macros are not used. Maybe macros elsewhere in the project are causing it
I'm thinking about: https://github.com/wojciech-kulik/xcodebuild.nvim/issues/56
@SolaWing are you aware if there is any CLI mechanism to trigger indexing without the whole build? What does Xcode do under the hood that it works?