by saagarjha · 8y ago · 0 comments
Clangd already exists (it was contributed and mainly maintained by Google, IIRC), and works great. It supports LSP, and works fine with vscode.
What apple is investing in is making it their default tooling.
So the benefits of this change are exclusive to apple xcode (ATM) :)
The benefits to using clangd in general are (among poher things) editor agnosticism and scaling.
If everyone uses libclang, libclang must scale to every codebase (or a least, the interface, and then you'd have to replace/relink it).
If everyone uses LSP, you just need something that speaks LSP, and scales to your codebase.
At the scale of Google's codebases, for example, the first is untenable, the second is doable.
Certainly missing LSP functionality helps everyone, but the rest depends quite a lot on approach and details.
While with common IDE plugins, you have one implementation of the refactoring functionality, and each language plugin just exposes an AST.
So LSP actually leads to more duplicated code and worse editors.
VS Code will never be able to match the functionality of IDEA unless each language server reimplements all the functionality slightly differently. What a mess.
https://github.com/Ruin0x11/intellij-lsp-server
That being said, as an implementor I'm finding cases where LSP's feature set is underdeveloped. For example, there is nothing in the spec to account for renaming files, so I can't put in my rename action without the behavior being incorrect (because if you rename a class in Java you have to rename the corresponding file, which IDEA handles). Also some things require custom LSP requests, like getting the list of build configurations to run. I think this is a product of the Java support in IDEA being so much more comprehensive than anything in LSP so far. But hopefully as the spec is improved these issues will be worked out
Actually, if this were just a lib in Xcode, then instead of sourcekitd crashing, Xcode would crash all the time. Would you really prefer that?
What for you might need it on iOS? Server is meant to run on a development machine.
While I totally agree, I can see the author's point. Think for example about Swift Playgrounds.
There's no reason to discount iOS as a development machine–it's perfectly fine for coding, as Swift Playgrounds shows. (Actually, there are some issues with executing code in third party apps, but I'm working on a way to bypass the restrictions around this. Check back again soon!)