diff --git a/README.md b/README.md index fa8567b..27cb32c 100644 --- a/README.md +++ b/README.md @@ -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. + image ----------------------- diff --git a/extension.toml b/extension.toml index 33c7e94..28e1c93 100644 --- a/extension.toml +++ b/extension.toml @@ -6,9 +6,9 @@ schema_version = 1 authors = ["Akzestia "] 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" diff --git a/src/objc.rs b/src/objc.rs index ae858c4..1f5884e 100644 --- a/src/objc.rs +++ b/src/objc.rs @@ -39,7 +39,7 @@ impl zed::Extension for ObjcLspExtension { ) -> Result { 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,