SolaWing / xcode-build-server

a build server protocol implementation for integrate xcode with sourcekit-lsp
MIT License
284 stars 16 forks source link

Indexing a new file #43

Open wojciech-kulik opened 2 months ago

wojciech-kulik commented 2 months ago

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?

Woit commented 4 weeks 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

SolaWing commented 4 weeks ago

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.

wojciech-kulik commented 1 week ago

I'm still experiencing constantly failing LSP. Next week I will be disabling plugins like Copilot to figure out what's going on.

SolaWing commented 1 week ago

@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

wojciech-kulik commented 1 week ago

Yes, my CPU is ok. Currently it happens with every project. I suspect that some plugin update messed up something.

akaralar commented 1 week ago

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.

wojciech-kulik commented 1 week ago

@akaralar do you use the Copilot plugin? Maybe we can start by disabling it, as it is directly related with LSP.

akaralar commented 1 week ago

No I don't use Copilot, I doubt that's the problem.

wojciech-kulik commented 1 week ago

Maybe we could try downgrading lsp-config then?

akaralar commented 1 week ago

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.

wojciech-kulik commented 1 week ago

On my side the same, today it works well so far, but even yesterday it was constantly crashing... I will be observing the issue

wojciech-kulik commented 1 week ago

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?

SolaWing commented 1 week ago

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..

Almaz5200 commented 1 week ago

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?

wojciech-kulik commented 1 week ago

Isn't swift-syntax used for Swift Macros? Maybe macros are causing issues in your case?

Almaz5200 commented 1 week ago

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