Skip to content

0.0.16: clangd checks a file once typing pauses, an unchanged build input is no change, a module that failed in an import is named, build.mcpp beside the mcpp extension - #58

Merged
Sunrisepeak merged 4 commits into
mainfrom
release/0.0.16
Oct 13, 2026
Merged

Sunrisepeak merged 4 commits into
mainfrom
release/0.0.16

Conversation

@Sunrisepeak

Copy link
Copy Markdown
Owner

Part of a cross-repository plan (.agents/docs/2026-10-14-cross-repo-build-mcpp-and-typing-cpu-plan.md) with mcpp-community/mcpp-vscode#18 and mcpp-community/mcpp-plugins#47, both merged.

What changes

Typing (A4). clangd built the file at every key: its debounce follows its build time, which is about a person's pace between keys, and VS Code's semantic tokens / highlights / code actions / hints after each edit force a build of the latest version anyway. The clangd engine now sends each version of a file being typed in with wantDiagnostics: false, holds the requests that build the file (the latest of each kind; replaced ones answered ContentModified), and once the keys stop for clamp(1.2 x last build, 300 ms, 1 s) sends the same version with empty contentChanges and wantDiagnostics: true. Build programs, module units and a change that leaves the text unchanged are not held. Setting mcppls.engine.diagnosticsWhileTyping (auto default, always = 0.0.15).

  • Verified first against the bundled clangd: wantDiagnostics: false publishes nothing; the same-version empty change with true publishes the latest text's diagnostics, also when a request already built the AST.
  • Bench (Qt headers + import std + import nlohmann.json, typing std::vec, delete, arr, delete, fin at 200 ms with VS Code's request mix, 3 rounds): clangd CPU 5.23-5.36 s -> 2.90-3.06 s (-43%), BuildAST 16 -> 3, semanticTokens builds 14 -> 1.
  • Fixture typing-pause (all four platforms): 0 publications during 21 keys (0.0.15: 15), the latest version diagnosed within 5 s, the last semanticTokens answered with tokens.

Idle (A1, A2). mcpp rewrites the lock of a build program's synthesised package on every run and lists it in data.watch (mcpp-community/mcpp#807): with a build.mcpp, the project was described every 2 s of an idle session. A build file or producer input holding the bytes the last description read is now no change (changed or created; deleted always counts). mcpp-emit-watch gains W0 (mockmcpp rewriteEachRun), passing on both watch paths; 0.0.15 fails both. A prefetch that came back empty is not asked again until a file or the plan changes (test_answer).

Failed modules (A3). An error inside an imported module or file starts In module 'M' imported from <unit>:<line>: / In file included from <unit>:<line>:; the first <unit> is the failed one. The importer now gets module-failed with the reason; a failure whose unit no plan names is still said on the importer; a hint BMI that was never built says so. Unit tests with real log lines (anonymised, incl. Windows nesting) and fixture module-fails-in-import (0.0.15: ast_file_not_found).

build.mcpp beside mcpp-vscode (A6). The client also selects **/*.mcpp, so an extension that gives build.mcpp its own language id (mcpp-vscode <= 0.6.0) no longer keeps it from mcppls; the server treats .mcpp as C++. The extension API gains otherCppFeatures() ({ active: [{ extensionId, displayName, settable }], canRestore }), asserted in suite-conflicts.

Checked locally

mcpp test (38/38), devtools check all, npm run compile, unit tests (129), and conformance: the new fixtures plus typing-autosave, typing-import, typing-import-spin, module-edit-autosave, module-faults, build-program-*, mcpp-emit-watch (both watch paths), inferred.

…nput is no change, a module that failed in an import is named, build.mcpp beside the mcpp extension

Typing. clangd builds the file at every key: its own debounce follows its build time, about a person's pace between
keys, and VS Code's semantic tokens, highlights, code actions and hints after each edit make it build the latest
version anyway. The clangd engine now gives each version of a file being typed in with `wantDiagnostics: false`, holds
the requests that build the file (the latest of each kind; a replaced one is answered ContentModified) and, once the
keys stop for 0.3-1 s (a little longer than the file's last build), asks for the latest version again with
diagnostics. Build programs and module units, and a change that leaves the text as it was, go as before.
mcppls.engine.diagnosticsWhileTyping: auto (default) or always. On a Qt + import std file: 16 builds to 3, clangd CPU
-43%. Fixture typing-pause.

Idle. mcpp rewrites the lock of a build program's synthesised package on every run and lists it in data.watch
(mcpp-community/mcpp#807), so a project with build.mcpp was described again every two seconds. A build file or
producer input that holds the bytes the last description read is no change, whether changed or created; deleted
always is. A prefetch that came back empty is not asked again until a file or the plan changes. Fixture
mcpp-emit-watch W0 (mockmcpp rewriteEachRun), both watch paths.

Failed modules. clang begins an error in an imported module or file with "In module 'M' imported from <unit>:<line>:"
or "In file included from <unit>:<line>:"; the first <unit> is the one that failed, where mcppls took the file of the
error and dropped the failure. A failure whose unit the plan does not name is still said on its importer, and a
missing BMI with no known reason says so instead of "module file not found". Fixture module-fails-in-import.

build.mcpp. The client also selects **/*.mcpp, whatever language another extension gives it, and the server treats
it as C++; the extension API has otherCppFeatures() for mcpp-vscode's "other C++ language services" row.

Plan: .agents/docs/2026-10-14-cross-repo-build-mcpp-and-typing-cpu-plan.md
…is cleared without from_range, build inputs are keyed by path key; plan: the mcpp-plugins record and the deviations
@Sunrisepeak
Sunrisepeak merged commit d3c3a94 into main Oct 13, 2026
62 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.

1 participant