cache

package
v0.0.0-...-421f03a Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2019 License: BSD-3-Clause Imports: 8 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 source.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) GetFileSet

func (f *File) GetFileSet() (*token.FileSet, 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.

type View

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

func NewView

func NewView(config *packages.Config) *View

NewView creates a new View, given a root path and go/packages configuration. If config is nil, one is created with the directory set to the rootPath.

func (*View) FileSet

func (v *View) FileSet() *token.FileSet

func (*View) GetFile

func (v *View) GetFile(ctx context.Context, uri source.URI) (source.File, error)

GetFile returns a File for the given URI. It will always succeed because it adds the file to the managed set if needed.

func (*View) SetContent

func (v *View) SetContent(ctx context.Context, uri source.URI, content []byte) (source.View, error)

SetContent sets the overlay contents for a file. A nil content value will remove the file from the active set and revert it to its on-disk contents.

Jump to

Keyboard shortcuts

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