Skip to content

fix: add .m extension to EXT_TABLE for content-based disambiguation#306

Merged
DeusData merged 1 commit intoDeusData:mainfrom
KuaaMU:fix/m-files-missing
May 10, 2026
Merged

fix: add .m extension to EXT_TABLE for content-based disambiguation#306
DeusData merged 1 commit intoDeusData:mainfrom
KuaaMU:fix/m-files-missing

Conversation

@KuaaMU
Copy link
Copy Markdown
Contributor

@KuaaMU KuaaMU commented Apr 30, 2026

Problem

.m files (MATLAB, Objective-C, Magma) are silently ignored by the indexer. detect_file_language returns CBM_LANG_COUNT before the content-based disambiguation logic (cbm_disambiguate_m) can run, because .m is missing from EXT_TABLE.

Root Cause

In src/discover/language.c, EXT_TABLE includes .matlab and .mlx but omits .m. The lookup in cbm_language_for_filename returns Unknown, causing detect_file_language to abort early.

Fix

Add {".m", CBM_LANG_MATLAB} to EXT_TABLE in the MATLAB section. The initial mapping to MATLAB is safe because the subsequent cbm_disambiguate_m call (already in detect_file_language) will correctly overwrite it by reading file contents.

Fixes #296

The .m extension was missing from EXT_TABLE, causing detect_file_language
to return CBM_LANG_COUNT (Unknown) before the content-based disambiguation
logic (cbm_disambiguate_m) could ever run. This made .m files invisible
to the indexer.

Add {".m", CBM_LANG_MATLAB} to EXT_TABLE so the initial lookup succeeds,
allowing the subsequent cbm_disambiguate_m call to correctly determine
whether the file is MATLAB, Objective-C, or Magma.

Fixes DeusData#296
@DeusData DeusData added bug Something isn't working parsing/quality Graph extraction bugs, false positives, missing edges labels May 4, 2026
@DeusData DeusData merged commit 1a4973d into DeusData:main May 10, 2026
@DeusData
Copy link
Copy Markdown
Owner

Merged via rebase, thanks @KuaaMU. This is exactly the unreachable-code shape the project's review notes call out — detect_file_language had the cbm_disambiguate_m branch sitting downstream of an early return that fired on every .m file, so the disambiguation logic was dead the moment a .m showed up. Adding .m to EXT_TABLE makes the existing content-detection path reachable, which is the right fix (rather than rewriting the disambiguation flow). Issue #296 auto-closed with the merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working parsing/quality Graph extraction bugs, false positives, missing edges

Projects

None yet

Development

Successfully merging this pull request may close these issues.

# Bug: .m files are ignored by the indexer (Unreachable code in discover.c)

2 participants