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.

feat(discover): map .razor to C# so Blazor components are discovered

The1nk44caa4c386c5
diff --git a/src/discover/language.c b/src/discover/language.c
index 666db536f..a9b49b863 100644
--- a/src/discover/language.c
+++ b/src/discover/language.c
@@ -50,6 +50,11 @@ static const ext_entry_t EXT_TABLE[] = {
/* C# */
{".cs", CBM_LANG_CSHARP},
+ /* Blazor components. The C# grammar recovers the @code block; the
+ * surrounding markup parses as ERROR regions and is reported via
+ * parse_partial, which is why this is a best-effort mapping rather
+ * than a dedicated grammar. */
+ {".razor", CBM_LANG_CSHARP},
/* Clojure */
{".clj", CBM_LANG_CLOJURE},
diff --git a/tests/test_language.c b/tests/test_language.c
index 2c8d6576b..1bcd5e040 100644
--- a/tests/test_language.c
+++ b/tests/test_language.c
@@ -89,6 +89,14 @@ TEST(lang_ext_csharp) {
ASSERT_EQ(cbm_language_for_extension(".cs"), CBM_LANG_CSHARP);
PASS();
}
+/* Blazor components were unmapped, so a .razor file was never discovered at
+ * all: indexing a Blazor app produced no nodes for any component, and reaching
+ * them required an undocumented extra_extensions entry in a per-project
+ * .codebase-memory.json. */
+TEST(lang_ext_razor) {
+ ASSERT_EQ(cbm_language_for_extension(".razor"), CBM_LANG_CSHARP);
+ PASS();
+}
TEST(lang_ext_php) {
ASSERT_EQ(cbm_language_for_extension(".php"), CBM_LANG_PHP);
PASS();
@@ -1197,6 +1205,7 @@ SUITE(language) {
RUN_TEST(lang_ext_h);
RUN_TEST(lang_ext_ixx);
RUN_TEST(lang_ext_csharp);
+ RUN_TEST(lang_ext_razor);
RUN_TEST(lang_ext_php);
RUN_TEST(lang_ext_lua);
RUN_TEST(lang_ext_scala);