Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,35 @@

Support for Objective-C/C++ in Zed

## Setup

Since Zed has a built-in `clangd` language server, you need to configure your settings to use `objcpp-clangd` for Objective-C/C++ files. Add the following to your Zed `settings.json`:

```json
{
"languages": {
"Objective-C": {
"language_servers": ["objcpp-clangd", "!clangd"]
},
"Objective-C++": {
"language_servers": ["objcpp-clangd", "!clangd"]
}
}
}
```

If Zed doesn't recognize `.m`/`.mm` files as Objective-C, you may also need:

```json
{
"file_types": {
"Objective-C": ["m", "mm"]
}
}
```

This enables `objcpp-clangd` (provided by this extension) and disables the built-in `clangd` for Objective-C/C++ files.

<img width="3440" height="1431" alt="image" src="https://github.com/user-attachments/assets/11e12f7d-9785-404a-bf9c-e1c618b8ee19" />

-----------------------
Expand Down
6 changes: 3 additions & 3 deletions extension.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ schema_version = 1
authors = ["Akzestia <akzestia@gmail.com>"]
repository = "https://github.com/Akzestia/objcpp"

[language_servers.clangd]
name = "clangd"
languages = ["Objective-C"]
[language_servers.objcpp-clangd]
name = "objcpp-clangd"
languages = ["Objective-C", "Objective-C++"]

[grammars.objc]
repository = "https://github.com/tree-sitter-grammars/tree-sitter-objc"
Expand Down
2 changes: 1 addition & 1 deletion src/objc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl zed::Extension for ObjcLspExtension {
) -> Result<Command> {
let path = worktree
.which("clangd")
.ok_or_else(|| "clangd must be installed and available in PATH".to_string())?;
.ok_or_else(|| "objcpp-clangd: clangd must be installed and available in PATH".to_string())?;

Ok(zed::Command {
command: path,
Expand Down