cursor

package
v0.0.0-...-52b1b20 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CurCtx

type CurCtx struct {
	Ctx        *mg.Ctx
	View       *mg.View
	Scope      CurScope
	PkgName    string
	IsTestFile bool
	Line       []byte
	Src        []byte
	Pos        int
	TokenPos   token.Pos
	AstFile    *ast.File
	TokenFile  *token.File
	Doc        *DocNode

	GenDecl    *ast.GenDecl
	ImportSpec *ast.ImportSpec
	Comment    *ast.Comment
	BlockStmt  *ast.BlockStmt
	CallExpr   *ast.CallExpr
	BasicLit   *ast.BasicLit
	Nodes      []ast.Node
	Node       ast.Node
	// contains filtered or unexported fields
}

func NewCurCtx

func NewCurCtx(mx *mg.Ctx, src []byte, pos int) *CurCtx

func NewViewCurCtx

func NewViewCurCtx(mx *mg.Ctx) *CurCtx

func (*CurCtx) Contains

func (cx *CurCtx) Contains(typ ast.Node) bool

func (*CurCtx) Each

func (cx *CurCtx) Each(f func(ast.Node))

func (*CurCtx) FuncDeclName

func (cx *CurCtx) FuncDeclName() (name string, isMethod bool)

FuncDeclName returns the name of the FuncDecl iff the cursor is on a func declariton's name. isMethod is true if the declaration is a method.

func (*CurCtx) FuncName

func (cx *CurCtx) FuncName() string

FuncName returns the name of function iff the cursor is on a func declariton's name

func (*CurCtx) ImportsMatch

func (cx *CurCtx) ImportsMatch(match func(importPath string) bool) bool

func (*CurCtx) MethodName

func (cx *CurCtx) MethodName() string

FuncName returns the name of function iff the cursor is on a method declariton's name

func (*CurCtx) Print

func (cx *CurCtx) Print(x ast.Node) (string, error)

func (*CurCtx) Set

func (cx *CurCtx) Set(destPtr interface{}) bool

func (*CurCtx) Some

func (cx *CurCtx) Some(f func(ast.Node) bool) bool

type CurScope

type CurScope uint64
const (
	AssignmentScope CurScope
	BlockScope
	CommentScope
	ConstScope
	DeferScope
	DocScope
	ExprScope
	FileScope
	FuncDeclScope
	IdentScope
	ImportPathScope
	ImportScope
	PackageScope
	ReturnScope
	SelectorScope
	StringScope
	TypeDeclScope
	VarScope
)

func (CurScope) Is

func (cs CurScope) Is(scopes ...CurScope) bool

func (CurScope) String

func (cs CurScope) String() string

type DocNode

type DocNode struct {
	Node ast.Node
	ast.CommentGroup
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL