query

package
v0.30.5 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package query provides cached analysis over immutable document snapshots.

Index

Constants

This section is empty.

Variables

View Source
var ErrDocumentNotFound = errors.New("document not found")

Functions

This section is empty.

Types

type Document

type Document struct {
	URI     source.URI
	Text    []byte
	Buffer  *source.TextBuffer
	Version int64
}

Document is immutable source input.

type Snapshot

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

Snapshot is an immutable set of versioned documents.

func New

func New(documents ...Document) *Snapshot

func (*Snapshot) Analyze

func (s *Snapshot) Analyze(ctx context.Context, uri source.URI, opts analysis.Options) (*analysis.Result, error)

Analyze returns a cached result for an unchanged document and options.

func (*Snapshot) AnalyzeDocuments

func (s *Snapshot) AnalyzeDocuments(ctx context.Context, uris []source.URI, opts analysis.Options) (*WorkspaceResult, error)

AnalyzeDocuments resolves declarations within the selected documents.

func (*Snapshot) AnalyzeWorkspace

func (s *Snapshot) AnalyzeWorkspace(ctx context.Context, opts analysis.Options) (*WorkspaceResult, error)

AnalyzeWorkspace resolves declarations shared by snapshot documents.

func (*Snapshot) Document

func (s *Snapshot) Document(uri source.URI) (Document, bool)

func (*Snapshot) Update

func (s *Snapshot) Update(document Document) (*Snapshot, bool)

Update returns a new snapshot. Stale versions are rejected.

func (*Snapshot) UpdateOwned added in v0.4.0

func (s *Snapshot) UpdateOwned(document Document) (*Snapshot, bool)

UpdateOwned returns a new snapshot without copying document.Text. The caller must not modify the slice after this call.

type WorkspaceResult

type WorkspaceResult struct {
	Files       map[source.URI]*analysis.Result
	Diagnostics []diagnostic.Diagnostic
}

WorkspaceResult contains analysis for one snapshot revision.

Jump to

Keyboard shortcuts

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