You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Maintained engine: the first completion in a just-opened module importer waits for its first preamble #50
With the maintained engine (mcppls-clangd 0.0.12, 23.1.0-mcppls.0), completion in a module importer that was just opened waits for the file's first preamble. That takes several seconds on a real project. For example, in xlings src/core/xself/doctor.cpp the first build of about 100 prerequisite modules takes about 3.3 s locally and longer on CI runners. Until the preamble exists, each completion runs past the server's 1 s budget and mcppls's own engine answers it. After that, completion answers in 35–390 ms.
Stock clangd 23.1 answers at once in that window, from its fallback without a preamble. That fallback leaves out imported declarations, and after ., -> or :: it is empty (the 0.0.11 "popup never came" report).
Cause
This is intended engine behavior. In modules mode, mcppls-clangd's code completion runs on TUScheduler::Stale instead of StaleOrAbsent (patch 0008, the "first module completion" change of UP-25), so a first completion waits for the first preamble instead of giving an import-blind answer.
Measured locally on the same workspace, warm cache, 40 s of 10 Hz typing (ux-xlings U5):
completions during the first preamble
after it
stock 23.1
7–16 ms (fallback)
p95 ≈ 0.2 s
mcppls-clangd 0.0.12
1.4–6.3 s (past the 1 s budget, answered by mcppls)
35–390 ms
Decision for 0.0.12
The wait on first open is accepted. The ux typing checks now report it as their own "first-open" measurement and hold p95 and engine share to the unchanged budgets for the completions after the engine's first answer.
To improve later
A bounded wait: wait for the first preamble up to a budget (about 800 ms), then answer as upstream does and let the semantic answer follow.
A faster first preamble on a warm cache: the BMIs are all reused, and the time goes to validating each prerequisite again. A validation memo that persists across processes, keyed by the same exact inputs, would remove most of it.
Priority for the edited file: at startup, prime units' prerequisite work shares the bounded build pool with the file being typed in. The focused file should go first.
Activity
fix(engine): the maintained engine compiles in process under PRoot, a…
mcpp-language-server 0.0.12: the maintained mcppls-clangd engine, hea…