Skip to content

feat: Support project-level ls_specific_settings#1192

Merged
MischaPanch merged 5 commits intooraios:mainfrom
code4lala:allow-cpp-ls_path-in-project-yml
Mar 23, 2026
Merged

feat: Support project-level ls_specific_settings#1192
MischaPanch merged 5 commits intooraios:mainfrom
code4lala:allow-cpp-ls_path-in-project-yml

Conversation

@code4lala
Copy link
Copy Markdown
Contributor

@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
Copy Markdown
Contributor Author

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

@MischaPanch
Copy link
Copy Markdown
Contributor

Thanks @code4lala . Some minor things are off, I pushed a fix.

@opcode81 could you have a quick look? From my side it's good to merge.

I remember having a PR with a similar change somewhere but I couldn't find it now

@MischaPanch MischaPanch changed the title feat: Support project-level clangd path configuration via project.yml feat: Support project-level ls_specific_settings Mar 23, 2026
Comment thread src/serena/project.py Outdated
@MischaPanch MischaPanch force-pushed the allow-cpp-ls_path-in-project-yml branch from 020cc04 to bc001eb Compare March 23, 2026 16:44
@MischaPanch MischaPanch merged commit bf92f3c into oraios:main Mar 23, 2026
3 of 4 checks passed
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.

3 participants