Skip to content

Engine restart loop on std.compat.ixx argument differences leaves workspace degraded; Format Document no-op for hcg-generated source #95

Closed

Description

@yizhinailong

Summary

In a Windows C++23 mcpp project that uses HuxerUI's hcg composable transform, mcppls 0.23.0 repeatedly restarts its clangd engine and ends in a degraded state. The restart reason is a plan diff for the standard-library module units (std.ixx, std.compat.ixx), whose compile commands differ between compile sets only in include directories.

As a user-visible consequence, Format Document does nothing for the open src/app.cppm, while src/main.cpp formats normally.

Environment

Component Version
mcppls 0.23.0 (win32-x64)
bundled clangd 23.1.0-mcppls.12
VS Code 1.147.0
OS Windows 11 Pro 10.0.26200
mcpp 2026.11.20.1
toolchain clang 23.1.3, MSVC STL 14.52.37025, Windows SDK 10.0.26100.0
target x86_64-pc-windows-msvc

Steps to reproduce

  1. Create a C++23 mcpp app that uses HuxerUI with [[huxerui::composable]], hcg enabled, and [build] sources = [].
  2. Run mcpp build once so the build database and generated sources exist.
  3. Open src/app.cppm in VS Code and let mcppls settle.
  4. Run mcppls status.
  5. Run Format Document on src/app.cppm (or save with editor.formatOnSave).

Expected

  • The clangd engine stays healthy; the workspace is not degraded.
  • Format Document applies the project .clang-format to the open file.

Actual

  • mcppls status reports degraded.
  • The diagnostic bundle contains multiple restart-backoff incidents with:
cause: plan
reason: units are compiled with other arguments (std.compat.ixx)
  • The engine plan diff shows the same standard-library unit compiled with different include arguments:
firstDifference: argument 1:
  -I...\mcpplibs.huxerui\...\include
  ->
  -I...\mcpplibs-x-openkal\0.26.0\openkal-0.26.0\include
  • Format Document does not modify src/app.cppm. src/main.cpp formats normally; clangd logs a successful textDocument/formatting reply for it.
  • The project plan reports:
{
  "issueCount": 1,
  "issues": [{
    "code": "ambiguous-module",
    "file": "D:/WorkSpace/mcpp/hui/src/app.cppm",
    "message": "module app has 2 providers; using src_app.cppm"
  }],
  "leftOut": ["D:/WorkSpace/mcpp/hui/src/app.cppm"],
  "openSources": ["D:/WorkSpace/mcpp/hui/src/app.cppm"]
}
  • The CLI formatter works:
clang-format -i src/app.cppm

with clang-format 23.1.6 and the project .clang-format produces the expected formatting, so the issue is in the editor/engine path rather than in clang-format.

Analysis

The build database contains several compile sets (the host build program and the target application). The same std.ixx / std.compat.ixx unit appears in more than one set with different include directories. mcppls treats this as “units are compiled with other arguments” and restarts clangd; repeated plan changes exhaust the restart budget and leave the engine in backoff.

Two questions:

  1. Can mcppls avoid restarting for differences in include directories on standard-library module units that are reused, or can mcpp emit a deduplicated/consistent command for these units?
  2. src/app.cppm is leftOut because hcg replaces the original composable source with src_app.cppm in the compile database. The ambiguity is understandable, but an open buffer should still be formattable via clang-format even when it is not the engine's module provider. Could textDocument/formatting be made independent of the engine database, or could the original path be mapped to the generated copy for semantic features while keeping formatting on the original?

Diagnostic bundle

The redacted bundle is attached in the comment below:

The bundle was exported by mcppls 0.23.0 with redacted: true; manifest.json reports residueCheck: passed and 16,234 home-directory redactions (home paths are shown as ~). It contains the manifest, environment, aggregate report, engine plan and compile commands, four restart-backoff incidents (each with incident.json and clangd.log), and the client/server logs.

Additional context

  • The app builds and runs; this is an editor tooling issue.
  • mcppls is configured with --fallback-style=mcpp.
  • The project .clang-format is located above the workspace root (D:\WorkSpace\.clang-format); this may be a separate sandbox/grant observation.
  • A minimal repro repository can be provided if needed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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