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 ¶
- type Service
- func (s *Service) Analyze() Snapshot
- func (s *Service) AnalyzeOnce() (result Snapshot, current bool)
- func (s *Service) CloseDocument(filename string)
- func (s *Service) Generation() uint64
- func (s *Service) RemoveWorkspaceDocument(filename string)
- func (s *Service) ReplaceWorkspaceDocuments(units []compiler.SourceUnit)
- func (s *Service) SetDocument(unit compiler.SourceUnit)
- func (s *Service) SetWorkspaceDocument(unit compiler.SourceUnit)
- type Snapshot
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 (*Service) Analyze ¶
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) AnalyzeOnce ¶ added in v0.2.30
AnalyzeOnce analyzes one captured input generation. Compilation happens outside the service lock. If an input changes before compilation finishes, the obsolete result is not committed and current is false.
func (*Service) CloseDocument ¶
CloseDocument removes an unsaved overlay and restores the on-disk project unit, if one exists.
func (*Service) Generation ¶ added in v0.2.30
Generation returns the current input generation. It advances whenever a workspace input or editor overlay changes.
func (*Service) RemoveWorkspaceDocument ¶ added in v0.2.6
RemoveWorkspaceDocument removes an on-disk project input while preserving an open editor overlay until the editor closes it.
func (*Service) ReplaceWorkspaceDocuments ¶ added in v0.2.29
func (s *Service) ReplaceWorkspaceDocuments(units []compiler.SourceUnit)
ReplaceWorkspaceDocuments atomically replaces the on-disk workspace input. Open document overlays are preserved and continue to take precedence over the replacement units.
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) ImportCandidates ¶ added in v0.2.30
func (s Snapshot) ImportCandidates(modulePath string) languageservice.Context
ImportCandidates returns project declarations with one unambiguous import origin, excluding declarations owned by modulePath.