Maintained engine: the first completion in a just-opened module importer waits for its first preamble

Abierto
#50 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
15/100
Tipo de issue
Nueva funcionalidad
Claridad
Necesita aclaración
Estado de actividad
Activo
Stack tecnológico
cpp

Línea de trabajo

The first-completion wait comes from patch 0008, which switches code completion to TUScheduler::Stale in modules mode, so start from that change and the StaleOrAbsent path it replaces. The issue describes three possible improvements, and the work requires choosing one, either a bounded wait of about 800 ms, a persistent validation memo, or prioritizing the edited file in the prime pool. Done means a decision recorded on the issue, and any change verified against the ux-xlings U5 typing checks.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

enhancement

Symptom

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

  1. 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.
  2. 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.
  3. 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.
Lenguaje dominante
C++
Estrellas
25
Forks
2
Merge medio
21 h 5 min
PR fusionados (30 d)
13

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Sunrisepeak/mcpp-language-server

Todos los issues de Sunrisepeak/mcpp-language-server

Issues similares

Más issues de C++

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.