Phase 6a (cont.): reconcile editor toolchain with the rename

Updated the LSP indexer (ludic_index.h), completion snippets (ludic_lsp.c),
check-docs wrapper, and the fmt/LSP test fixtures (test-tools.sh, test-lsp.py)
to the new keywords. Fixed two pre-existing bugs surfaced along the way:
build-tools.sh had a set -e bug (a failing find|while pipeline in a command
substitution) that silently prevented ALL rebuilds since the first build, so the
editor binaries were stale; and an LSP test offset was calibrated to the old
keyword length. test.sh 14/14, test-tools 28/0, check-docs + check-vocabulary
green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-08-27 18:34:57 +03:00
parent 42f955fd22
commit 69fe39bff1
5 changed files with 40 additions and 40 deletions

View file

@ -421,14 +421,14 @@ static void lp_decl(LP* p, int parent){
}
return;
}
if (!strcmp(w, "component") || !strcmp(w, "archetype")){
int is_comp = !strcmp(w, "component");
if (!strcmp(w, "property") || !strcmp(w, "model")){
int is_comp = !strcmp(w, "property");
lp_adv(p); int nt = lp_name(p); if (nt < 0) return;
int s = lsym_add(D, is_comp ? LS_COMPONENT : LS_ARCHETYPE, nt, parent);
ldoc_collect_doc(D, decl_tok, D->sym[s].doc, sizeof(D->sym[s].doc));
while (lp_kind(p) == LT_ANNO) lp_adv(p);
snprintf(D->sym[s].detail, sizeof(D->sym[s].detail), "%s %s {",
is_comp ? "component" : "archetype", D->sym[s].name);
is_comp ? "property" : "model", D->sym[s].name);
if (!lp_is(p, "{")) return;
int close = D->match[p->i];
D->sym[s].body_start = D->lex.v[p->i].start;
@ -518,8 +518,8 @@ static void lp_decl(LP* p, int parent){
}
return;
}
if (!strcmp(w, "system") || !strcmp(w, "edge")){
if (!strcmp(w, "edge")){ lp_adv(p); if (!lp_is(p, "system")) return; }
if (!strcmp(w, "handler") || !strcmp(w, "edge")){
if (!strcmp(w, "edge")){ lp_adv(p); if (!lp_is(p, "handler")) return; }
lp_adv(p);
int nt = lp_name(p); if (nt < 0) return;
int s = lsym_add(D, LS_SYSTEM, nt, parent);
@ -638,15 +638,15 @@ static void ldoc_parse(LDoc* D){
lp_skipnl(&p);
while (lp_is(&p, "import")) { lp_decl(&p, -1); lp_skipnl(&p); }
int unit_parent = -1;
if (lp_is(&p, "game") || lp_is(&p, "module")){
D->is_module = lp_is(&p, "module");
if (lp_is(&p, "program") || lp_is(&p, "program")){
D->is_module = lp_is(&p, "program");
D->is_unit = 1;
lp_adv(&p);
int nt = lp_name(&p);
if (nt >= 0){
unit_parent = lsym_add(D, LS_UNIT, nt, -1);
lcpy(D->unit, sizeof(D->unit), D->sym[unit_parent].name, (int)strlen(D->sym[unit_parent].name));
lcatf(D->sym[unit_parent].detail, sizeof(D->sym[unit_parent].detail), "%s %s", D->is_module ? "module" : "game", D->unit);
lcatf(D->sym[unit_parent].detail, sizeof(D->sym[unit_parent].detail), "%s %s", D->is_module ? "program" : "program", D->unit);
}
if (lp_is(&p, "{")){
int close = D->match[p.i];

View file

@ -1080,13 +1080,13 @@ static void on_completion(JVal* msg, JVal* id){
comp_builtins(&c);
comp_scope(&c, D, off, 0);
/* the shapes people actually type */
comp_item(&c, "system", CI_SNIPPET, "system … phase … { }", "A system with a phase and a body.",
comp_item(&c, "handler", CI_SNIPPET, "handler … phase … { }", "A system with a phase and a body.",
"system ${1:Name} phase ${2|Start,Input,FixedUpdate,Update,LateUpdate,Render|} {\n $0\n}");
comp_item(&c, "system+query", CI_SNIPPET, "system … query … { }", "A system that runs once per matching entity.",
comp_item(&c, "system+query", CI_SNIPPET, "handler … query … { }", "A system that runs once per matching entity.",
"system ${1:Name} phase ${2|Update,FixedUpdate,LateUpdate,Render,Input|}\n query (${3:p}) [${4:Pos}]\n{\n $0\n}");
comp_item(&c, "component", CI_SNIPPET, "component … { }", "A component with typed fields.",
comp_item(&c, "property", CI_SNIPPET, "property … { }", "A component with typed fields.",
"component ${1:Name} { ${2:x}: ${3:int} = ${4:0} }");
comp_item(&c, "archetype", CI_SNIPPET, "archetype … { }", "An entity kind bundling components.",
comp_item(&c, "model", CI_SNIPPET, "archetype … { }", "An entity kind bundling components.",
"archetype ${1:Name} {\n ${2:Pos}\n}");
comp_item(&c, "for-query", CI_SNIPPET, "for (…) in query […] { }", "Iterate matching entities.",
"for (${1:p}) in query [${2:Pos}] {\n $0\n}");