Documentation
¶
Overview ¶
Package position provides utilities for working with source code positions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ByteRangeToLines ¶
ByteRangeToLines converts byte positions to line numbers. Returns (startLine, endLine) where both are 1-indexed. The end position is exclusive (past-the-end), matching Go AST conventions.
func SplitLines ¶
SplitLines splits content into lines by newline characters.
Types ¶
type LineIndex ¶
type LineIndex struct {
// contains filtered or unexported fields
}
LineIndex helps convert byte offsets to line numbers efficiently using binary search. It pre-indexes all newline positions for O(log n) line number lookups.
func NewLineIndex ¶
NewLineIndex creates an index from file content. It records the byte offset of each newline character.
Click to show internal directories.
Click to hide internal directories.