Documentation ¶
Index ¶
- func ConvertLinePosToOffsets(base int, lines []token.Pos) []int
- func FileSpliceLines(f *token.File, newLines []int) bool
- func ShiftCommentGroupPos(delta token.Pos, cg *ast.CommentGroup)
- func ShiftGenDeclPos(delta token.Pos, spec *ast.GenDecl)
- func ShiftImportSpecPos(delta token.Pos, spec *ast.ImportSpec)
- type PosRange
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertLinePosToOffsets ¶
ConvertLinePosToOffsets adjusts file lines by base offset for splicing into a file via SetLines call. Note: it is often easier to track newlines in terms of global positions in the file set, however SetLines excepts an array of integer offsets for lines that are relative to the file base.
func FileSpliceLines ¶
FileSpliceLines adds new lines into a file.
func ShiftCommentGroupPos ¶
func ShiftCommentGroupPos(delta token.Pos, cg *ast.CommentGroup)
ShiftCommentGroupPos moves a comment group and all of its dependent AST notes by a given delta in the fileset.
func ShiftGenDeclPos ¶
ShiftGenDeclPos moves a declaration spec and all of its dependent AST notes by a given delta in the fileset.
func ShiftImportSpecPos ¶
func ShiftImportSpecPos(delta token.Pos, spec *ast.ImportSpec)
ShiftImportSpecPos moves an import spec and all of its dependent AST notes by a given delta in the fileset.
Types ¶
type PosRange ¶
func ASTNodeRangeWithComments ¶
ASTNodeRangeWithComments returns a position range for an AST note, start and end locations with doc and line comments attached to the node accounted for.