Documentation
¶
Index ¶
Constants ¶
const SchemaVersion = "v1"
SchemaVersion defines the stable, versioned JSON output format version.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Action ¶
type Action struct {
Action string `json:"action"` // "insert", "delete", "update", "move"
Node *NodeRef `json:"node"`
Parent *NodeRef `json:"parent,omitempty"`
Position *int `json:"position,omitempty"`
OldParent *NodeRef `json:"old_parent,omitempty"`
OldPosition *int `json:"old_position,omitempty"`
OldValue string `json:"old_value,omitempty"`
NewValue string `json:"new_value,omitempty"`
Subtree *bool `json:"subtree,omitempty"`
DestNode *NodeRef `json:"dest_node,omitempty"`
DestStartByte *uint32 `json:"dest_start_byte,omitempty"`
DestEndByte *uint32 `json:"dest_end_byte,omitempty"`
GroupID string `json:"group_id,omitempty"`
}
Action represents a serialized edit-script action. The absence of the "subtree" field always indicates false.
type Envelope ¶
type Envelope struct {
Version string `json:"version"`
Actions []Action `json:"actions"`
LineAlignment []LineAlignmentPair `json:"line_alignment,omitempty"`
}
Envelope wraps the serialized actions list with a schema version.
func BuildEnvelope ¶ added in v0.2.0
func BuildEnvelope(es *actions.EditScript, ms *engine.Mapping, srcRoot, dstRoot *treesitter.ASTNode, srcBytes, dstBytes []byte) (*Envelope, error)
BuildEnvelope bundles the edit script, AST mappings, and metadata into a unified envelope.
type LineAlignmentPair ¶ added in v0.2.0
LineAlignmentPair matches a source file line to a destination file line. A line index of -1 indicates a filler line.
func AlignLines ¶ added in v0.2.0
func AlignLines(srcBytes, dstBytes []byte, es *actions.EditScript, ms *engine.Mapping, srcRoot, dstRoot *treesitter.ASTNode) []LineAlignmentPair
AlignLines computes a visual side-by-side alignment grid for the source and destination lines, using line-level similarity and AST mappings.
type NodeRef ¶
type NodeRef struct {
Tree string `json:"tree"` // "before" or "after"
Path []int `json:"path"`
Type string `json:"type"`
Label string `json:"label,omitempty"`
StartByte uint32 `json:"start_byte"`
EndByte uint32 `json:"end_byte"`
}
NodeRef is a stable and self-describing reference to an AST node.