Skip to content

feat: Support project-level clangd path configuration via project.yml#1192

Open
code4lala wants to merge 4 commits intooraios:mainfrom
code4lala:allow-cpp-ls_path-in-project-yml
Open

feat: Support project-level clangd path configuration via project.yml#1192
code4lala wants to merge 4 commits intooraios:mainfrom
code4lala:allow-cpp-ls_path-in-project-yml

Conversation

@code4lala
Copy link

@code4lala code4lala commented Mar 20, 2026

Summary

This PR adds support for configuring language server-specific settings (such as clangd path) at the project level through .serena/project.yml, previously this configuration was only possible globally via
~/.serena/serena_config.yml.

Background

Previously, users could only specify custom clangd paths using ls_specific_settings.cpp.ls_path in the global ~/.serena/serena_config.yml file. This limitation meant that different projects requiring different clangd
versions or paths could not be configured independently, forcing users to either:

  • Use the same clangd for all projects, or
  • Manually modify the global configuration when switching between projects

Changes

This PR introduces the following changes:

  1. src/serena/config/serena_config.py:

    • Added ls_specific_settings field to the ProjectConfig dataclass
    • Updated _from_dict() method to properly load ls_specific_settings from YAML configuration
  2. src/serena/project.py:

    • Modified LanguageServerFactory creation logic to merge ls_specific_settings from both global (SerenaConfig) and project (ProjectConfig) configurations
    • Project-level settings take precedence over global settings, allowing per-project overrides

Configuration Example

Users can now configure clangd path in their project's .serena/project.yml:

ls_specific_settings:
  cpp:
    ls_path: /path/to/project-specific/clangd

The configuration hierarchy is:

  • Global ~/.serena/serena_config.yml (base configuration)
  • Project .serena/project.yml (overrides global settings)

Testing

The implementation has been verified by:

  1. Removing ls_specific_settings.cpp.ls_path from global ~/.serena/serena_config.yml
  2. Adding the clangd path configuration to a project's .serena/project.yml
  3. Running serena project index --log-level DEBUG and confirming:
    • The custom clangd path is correctly loaded from the project configuration
    • Clangd starts successfully using the specified path without attempting to download the default version

Impact

This change improves the developer experience by:

  • Enabling project-specific language server configurations
  • Allowing different projects to use different clangd versions or paths
  • Reducing the need to modify global configuration when working with multiple projects
  • Making project configurations more self-contained and portable

@code4lala
Copy link
Author

@opcode81 This PR is ready for review! Thanks in advance for taking a look. 🙏 Please let me know if any updates are needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant