Documentation
¶
Overview ¶
Package comments extracts and diffs comments across source files.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BindASTNodes ¶ added in v0.8.0
func BindASTNodes(comments []CommentBlock, root *treesitter.ASTNode)
BindASTNodes attaches exact AST node pointers to extracted comment blocks in O(K + N).
Types ¶
type CommentBlock ¶
type CommentBlock struct {
Type string
Text string
StartByte uint32
EndByte uint32
StartRow int // 0-indexed
StartCol int
EndRow int // 0-indexed
EndCol int
ScopeKey string
ParentType string
ParentStart uint32
ParentEnd uint32
ParentRow int
ParentEndRow int
Language string
// Structural Declaration & Scope Context
DeclStart uint32
DeclEnd uint32
DeclType string
RelativePath string
EnclosingDecl *treesitter.ASTNode
}
CommentBlock represents an extracted comment and its source position.
func ExtractComments ¶
func ExtractComments(nodes []treesitter.FlatNode, symbols []string, src []byte, langName string) []CommentBlock
ExtractComments walks the raw flat buffer (pre-IsIgnored filtering) and extracts comment blocks with full CST sibling/parent context.
type DiffResult ¶
DiffResult holds actions produced from diffing comments.
func DiffComments ¶
func DiffComments(srcComments, dstComments []CommentBlock, mappings *engine.Mapping) *DiffResult
DiffComments matches and diffs comments between source and destination files with AST mapping awareness.