Problem
smart_outline, smart_search, and smart_unfold fail for C (.c, .h) and C++ (.cpp, .cc, .cxx, .hpp) files with:
Could not parse . File may use an unsupported language or be empty.
Root Causes
Three issues were identified and fixed locally:
1. Missing C/C++ query patterns in Fu object
The Fu object in mcp-server.cjs has no c or cpp entries. C files fall back to the generic query, which uses function_declaration — a node type that doesn't exist in the C tree-sitter grammar. The query compilation fails silently, returning 0 symbols.
Fix: Add c and cpp query entries to Fu:
// C query
c: `
(function_definition declarator: (function_declarator declarator: (identifier) @name)) @func
(struct_specifier name: (type_identifier) @name) @struct_def
(type_definition declarator: (type_identifier) @name) @tdef
(enum_specifier name: (type_identifier) @name) @enm
(preproc_include path: (_) @name) @imp
`
// C++ query (adds qualified_identifier and namespace_definition)
cpp: `
(function_definition declarator: (function_declarator declarator: (identifier) @name)) @func
(function_definition declarator: (function_declarator declarator: (qualified_identifier name: (identifier) @name))) @func
(class_specifier name: (type_identifier) @name) @cls
(struct_specifier name: (type_identifier) @name) @struct_def
(namespace_definition name: (identifier) @name) @cls
(type_definition declarator: (type_identifier) @name) @tdef
(enum_specifier name: (type_identifier) @name) @enm
(preproc_include path: (_) @name) @imp
`
And update AS() to map "c" → "c" and "cpp" → "cpp" instead of falling through to "generic".
2. OS() function can't find tree-sitter.exe on Windows
The OS() function checks for the tree-sitter binary with existsSync(path), but on Windows the binary is tree-sitter.exe. Since existsSync("tree-sitter") returns false, it falls back to "tree-sitter" which isn't on PATH, causing execFileSync to fail silently.
Fix: Add Windows .exe check:
function OS() {
if (zr) return zr;
try {
let t = Hi.resolve("tree-sitter-cli/package.json");
let e = B.join(B.dirname(t), "tree-sitter");
if (ee.existsSync(e)) return zr = e, e;
// Fix: check for .exe on Windows
if (process.platform === "win32") {
let n = e + ".exe";
if (ee.existsSync(n)) return zr = n, n;
}
} catch {}
return zr = "tree-sitter", zr;
}
3. tree-sitter native binding missing for Windows + Node 22
The tree-sitter npm package has no prebuilt binary for win32-x64 with Node.js ABI 127. Requires manual npm rebuild tree-sitter after installing VS Build Tools.
Environment
- OS: Windows 11
- Node.js: v22.20.0
- claude-mem: 12.4.9
- Claude Code plugin system
Workaround
Applied all three fixes locally to both ~/.claude/plugins/cache/thedotmack/claude-mem/12.4.9/scripts/mcp-server.cjs and ~/.claude/plugins/marketplaces/thedotmack/plugin/scripts/mcp-server.cjs. All three smart-explore tools now work correctly for C and C++ files.
Problem
smart_outline,smart_search, andsmart_unfoldfail for C (.c,.h) and C++ (.cpp,.cc,.cxx,.hpp) files with:Root Causes
Three issues were identified and fixed locally:
1. Missing C/C++ query patterns in
FuobjectThe
Fuobject inmcp-server.cjshas nocorcppentries. C files fall back to thegenericquery, which usesfunction_declaration— a node type that doesn't exist in the C tree-sitter grammar. The query compilation fails silently, returning 0 symbols.Fix: Add
candcppquery entries toFu:And update
AS()to map"c"→"c"and"cpp"→"cpp"instead of falling through to"generic".2.
OS()function can't findtree-sitter.exeon WindowsThe
OS()function checks for the tree-sitter binary withexistsSync(path), but on Windows the binary istree-sitter.exe. SinceexistsSync("tree-sitter")returnsfalse, it falls back to"tree-sitter"which isn't on PATH, causingexecFileSyncto fail silently.Fix: Add Windows
.execheck:3. tree-sitter native binding missing for Windows + Node 22
The
tree-sitternpm package has no prebuilt binary forwin32-x64with Node.js ABI 127. Requires manualnpm rebuild tree-sitterafter installing VS Build Tools.Environment
Workaround
Applied all three fixes locally to both
~/.claude/plugins/cache/thedotmack/claude-mem/12.4.9/scripts/mcp-server.cjsand~/.claude/plugins/marketplaces/thedotmack/plugin/scripts/mcp-server.cjs. All three smart-explore tools now work correctly for C and C++ files.