Documentation ¶
Index ¶
- Constants
- type CacheStyle
- type File
- func (f *File) GetAST(ctx context.Context) *ast.File
- func (f *File) GetContent(ctx context.Context) []byte
- func (f *File) GetFileSet(ctx context.Context) *token.FileSet
- func (f *File) GetPackage(ctx context.Context) source.Package
- func (f *File) GetToken(ctx context.Context) *token.File
- func (f *File) URI() span.URI
- type FindPackageFunc
- type GlobalCache
- func (c *GlobalCache) Add(pkg *packages.Package)
- func (c *GlobalCache) Delete(id string)
- func (c *GlobalCache) Get(pkgPath string) *GlobalPackage
- func (c *GlobalCache) GetByURI(filename string) *Package
- func (c *GlobalCache) Lock()
- func (c *GlobalCache) Put(pkg *Package)
- func (c *GlobalCache) RLock()
- func (c *GlobalCache) RUnlock()
- func (c *GlobalCache) Unlock()
- func (c *GlobalCache) Walk(walkFunc source.WalkFunc, ranks []string) error
- type GlobalPackage
- type Observer
- type Package
- func (pkg *Package) GetActionGraph(ctx context.Context, a *analysis.Analyzer) (*source.Action, error)
- func (pkg *Package) GetErrors() []packages.Error
- func (pkg *Package) GetFileSet() *token.FileSet
- func (pkg *Package) GetFilenames() []string
- func (pkg *Package) GetImport(pkgPath string) source.Package
- func (pkg *Package) GetName() string
- func (pkg *Package) GetPkgPath() string
- func (pkg *Package) GetSyntax() []*ast.File
- func (pkg *Package) GetTypes() *types.Package
- func (pkg *Package) GetTypesInfo() *types.Info
- func (pkg *Package) IsIllTyped() bool
- type Project
- func (p *Project) Cache() *GlobalCache
- func (p *Project) Contain(fileURI lsp.DocumentURI) bool
- func (p *Project) GetBuiltinPackage() source.Package
- func (p *Project) GetFromPkgPath(pkgPath string) source.Package
- func (p *Project) GetFromURI(uri lsp.DocumentURI) source.Package
- func (p *Project) Init(ctx context.Context, globalCacheStyle CacheStyle) error
- func (p *Project) Search(walkFunc source.WalkFunc) error
- func (p *Project) TypeCheck(ctx context.Context, fileURI lsp.DocumentURI) (source.Package, source.File, error)
- func (p *Project) View() source.View
- type Subject
- type View
Constants ¶
const BuiltinPkg = "builtin"
BuiltinPkg builtin package
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheStyle ¶
type CacheStyle string
const ( None CacheStyle = "none" Ondemand CacheStyle = "on-demand" Always CacheStyle = "always" )
type File ¶
type File struct {
// contains filtered or unexported fields
}
File holds all the information we know about a file.
func (*File) GetContent ¶
GetContent returns the contents of the file, reading it from file system if needed.
type FindPackageFunc ¶
FindPackageFunc matches the signature of loader.Config.FindPackage, except also takes a context.Context.
type GlobalCache ¶
type GlobalCache struct {
// contains filtered or unexported fields
}
PackageCache package cache
func (*GlobalCache) Add ¶
func (c *GlobalCache) Add(pkg *packages.Package)
func (*GlobalCache) Delete ¶
func (c *GlobalCache) Delete(id string)
func (*GlobalCache) Get ¶
func (c *GlobalCache) Get(pkgPath string) *GlobalPackage
Get get package by package import path from global cache
func (*GlobalCache) GetByURI ¶
func (c *GlobalCache) GetByURI(filename string) *Package
GetByURI get package by filename from global cache
func (*GlobalCache) Lock ¶
func (c *GlobalCache) Lock()
func (*GlobalCache) Put ¶
func (c *GlobalCache) Put(pkg *Package)
func (*GlobalCache) RLock ¶
func (c *GlobalCache) RLock()
func (*GlobalCache) RUnlock ¶
func (c *GlobalCache) RUnlock()
func (*GlobalCache) Unlock ¶
func (c *GlobalCache) Unlock()
type GlobalPackage ¶
type GlobalPackage struct {
// contains filtered or unexported fields
}
func (*GlobalPackage) ModTime ¶
func (p *GlobalPackage) ModTime() time.Time
func (*GlobalPackage) Package ¶
func (p *GlobalPackage) Package() *Package
type Package ¶
type Package struct {
// contains filtered or unexported fields
}
Package contains the type information needed by the source package.
func (*Package) GetActionGraph ¶
func (*Package) GetFileSet ¶
func (*Package) GetFilenames ¶
func (*Package) GetPkgPath ¶
func (*Package) GetTypesInfo ¶
func (*Package) IsIllTyped ¶
type Project ¶
type Project struct {
// contains filtered or unexported fields
}
Project project struct
func NewProject ¶
func NewProject(ctx context.Context, conn jsonrpc2.JSONRPC2, rootPath string, buildFlags []string) *Project
NewProject new project
func (*Project) Cache ¶
func (p *Project) Cache() *GlobalCache
func (*Project) GetBuiltinPackage ¶
GetBuiltinPackage get builtin package
func (*Project) GetFromPkgPath ¶
GetFromPkgPath get package from package import path.
func (*Project) GetFromURI ¶
GetFromURI get package from document uri.
func (*Project) Init ¶
func (p *Project) Init(ctx context.Context, globalCacheStyle CacheStyle) error
Init init project
type View ¶
type View struct { // Config is the configuration used for the view's interaction with the // go/packages API. It is shared across all views. Config packages.Config // contains filtered or unexported fields }