Skip to content

mcpp projects: no root compile_commands.json by default; read mcpp's result record for fallback and refresh #71

Open

Description

@speak-agent

Context

The next mcpp release changes two things mcppls touches on mcpp projects (design: mcpp/.agents/docs/2026-10-26-control-contract-runtime-and-ide-ecosystem-design.md, §7 and §5.2):

  1. The project-root compile_commands.json is no longer written by default. It becomes opt-in through [build] compile_commands = "<path>" in mcpp.toml (or a default in ~/.mcpp/config.toml). An existing root copy is no longer updated, and mcpp prints a one-time note. The per-configuration database (target/<triple>/<fp>/compile_commands.json) stays.
  2. mcpp writes a result record after every build (target/<triple>/<fp>/result.json, kind mcpp.result), plus a project-level pointer target/.last-result.json naming the most recent configuration. The record carries the configuration's compile database path, the diagnostics, and the artifacts.

What this means for mcppls

  • Fallback path. McppProvider::describe falls back to a leftover root compile_commands.json when mcpp cannot be asked (src/project/mcpp.cppm:41). After the change, that file is usually absent. The fallback should read the database named by target/.last-result.json first, and the root file only when the pointer is missing (older mcpp).
  • Refresh after a build. Watching target/.last-result.json (written by atomic rename) tells mcppls that a build finished, whoever ran it: a terminal, an agent's shell, or an IDE. Today the refresh is forwarded by the editor extension.
  • CLion. Without a root compile_commands.json, CLion no longer loads an mcpp project as a Compilation Database workspace, so ClionModel no longer treats it as CLion's and mcppls starts by default. No code change is expected; an e2e assertion would pin it.

Nothing breaks immediately: the primary path (mcpp emit build-database) is unchanged. This issue tracks adopting the result record when that mcpp release ships.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions