Skip to content

feat: add Swift tree-sitter support#18

Merged
jahala merged 4 commits into
mainfrom
feat/csharp-support
Mar 6, 2026
Merged

feat: add Swift tree-sitter support#18
jahala merged 4 commits into
mainfrom
feat/csharp-support

Conversation

@jahala

@jahala jahala commented Mar 6, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add tree-sitter-swift grammar for full AST-aware code intelligence on .swift files
  • Wire Swift outlines: classes, structs, enums, protocols, extensions, functions, properties, init/deinit
  • Add callee extraction for call_expression (direct calls and member access via navigation_expression)
  • Add sibling extraction for self. references via self_expression + navigation_suffix
  • Handle Swift-specific quirks: protocol_function_declaration, protocol_property_declaration, deinit_declaration (no name field)

Closes #16

Changes

File What
Cargo.toml Add tree-sitter-swift = "0.7", bump to 0.4.7
npm/package.json Bump to 0.4.7
src/read/outline/code.rs Wire Swift grammar, add protocol members, deinit name handling
src/search/callees.rs Swift callee query patterns
src/search/siblings.rs Swift sibling query pattern

Test plan

  • cargo check — compiles clean
  • cargo clippy — zero warnings
  • cargo test — all 58 tests pass
  • Swift outline rendering verified with protocol + class file
  • Reviewed for race conditions, state issues, edge cases

🤖 Generated with Claude Code

jahala and others added 4 commits March 6, 2026 21:44
…iblings

Wire tree-sitter-swift grammar into outline_language(), add Swift-specific
query patterns for callee extraction and sibling resolution.

Swift grammar notes:
- class_declaration covers class/struct/enum/extension/actor via
  declaration_kind field (all show as "class" in outline)
- Call expressions have no named fields — function name is either a
  direct simple_identifier child or inside navigation_expression
- protocol_declaration, init_declaration, deinit_declaration,
  typealias_declaration added to outline walker

Closes #16

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add protocol_function_declaration to Function match arm
- Add protocol_property_declaration to property match arm
- Return "deinit" name for deinit_declaration (has no name field)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jahala jahala merged commit 1ab5a7a into main Mar 6, 2026
9 checks passed
@jahala jahala deleted the feat/csharp-support branch March 8, 2026 17:46
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.

Consider documenting swift support

1 participant