source

package
v0.0.0-...-01b9d28 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2018 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	URI URI
	// contains filtered or unexported fields
}

File holds all the information we know about a file.

func (*File) GetAST

func (f *File) GetAST() (*ast.File, error)

func (*File) GetPackage

func (f *File) GetPackage() (*packages.Package, error)

func (*File) GetToken

func (f *File) GetToken() (*token.File, error)

func (*File) Read

func (f *File) Read() ([]byte, error)

Read returns the contents of the file, reading it from file system if needed.

func (*File) SetContent

func (f *File) SetContent(content []byte)

SetContent sets the overlay contents for a file. Setting it to nil will revert it to the on disk contents, and remove it from the active set.

type Range

type Range struct {
	Start token.Pos
	End   token.Pos
}

Range represents a start and end position. Because Range is based purely on two token.Pos entries, it is not self contained. You need access to a token.FileSet to regain the file information.

func Definition

func Definition(ctx context.Context, f *File, pos token.Pos) (Range, error)

type URI

type URI string

URI represents the full uri for a file.

func ToURI

func ToURI(path string) URI

ToURI returns a protocol URI for the supplied path. It will always have the file scheme.

func (URI) Filename

func (uri URI) Filename() (string, error)

Filename gets the file path for the URI. It will return an error if the uri is not valid, or if the URI was not a file URI

type View

type View struct {
	Config *packages.Config
	// contains filtered or unexported fields
}

func NewView

func NewView() *View

func (*View) GetFile

func (v *View) GetFile(uri URI) *File

GetFile returns a File for the given uri. It will always succeed, adding the file to the managed set if needed.

Jump to

Keyboard shortcuts

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