Documentation
¶
Index ¶
- func FormatRepoMapOutput(files map[string][]int, rootPath string) (string, error)
- func RenderFileWithComponents(filePath string, rootPath string, componentLines []int) (string, error)
- type TreeContext
- func (tc *TreeContext) AddChildContext(line int)
- func (tc *TreeContext) AddContext()
- func (tc *TreeContext) AddLinesOfInterest(lineNums []int)
- func (tc *TreeContext) AddParentScopes(line int)
- func (tc *TreeContext) CloseSmallGaps()
- func (tc *TreeContext) Format() string
- func (tc *TreeContext) GetHeader(line int) []int
- func (tc *TreeContext) GetLastLineOfScope(line int) int
- func (tc *TreeContext) Grep(pattern string, ignoreCase bool) map[int]bool
- func (tc *TreeContext) WalkTree(node *sitter.Node, depth int) (int, int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatRepoMapOutput ¶
FormatRepoMapOutput formats multiple files with their components in a repo map style
Types ¶
type TreeContext ¶
type TreeContext struct { Filename string Lines []string NumLines int Color bool Verbose bool LineNumber bool ParentContext bool ChildContext bool LastLine bool Margin int MarkLOIs bool HeaderMax int ShowTopOfFileParentScope bool LOIPad int // Internal state OutputLines map[int]string Scopes []map[int]bool // Which scopes is each line part of? Header [][]any // Which lines serve as header for each scope Nodes [][]any // Tree-sitter nodes associated with each line ShowLines map[int]bool LinesOfInterest map[int]bool DoneParentScopes map[int]bool }
TreeContext represents the context around code structures in a file
func NewTreeContext ¶
func NewTreeContext( filename string, code string, color bool, verbose bool, lineNumber bool, parentContext bool, childContext bool, lastLine bool, margin int, markLOIs bool, headerMax int, showTopOfFileParentScope bool, loiPad int, ) (*TreeContext, error)
NewTreeContext creates a new TreeContext for a file
func (*TreeContext) AddChildContext ¶
func (tc *TreeContext) AddChildContext(line int)
AddChildContext adds the child context of a line to show lines This is a simplified implementation
func (*TreeContext) AddContext ¶
func (tc *TreeContext) AddContext()
AddContext adds context around lines of interest
func (*TreeContext) AddLinesOfInterest ¶
func (tc *TreeContext) AddLinesOfInterest(lineNums []int)
AddLinesOfInterest adds the provided line numbers to lines of interest
func (*TreeContext) AddParentScopes ¶
func (tc *TreeContext) AddParentScopes(line int)
AddParentScopes adds the parent scopes of a given line to show lines
func (*TreeContext) CloseSmallGaps ¶
func (tc *TreeContext) CloseSmallGaps()
CloseSmallGaps fills single-line gaps in the shown lines
func (*TreeContext) Format ¶
func (tc *TreeContext) Format() string
Format produces the final formatted output with appropriate markers
func (*TreeContext) GetHeader ¶
func (tc *TreeContext) GetHeader(line int) []int
GetHeader returns the header info for a line
func (*TreeContext) GetLastLineOfScope ¶
func (tc *TreeContext) GetLastLineOfScope(line int) int
GetLastLineOfScope finds the last line of a scope