context

package
v0.0.0-...-e49a3f0 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommentPosition

type CommentPosition int

type Ctx

type Ctx struct {
	// contains filtered or unexported fields
}

func New

func New(pos *position.Position) (*Ctx, error)

func (*Ctx) Advance

func (c *Ctx) Advance() bool

Advances to the next wrapped node, returning whether there was a node to advance to.

func (*Ctx) ClassScope

func (c *Ctx) ClassScope() ast.Vertex

The next scope of the current node, but only the class-like nodes.

func (*Ctx) Current

func (c *Ctx) Current() ast.Vertex

The current node and whether there is a current node.

func (*Ctx) DirectlyWrappedBy

func (c *Ctx) DirectlyWrappedBy(kind ast.Type) bool

Whether the current node directly is wrapped by the given kind.

func (*Ctx) DirectlyWraps

func (c *Ctx) DirectlyWraps(kind ast.Type) bool

Whether the current node directly wraps the given node kind.

func (*Ctx) InComment

func (c *Ctx) InComment() (*token.Token, CommentPosition)

Returns the token of the comment if the cursor is in a comment. Otherwise nil. The second return value is the index of the cursor into the comment.

func (*Ctx) Path

func (c *Ctx) Path() string

func (*Ctx) Position

func (c *Ctx) Position() *position.Position

Position returns the position of the cursor.

func (*Ctx) Root

func (c *Ctx) Root() *ast.Root

Get the root/top most node.

func (*Ctx) Scope

func (c *Ctx) Scope() ast.Vertex

The next scope of the current node, (function, root, method, class etc.).

func (*Ctx) Start

func (c *Ctx) Start() *position.Position

func (*Ctx) WrappedBy

func (c *Ctx) WrappedBy(kind ast.Type) bool

Whether the current node is wrapped by the given kind.

func (*Ctx) Wraps

func (c *Ctx) Wraps(kind ast.Type) bool

Whether the current node wraps the given node kind.

Jump to

Keyboard shortcuts

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