Skip to content

feat: index .razor/.cshtml via text chunking; exclude obj/ and generated .g.cs - #343

Merged
flupkede merged 5 commits into
developfrom
features/razor-text-chunking
Oct 16, 2026
Merged

flupkede merged 5 commits into
developfrom
features/razor-text-chunking

Conversation

@flupkede

Copy link
Copy Markdown
Owner

Why

Todo #254 (field test 2026-10-16 on a customer MVC repo): Razor markup was invisible to the index — no extension mapping, so every .razor/.cshtml was skipped (9 .cshtml on disk, 0 in the index). Component usage was findable only through generated obj/**/*_razor.g.cs lines — accidental coverage, not a feature.

What

  • razor | cshtml → Language::Html (the only extension table): Html has no extractor, so the chunker rides the text fallback — directives (@model, @inject, @page) and component tags become searchable without running the C# tree-sitter parser on markup. Watcher + indexer gates key off is_indexable(), so incremental reindex follows automatically.
  • obj/ always excluded (always .NET build output — closes the generated-code leak even when a repo's .gitignore misses it); bin/ deliberately NOT excluded (real scripts in other ecosystems).
  • .g.cs / .designer.cs skipped as generated — the watch layer's comment always claimed .designer.cs was excluded; the list never had it.
  • The accidental .g.cs coverage disappears by design: real .razor files are searchable now. Existing indexes keep leaked chunks until the next reindex (documented).

Tests

3 new: Razor detection (Html mapping, is_indexable, detect()), constants membership (obj in, bin out, generated suffixes match, program.cs negative).

Validation

fmt clean; clippy --all-targets -D warnings clean; cargo test --lib --bins 893+889 green.

…ted .g.cs

Razor markup was invisible to the index: no extension mapping, so every
.razor/.cshtml was skipped (BOIN/KRKA field test 2026-10-16: 9 .cshtml
on disk, 0 in the index; component refs found only through generated
*_razor.g.cs lines). Map razor|cshtml to the Html variant - Html has no
extractor, so the chunker takes the text fallback: markup blocks
(directives, component tags) become searchable without running the C#
tree-sitter parser on them. The watcher and indexer gates key off
is_indexable(), so incremental reindex follows automatically.

Deliberate call (todo #254): ALWAYS_EXCLUDED gains obj (always .NET
build output - closes the generated-code leak even when a repo's
.gitignore misses it); bin is deliberately NOT excluded, other
ecosystems keep real scripts there. ALWAYS_SKIP_FILENAME_SUFFIXES gains
.g.cs and .designer.cs - the watch layer's comment always claimed
.designer.cs was skipped; the list never had it. Existing indexes keep
their leaked obj/ chunks until the next reindex.

The accidental *_razor.g.cs coverage disappears with this - by design:
real .razor files are now searchable themselves.
CHANGELOG entry under pending [1.5.33] (Fixed), one highlights line,
plan ticked. Full validation green: fmt, clippy -D warnings (stage 1),
cargo test --lib --bins 893+889.
@flupkede
flupkede merged commit e9ab636 into develop Oct 16, 2026
3 checks passed
@flupkede
flupkede deleted the features/razor-text-chunking branch October 16, 2026 19:42
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