Skip to content

Deduplicate or replace built-in LSP servers when user config defines the same server id #56

@darkodus

Description

@darkodus

Description

When configuring AFT LSP servers, defining a custom server with the same id as a built-in server appears to create multiple matching server entries instead of replacing or clearly merging with the built-in one.

Example intent:

{
  "lsp": {
    "servers": {
      "clangd": {
        "args": ["--query-driver=/path/to/arm-none-eabi-*"],
        "root_markers": ["CMakeLists.txt", ".clangd", "compile_commands.json", ".git"]
      }
    }
  }
}

Expected behavior would be that the configured clangd entry replaces or predictably merges with the built-in clangd server.

Observed behavior was that diagnostics appeared to use multiple clangd entries for the same file, with one server using the default config and another using the custom config/root markers. The workaround was to disable the built-in server and register a differently named server, for example custom-clangd.

Use case

Embedded C/C++ projects often need to customize clangd with cross-compilation arguments such as --query-driver, custom root markers, or compile-database settings. It would be cleaner if users could customize the built-in clangd server directly while keeping the canonical server id.

Current workaround:

{
  "lsp": {
    "disabled": ["clangd"],
    "servers": {
      "custom-clangd": {
        "extensions": [".c", ".cc", ".cpp", ".cxx", ".h", ".hh", ".hpp", ".hxx"],
        "binary": "clangd",
        "args": ["--query-driver=/path/to/arm-none-eabi-*"],
        "root_markers": ["CMakeLists.txt", ".clangd", "compile_commands.json", ".git"]
      }
    }
  }
}

This works, but it feels like a workaround and makes global config project-specific. Ideally users could keep the server id as clangd and override or extend only the fields they need.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions