compilerservice

package
v0.2.21 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package compilerservice owns reusable, editor-independent project snapshots. CLI, LSP, and future agent adapters can share overlays, diagnostics, checked artifacts, and language-service contexts without rebuilding compiler phases.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

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

Service maintains immutable snapshots over project inputs and unsaved document overlays. Any input change invalidates the current analysis.

func New

func New(units []compiler.SourceUnit, options compiler.Options) *Service

func (*Service) Analyze

func (s *Service) Analyze() Snapshot

Analyze returns the current immutable project snapshot. Compilation happens outside the service lock. If inputs change concurrently, the obsolete result is discarded and analysis restarts from the newer generation.

func (*Service) CloseDocument

func (s *Service) CloseDocument(filename string)

CloseDocument removes an unsaved overlay and restores the on-disk project unit, if one exists.

func (*Service) RemoveWorkspaceDocument added in v0.2.6

func (s *Service) RemoveWorkspaceDocument(filename string)

RemoveWorkspaceDocument removes an on-disk project input while preserving an open editor overlay until the editor closes it.

func (*Service) SetDocument

func (s *Service) SetDocument(unit compiler.SourceUnit)

SetDocument installs an unsaved source unit. Existing project files and new files use the same operation; adapters are responsible for deriving the module and package names of a newly created file.

func (*Service) SetWorkspaceDocument added in v0.2.6

func (s *Service) SetWorkspaceDocument(unit compiler.SourceUnit)

SetWorkspaceDocument updates the on-disk project input beneath any open editor overlay. Closing an overlay therefore restores the latest saved file.

type Snapshot

type Snapshot struct {
	Version     uint64
	Diagnostics []diagnostic.Diagnostic
	Artifacts   []*compiler.Artifact
	Stale       bool
	// contains filtered or unexported fields
}

func (Snapshot) Context

func (s Snapshot) Context(modulePath string) (languageservice.Context, bool)

func (Snapshot) HasErrors

func (s Snapshot) HasErrors() bool

Jump to

Keyboard shortcuts

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