Skip to content

feat(ast): add Swift symbol parser#1

Open
ckorhonen wants to merge 1 commit into
PorunC:mainfrom
ckorhonen:feat/swift-ast-parser
Open

feat(ast): add Swift symbol parser#1
ckorhonen wants to merge 1 commit into
PorunC:mainfrom
ckorhonen:feat/swift-ast-parser

Conversation

@ckorhonen

@ckorhonen ckorhonen commented Jul 3, 2026

Copy link
Copy Markdown

Summary

Adds first-class Swift symbol extraction to CodeWiki’s AST parser registry. Swift files were already detected as source files, but there was no registered parser, so Swift/iOS repositories were effectively limited to file-level context. This adds a lightweight dependency-free parser that extracts common Swift declarations, imports, enum cases, properties, and coarse call/reference names.

Purpose

Make CodeWiki materially useful on Swift/iOS repositories without requiring SourceKit or adding a native tree-sitter Swift dependency.

Key Changes

  • Add SwiftAstParser for best-effort Swift symbol indexing.
  • Register/export the parser through the existing AST parser registry surface.
  • Add regression coverage for Swift imports, protocols, enums/cases, structs, extensions, properties, methods, multiline function declarations, doc comments, and local-variable suppression.
  • Include swift in the supported language registry assertion.

Test / Lint Results

  • .venv/bin/python -m pytest tests/backend/test_ast_parser.py -q — 17 passed
  • make test — 194 passed, 3 skipped, 1 warning
  • make lint — backend Ruff and frontend ESLint passed
  • make typecheck — mypy passed with no issues
  • make build — frontend production build passed; Vite reported the existing large chunk warning
  • Direct parser smoke over a Swift/iOS repository — parsed 102 Swift files and 4,214 Swift symbols

Linked Issues

None.

Screenshots / GIFs

N/A — backend parser/indexing change only; no UI changes.

Risk Assessment

Medium-low. This parser is intentionally heuristic and marked as swift_regex metadata rather than compiler-grade Swift analysis. It improves Swift repositories from file-only indexing to useful symbol-level context, but complex overload resolution, generated code, dynamic dispatch, and advanced Swift syntax should still be treated as best effort.

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