Skip to content

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

fix(extract): parse the first-branch projection under the terminated-last-line rule

Martin Vogel8a97baabcb5d
diff --git a/internal/cbm/cbm.c b/internal/cbm/cbm.c
index 3dab239d9..e0d5cdd61 100644
--- a/internal/cbm/cbm.c
+++ b/internal/cbm/cbm.c
@@ -2571,10 +2571,10 @@ static void cbm_rescue_defs_from_projection(CBMExtractCtx *raw_ctx, const TSLang
TSTree *tree = NULL;
if (parser) {
ts_parser_reset(parser);
- CBMStringInput input = {projected, (uint32_t)raw_ctx->source_len};
- TSInput ts_input = {&input, cbm_string_read, TSInputEncodingUTF8, NULL};
TSParseOptions opts = {0};
- tree = ts_parser_parse_with_options(parser, NULL, ts_input, opts);
+ /* The projection keeps the raw source's length and line structure,
+ * so it is parsed under the same terminated-last-line rule (#2078). */
+ tree = cbm_parse_source(parser, projected, (uint32_t)raw_ctx->source_len, opts);
}
CBMHashTable *held = tree ? cbm_ht_create(CBM_SZ_256) : NULL;
if (held) {