Add C, C++, and Objective-C language support for sourcekit-lsp#70
Open
10000DOO wants to merge 2 commits intozed-extensions:mainfrom
Open
Add C, C++, and Objective-C language support for sourcekit-lsp#7010000DOO wants to merge 2 commits intozed-extensions:mainfrom
10000DOO wants to merge 2 commits intozed-extensions:mainfrom
Conversation
Migrate from deprecated `language` field to `languages` array and register sourcekit-lsp for C, C++, and Objective-C in addition to Swift. sourcekit-lsp natively supports these languages via its built-in clangd integration. This mirrors the approach taken by the official VSCode Swift extension, which declares support for all sourcekit-lsp-supported languages. Closes zed-extensions#47 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
We require contributors to sign our Contributor License Agreement, and we don't have @10000DOO on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'. |
Author
|
@cla-bot check |
|
The cla-bot has been summoned, and re-checked this pull request! |
Without language definitions, Zed cannot recognize .m/.mm/.h files as Objective-C, causing sourcekit-lsp to never start for these files. - Add tree-sitter-objc grammar - Add languages/objective-c/ with config.toml and highlights.scm - Add languages/objective-cpp/ for .mm file support - Add Objective-C++ to sourcekit-lsp language routing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In mixed Xcode projects (Swift + Objective-C), sourcekit-lsp only activates for
.swiftfiles because this extension only declaresSwiftas a supported language.This means:
.m/.mm/.hfiles get no LSP support from sourcekit-lspSolution
sourcekit-lsp already handles C, C++, Objective-C, and Objective-C++ internally via its embedded clangd integration. The server is ready — Zed just isn't routing those file types to it.
This PR:
languagefield to thelanguagesarrayThis matches how the official VSCode Swift extension already works:
https://github.com/swiftlang/vscode-swift/blob/fd00b062831a3919b07071b8b5f5e6a5690c6e8a/src/configuration.ts#L153-L157
Also,
xcode-build-serveralready generatesbuildServer.jsonwith all 5 languages declared — so the server side is already set up for this.Changes
extension.toml: