package cache
import "golang.org/x/tools/internal/lsp/cache"
Package cache implements the caching layer for gopls.
Index ¶
- Variables
- type Cache
- func New(options func(*source.Options)) *Cache
- func (c *Cache) FileSet() *token.FileSet
- func (c *Cache) GetFile(ctx context.Context, uri span.URI) (source.FileHandle, error)
- func (c *Cache) ID() string
- func (c *Cache) MemStats() map[reflect.Type]int
- func (c *Cache) NewSession(ctx context.Context) *Session
- func (c *Cache) PackageStats(withNames bool) template.HTML
- type KnownMetadata
- type Metadata
- func (m *Metadata) ModuleInfo() *packages.Module
- func (m *Metadata) PackageName() string
- func (m *Metadata) PackagePath() string
- type PackageID
- type PackageName
- type PackagePath
- type Session
- func (s *Session) Cache() interface{}
- func (s *Session) DidModifyFiles(ctx context.Context, changes []source.FileModification) (map[source.Snapshot][]span.URI, []func(), error)
- func (s *Session) ExpandModificationsToDirectories(ctx context.Context, changes []source.FileModification) []source.FileModification
- func (s *Session) FileWatchingGlobPatterns(ctx context.Context) map[string]struct{}
- func (s *Session) GetFile(ctx context.Context, uri span.URI) (source.FileHandle, error)
- func (s *Session) ID() string
- func (s *Session) ModifyFiles(ctx context.Context, changes []source.FileModification) error
- func (s *Session) NewView(ctx context.Context, name string, folder span.URI, options *source.Options) (source.View, source.Snapshot, func(), error)
- func (s *Session) Options() *source.Options
- func (s *Session) Overlays() []source.Overlay
- func (s *Session) SetOptions(options *source.Options)
- func (s *Session) SetProgressTracker(tracker *progress.Tracker)
- func (s *Session) Shutdown(ctx context.Context)
- func (s *Session) String() string
- func (s *Session) View(name string) source.View
- func (s *Session) ViewOf(uri span.URI) (source.View, error)
- func (s *Session) Views() []source.View
- type SessionKey
- func NewSessionKey(name, description string) *SessionKey
- func (k *SessionKey) Description() string
- func (k *SessionKey) Format(w io.Writer, buf []byte, l label.Label)
- func (k *SessionKey) From(t label.Label) *Session
- func (k *SessionKey) Get(lm label.Map) *Session
- func (k *SessionKey) Name() string
- func (k *SessionKey) Of(v *Session) label.Label
- type View
- func (v *View) FileKind(fh source.FileHandle) source.FileKind
- func (v *View) Folder() span.URI
- func (v *View) ID() string
- func (v *View) IsGoPrivatePath(target string) bool
- func (v *View) ModuleUpgrades() map[string]string
- func (v *View) Name() string
- func (v *View) Options() *source.Options
- func (v *View) Rebuild(ctx context.Context) (source.Snapshot, func(), error)
- func (v *View) RegisterModuleUpgrades(upgrades map[string]string)
- func (v *View) Session() *Session
- func (v *View) SetOptions(ctx context.Context, options *source.Options) (source.View, error)
- func (v *View) Shutdown(ctx context.Context)
- func (v *View) Snapshot(ctx context.Context) (source.Snapshot, func())
Variables ¶
var ( KeyCreateSession = NewSessionKey("create_session", "A new session was added") KeyUpdateSession = NewSessionKey("update_session", "Updated information about a session") KeyShutdownSession = NewSessionKey("shutdown_session", "A session was shut down") )
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
func New ¶
func (*Cache) FileSet ¶
func (*Cache) GetFile ¶
func (*Cache) ID ¶
func (*Cache) MemStats ¶
func (*Cache) NewSession ¶
func (*Cache) PackageStats ¶
type KnownMetadata ¶
type KnownMetadata struct { *Metadata // Valid is true if the given metadata is Valid. // Invalid metadata can still be used if a metadata reload fails. Valid bool // ShouldLoad is true if the given metadata should be reloaded. ShouldLoad bool }
KnownMetadata is a wrapper around metadata that tracks its validity.
type Metadata ¶
type Metadata struct { ID PackageID PkgPath PackagePath Name PackageName GoFiles []span.URI CompiledGoFiles []span.URI ForTest PackagePath TypesSizes types.Sizes Errors []packages.Error Deps []PackageID MissingDeps map[PackagePath]struct{} Module *packages.Module // Config is the *packages.Config associated with the loaded package. Config *packages.Config // IsIntermediateTestVariant reports whether the given package is an // intermediate test variant, e.g. // "golang.org/x/tools/internal/lsp/cache [golang.org/x/tools/internal/lsp/source.test]". IsIntermediateTestVariant bool // contains filtered or unexported fields }
Metadata holds package Metadata extracted from a call to packages.Load.
func (*Metadata) ModuleInfo ¶
ModuleInfo implements the source.Metadata interface.
func (*Metadata) PackageName ¶
Name implements the source.Metadata interface.
func (*Metadata) PackagePath ¶
PkgPath implements the source.Metadata interface.
type PackageID ¶
type PackageID string
Declare explicit types for package paths, names, and IDs to ensure that we never use an ID where a path belongs, and vice versa. If we confused these, it would result in confusing errors because package IDs often look like package paths.
type PackageName ¶
type PackageName string
Declare explicit types for package paths, names, and IDs to ensure that we never use an ID where a path belongs, and vice versa. If we confused these, it would result in confusing errors because package IDs often look like package paths.
type PackagePath ¶
type PackagePath string
Declare explicit types for package paths, names, and IDs to ensure that we never use an ID where a path belongs, and vice versa. If we confused these, it would result in confusing errors because package IDs often look like package paths.
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
func (*Session) Cache ¶
func (s *Session) Cache() interface{}
func (*Session) DidModifyFiles ¶
func (s *Session) DidModifyFiles(ctx context.Context, changes []source.FileModification) (map[source.Snapshot][]span.URI, []func(), error)
func (*Session) ExpandModificationsToDirectories ¶
func (s *Session) ExpandModificationsToDirectories(ctx context.Context, changes []source.FileModification) []source.FileModification
func (*Session) FileWatchingGlobPatterns ¶
func (*Session) GetFile ¶
func (*Session) ID ¶
func (*Session) ModifyFiles ¶
func (*Session) NewView ¶
func (s *Session) NewView(ctx context.Context, name string, folder span.URI, options *source.Options) (source.View, source.Snapshot, func(), error)
func (*Session) Options ¶
func (*Session) Overlays ¶
func (*Session) SetOptions ¶
func (*Session) SetProgressTracker ¶
func (*Session) Shutdown ¶
func (*Session) String ¶
func (*Session) View ¶
View returns the view by name.
func (*Session) ViewOf ¶
ViewOf returns a view corresponding to the given URI. If the file is not already associated with a view, pick one using some heuristics.
func (*Session) Views ¶
type SessionKey ¶
type SessionKey struct {
// contains filtered or unexported fields
}
SessionKey represents an event label key that has a *Session value.
func NewSessionKey ¶
func NewSessionKey(name, description string) *SessionKey
NewSessionKey creates a new Key for *Session values.
func (*SessionKey) Description ¶
func (k *SessionKey) Description() string
func (*SessionKey) Format ¶
func (*SessionKey) From ¶
func (k *SessionKey) From(t label.Label) *Session
From can be used to get the session value from a Label.
func (*SessionKey) Get ¶
func (k *SessionKey) Get(lm label.Map) *Session
Get can be used to get the session for the key from a label.Map.
func (*SessionKey) Name ¶
func (k *SessionKey) Name() string
func (*SessionKey) Of ¶
func (k *SessionKey) Of(v *Session) label.Label
Of creates a new Label with this key and the supplied session.
type View ¶
type View struct {
// contains filtered or unexported fields
}
func (*View) FileKind ¶
func (v *View) FileKind(fh source.FileHandle) source.FileKind
func (*View) Folder ¶
Folder returns the folder at the base of this view.
func (*View) ID ¶
func (*View) IsGoPrivatePath ¶
func (*View) ModuleUpgrades ¶
func (*View) Name ¶
Name returns the user visible name of this view.
func (*View) Options ¶
func (*View) Rebuild ¶
func (*View) RegisterModuleUpgrades ¶
func (*View) Session ¶
func (*View) SetOptions ¶
func (*View) Shutdown ¶
func (*View) Snapshot ¶
Source Files ¶
analysis.go cache.go check.go errors.go imports.go keys.go load.go metadata.go mod.go mod_tidy.go parse.go pkg.go session.go snapshot.go symbols.go view.go workspace.go
- Version
- v0.1.10
- Published
- Mar 15, 2022
- Platform
- js/wasm
- Imports
- 53 packages
- Last checked
- 6 hours ago –
Tools for package owners.