cache

package
v0.29.2 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UpdateCacheForURIFromDisk

func UpdateCacheForURIFromDisk(cache *Cache, fileURI, path string) (bool, string, error)

Types

type Cache

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

Cache is used to store: current file contents (which includes unsaved changes), the latest parsed modules, and diagnostics for each file (including diagnostics gathered from linting files alongside other files).

func NewCache

func NewCache() *Cache

func (*Cache) ClearFileDiagnostics

func (c *Cache) ClearFileDiagnostics()

func (*Cache) ClearIgnoredFileContents added in v0.24.0

func (c *Cache) ClearIgnoredFileContents(fileURI string)

func (*Cache) Delete

func (c *Cache) Delete(fileURI string)

Delete removes all cached data for a given URI. Ignored file contents are also removed if found for a matching URI.

func (*Cache) GetAllBuiltInPositions

func (c *Cache) GetAllBuiltInPositions() map[string]map[uint][]types.BuiltinPosition

func (*Cache) GetAllFileRefs added in v0.23.0

func (c *Cache) GetAllFileRefs() map[string]map[string]types.Ref

func (*Cache) GetAllFiles

func (c *Cache) GetAllFiles() map[string]string

func (*Cache) GetAllIgnoredFiles added in v0.24.0

func (c *Cache) GetAllIgnoredFiles() map[string]string

func (*Cache) GetAllModules

func (c *Cache) GetAllModules() map[string]*ast.Module

func (*Cache) GetBuiltinPositions

func (c *Cache) GetBuiltinPositions(fileURI string) (map[uint][]types.BuiltinPosition, bool)

func (*Cache) GetFileAggregates added in v0.28.0

func (c *Cache) GetFileAggregates(fileURIs ...string) map[string][]report.Aggregate

GetFileAggregates is used to get aggregate data for a given list of files. This is only used in tests to validate the cache state.

func (*Cache) GetFileContents

func (c *Cache) GetFileContents(fileURI string) (string, bool)

func (*Cache) GetFileDiagnostics

func (c *Cache) GetFileDiagnostics(uri string) ([]types.Diagnostic, bool)

func (*Cache) GetFileRefs added in v0.23.0

func (c *Cache) GetFileRefs(fileURI string) map[string]types.Ref

func (*Cache) GetIgnoredFileContents added in v0.24.0

func (c *Cache) GetIgnoredFileContents(fileURI string) (string, bool)

func (*Cache) GetKeywordLocations added in v0.24.0

func (c *Cache) GetKeywordLocations(fileURI string) (map[uint][]types.KeywordLocation, bool)

func (*Cache) GetModule

func (c *Cache) GetModule(fileURI string) (*ast.Module, bool)

func (*Cache) GetParseErrors

func (c *Cache) GetParseErrors(uri string) ([]types.Diagnostic, bool)

func (*Cache) SetAggregates added in v0.28.0

func (c *Cache) SetAggregates(data map[string][]report.Aggregate)

func (*Cache) SetBuiltinPositions

func (c *Cache) SetBuiltinPositions(fileURI string, positions map[uint][]types.BuiltinPosition)

func (*Cache) SetFileAggregates added in v0.28.0

func (c *Cache) SetFileAggregates(fileURI string, data map[string][]report.Aggregate)

SetFileAggregates will only set aggregate data for the provided URI. Even if data for other files is provided, only the specified URI is updated.

func (*Cache) SetFileContents

func (c *Cache) SetFileContents(fileURI string, content string)

func (*Cache) SetFileDiagnostics

func (c *Cache) SetFileDiagnostics(fileURI string, diags []types.Diagnostic)

func (*Cache) SetFileDiagnosticsForRules added in v0.28.0

func (c *Cache) SetFileDiagnosticsForRules(fileURI string, rules []string, diags []types.Diagnostic)

SetFileDiagnosticsForRules will perform a partial update of the diagnostics for a file given a list of evaluated rules.

func (*Cache) SetFileRefs added in v0.23.0

func (c *Cache) SetFileRefs(fileURI string, items map[string]types.Ref)

func (*Cache) SetIgnoredFileContents added in v0.24.0

func (c *Cache) SetIgnoredFileContents(fileURI string, content string)

func (*Cache) SetKeywordLocations added in v0.24.0

func (c *Cache) SetKeywordLocations(fileURI string, keywords map[uint][]types.KeywordLocation)

func (*Cache) SetModule

func (c *Cache) SetModule(fileURI string, module *ast.Module)

func (*Cache) SetParseErrors

func (c *Cache) SetParseErrors(fileURI string, diags []types.Diagnostic)

Jump to

Keyboard shortcuts

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