Skip to content

feat(tree-sitter): AST-based folding, symbols, bracket matching (#1008) [DRAFT]#1085

Draft
batonogov wants to merge 2 commits into
mainfrom
feat/tree-sitter-1008
Draft

feat(tree-sitter): AST-based folding, symbols, bracket matching (#1008) [DRAFT]#1085
batonogov wants to merge 2 commits into
mainfrom
feat/tree-sitter-1008

Conversation

@batonogov

Copy link
Copy Markdown
Owner

Implements #1008 — Tree-sitter integration for structural code intelligence.

Status: DRAFT — requires Xcode

Code is written (882 lines, 5 files), but SPM dependencies are NOT wired. Adding SPM packages requires Xcode (we're on Linux). The following packages need to be added via Xcode > Add Package Dependencies:

New: Pine/TreeSitter/ (882 lines)

File Purpose
TreeSitterParser.swift Background AST parsing on syntax-highlight queue
TreeSitterFoldProvider.swift Structural fold ranges from AST nodes
TreeSitterSymbolProvider.swift Function/class/struct outline from AST
TreeSitterBracketMatcher.swift AST-aware bracket pair highlighting
TreeSitterLanguageRegistry.swift Language → parser mapping (Swift/Python/Rust/TS)

All types nonisolated + Sendable (Swift 6 compliant).

What it does NOT change

  • Regex-based syntax highlighting remains untouched
  • Existing FoldRangeCalculator, BracketMatcher, SymbolParser stay as fallback

TODO

  • Add SPM packages in Xcode
  • Wire TreeSitterFoldProvider into CodeEditorView
  • Wire TreeSitterSymbolProvider into SymbolNavigatorView
  • Unit tests

batonogov added 2 commits July 2, 2026 16:23
WIP — requires Xcode to add SPM dependencies:
- SwiftTreeSitter
- TreeSitterSwift, TreeSitterPython, TreeSitterRust, TreeSitterTypeScript

5 new files in Pine/TreeSitter/ (882 lines):
- TreeSitterParser: background AST parsing on syntax-highlight queue
- TreeSitterFoldProvider: structural fold ranges from AST nodes
- TreeSitterSymbolProvider: function/class/struct outline from AST
- TreeSitterBracketMatcher: AST-aware bracket pair highlighting
- TreeSitterLanguageRegistry: language → parser mapping

All types nonisolated + Sendable (Swift 6 compliant).
check_nonisolated.py passes.

NOTE: SPM packages not yet added to Package.resolved — needs Xcode.
Opening as draft until dependencies are wired.
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