feat(code): full parser coverage for 15 languages + Markdown, CSS, HTML (#180)
Expand the code domain plugin to achieve maximum symbol extraction across all supported file types, closing every previously identified gap.
Language gap fills (existing tree-sitter adapters): - JS/JSX: arrow functions and function expressions bound to const/let captured as `function` symbols; async keyword detection via `async_node_child` field promotes to `async_function`/`async_method` - TS/TSX: same arrow-function patterns; `async_node_child` wired up - Go: package-level `const_spec` and `var_spec` captured as `variable` - Rust: `static_item`, `const_item`, `type_item` → `variable`; `mod_item` → `class` - C: `struct_specifier` and `enum_specifier` → `class` - C++: `enum_specifier` → `class`; out-of-class method definitions via `qualified_identifier`; `namespace_definition` → `class` - C#: `property_declaration` → `variable`; `record_declaration` → `class` - Java: `annotation_type_declaration` and `record_declaration` → `class` - Kotlin: `object_declaration` → `class`; top-level `property_declaration` → `variable` (uses `identifier` throughout — grammar has no `type_identifier`/`simple_identifier` at this version)
New adapters: - MarkdownAdapter: extracts ATX headings (h1–h6) as `section` symbols via tree-sitter-markdown; degrades to file-level tracking without it - HtmlAdapter: extracts semantic elements (section, article, nav, h1–h6, …) and any element bearing an `id` attribute as `section` symbols via tree-sitter-html; degrades gracefully without the package - _CSS_SPEC / _SCSS_SPEC: `rule_set` → `rule`, `keyframes_statement` → `rule`, `media_statement` → `rule` via tree-sitter-css - _SWIFT_SPEC: full Swift symbol extraction (functions, classes, structs, enums, protocols, type aliases, computed properties, initialisers) via py-tree-sitter-swift; degrades to file-level tracking without it
Infrastructure: - `SymbolKind` extended with `"section"` and `"rule"` literals - `LangSpec` gains `async_node_child: str` — empty string disables async promotion; non-empty names the direct child token to check - `TreeSitterAdapter.parse_symbols` honours `async_node_child` to promote `function`→`async_function` and `method`→`async_method` - pyproject.toml: adds tree-sitter-markdown, tree-sitter-html, tree-sitter-css as hard dependencies; documents Swift as optional - mypy overrides: adds stubs ignore for all four new grammar modules
Tests: 141 tests in test_code_plugin.py (was 103); all 2545 suite green.
Co-authored-by: Gabriel Cardona <gabriel@tellurstori.com>
No comments yet. Be the first to start the discussion.