Skip to content

feat: add Objective-C language support#165

Open
0x1306a94 wants to merge 1 commit into
colbymchenry:mainfrom
0x1306a94:feat/objc-language-support
Open

feat: add Objective-C language support#165
0x1306a94 wants to merge 1 commit into
colbymchenry:mainfrom
0x1306a94:feat/objc-language-support

Conversation

@0x1306a94
Copy link
Copy Markdown

@0x1306a94 0x1306a94 commented May 18, 2026

Summary

Adds partial Objective-C support to the tree-sitter extraction pipeline so iOS/macOS codebases can be indexed with the same graph queries as other languages.

Wiring

  • Register objc in LANGUAGES, WASM_GRAMMAR_FILES (tree-sitter-objc.wasm from tree-sitter-wasms, ABI 14), and EXTRACTORS
  • Map .m / .mmobjc; classify .h as Objective-C when content matches @interface / @implementation / @protocol / @synthesize (after the existing C++ .h heuristic)
  • File discovery uses zero-config isSourceFile + .gitignore — no separate include globs needed

Extraction (objc.ts)

  • Classes@interface emits one class node; @implementation reuses it via visitNode (avoids duplicate class/method nodes)
  • Protocols@protocolprotocol nodes
  • Methodsmethod_definition only; full multi-part selectors (doThing:with:) via resolveName
  • Properties@property via extractPropertyName (walks struct_declarator / pointer_declarator)
  • Functions & imports — C-style function_definition and #import (preproc_include)
  • Inheritanceextends for superclass; implements for angle-bracket protocols on @interface
  • Callscall_expression and [receiver message] (message_expression) call edges

Core hooks

  • resolveName / extractPropertyName on LanguageExtractor (used by ObjC; generic fallbacks unchanged)
  • extractInheritance early-return branch for class_interface
  • Import resolver try-order: .h, .m, .mm

Docs & eval corpus

  • README: Partial support row (not full — documents .mm ObjC++ limits)
  • CHANGELOG [Unreleased] entry with known limitations
  • Agent-eval corpus: Masonry (small), FMDB (medium), SDWebImage (large)

Benchmark (local dev build)

Repo Files Nodes verify-extraction Notes
Masonry 267 1,418 PASS A/B: 6 tool calls / 1 Read vs 18 / 15 Reads
FMDB ~80 PASS
SDWebImage 274 3,710 PASS

Known limitations

  • Chained/nested message sends (e.g. [[Class alloc] init]) only record the innermost method name
  • No instantiates edge for [Class alloc] patterns
  • @protocol Foo <Bar> refinement lists not yet wired to implements edges
  • Heavy C++ in .mm files may parse incompletely under the ObjC grammar

Test plan

  • npm run build
  • npx vitest run __tests__/extraction.test.ts -t "Objective-C" (7 tests)
  • node scripts/add-lang/verify-extraction.mjs on sample + Masonry / FMDB / SDWebImage

@0x1306a94 0x1306a94 force-pushed the feat/objc-language-support branch 2 times, most recently from 74ca84e to ed563b2 Compare May 22, 2026 02:44
@0x1306a94 0x1306a94 changed the title feat(objc): add Objective-C extraction for .m, .mm, and ObjC .h feat(extraction): add Objective-C indexing for .m, .mm, and ObjC headers May 22, 2026
@0x1306a94 0x1306a94 changed the title feat(extraction): add Objective-C indexing for .m, .mm, and ObjC headers feat: add Objective-C language support May 22, 2026
Wire tree-sitter-objc for .m/.mm/ObjC headers: classes, protocols,
methods, @Property, #import edges, inheritance, and message-send calls.
@0x1306a94 0x1306a94 force-pushed the feat/objc-language-support branch from ed563b2 to b45ff3e Compare May 22, 2026 02:50
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