Skip to content

Explore tree-sitter based structured editing #25

@thegdsks

Description

@thegdsks

From discussion #19 by @yunfan.

Stacklit already parses codebases with tree-sitter and builds dependency graphs. The next logical step is using those same parsed trees for structured code editing, locating a node by its tree-sitter path and replacing it with generated code.

What this could look like:

  • Target a specific function/type/export by its tree-sitter path
  • Replace or patch that node while preserving surrounding code
  • Use stacklit's dependency graph to find cross-file call sites that need updating

Open questions:

  • Tree-sitter gives syntax, not semantics. Cross-file renames need the dependency layer too.
  • How to handle edits that change the tree structure (adding params, changing return types)
  • Could work as a separate companion tool that reads stacklit.json for the graph

No timeline. Scoping for now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestfeatureNew feature requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions