A syntax tree representation of a Swift file, focused in finding SwiftUI views.

Constructors

Properties

language: Language
swiftUIViews: SyntaxNode[]
text: string
tree: Tree

Methods

  • Perform a query in the tree with the given query text, considering the different APIs of tree-sitter for Node.js and web-tree-sitter.

    Parameters

    • node: SyntaxNode
    • queryText: string

    Returns QueryMatch[]

  • Replace a node in the tree with the given replacement text. This doesn't update the tree itself, only updates the indices of the nodes of the existing one.

    Parameters

    Returns void

  • Replace the text in the tree with the given replacement text. Prefer using replaceNode instead of this method, which uses this one under the hood.

    Parameters

    • originalStart: Point
    • originalEnd: Point
    • originalStartIndex: number
    • originalEndIndex: number
    • replacementText: string

    Returns void

  • Replace the trivia between two nodes with the given replacement text. Prefer using replaceNode with the clearLeadingTrivia or clearTrailingTrivia options instead of this method.

    Parameters

    • previousNode: SyntaxNode
    • nextNode: SyntaxNode
    • replacementText: string

    Returns void