Documentation
¶
Index ¶
- Constants
- func DetectConfigPath(root string) (string, bool, error)
- type Index
- type OpenDocument
- type RootIndex
- type RootRuntime
- type RootSet
- type Runtime
- func (r *Runtime) DidChange(path string, version int32, text string) error
- func (r *Runtime) DidClose(path string)
- func (r *Runtime) DidOpen(doc *OpenDocument) error
- func (r *Runtime) Document(path string) *OpenDocument
- func (r *Runtime) FlushReload() error
- func (r *Runtime) RootByPath(path string) *RootRuntime
- func (r *Runtime) SetReloadHook(hook func())
- func (r *Runtime) Snapshot() *Snapshot
- type Snapshot
- type ValidationReport
- func Validate(root, configPath string, opts validation.Options) (*ValidationReport, error)
- func ValidateWithConfig(root, configPath string, cfg *config.Config, opts validation.Options) (*ValidationReport, error)
- func ValidateWithConfigAndOps(root, configPath string, cfg *config.Config, opts validation.Options, ...) (*ValidationReport, error)
- func ValidateWithOps(root, configPath string, opts validation.Options, ops fileutil.Ops) (*ValidationReport, error)
- type Workspace
- func Load(root, configPath string) (*Workspace, error)
- func LoadWithConfig(root, configPath string, cfg *config.Config) (*Workspace, error)
- func LoadWithConfigAndOps(root, configPath string, cfg *config.Config, ops fileutil.Ops) (*Workspace, error)
- func LoadWithOps(root, configPath string, ops fileutil.Ops) (*Workspace, error)
Constants ¶
const ReloadDelay = 75 * time.Millisecond
ReloadDelay is the debounce period used before recomputing overlay-backed roots.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type OpenDocument ¶
OpenDocument is the in-memory representation of an open buffer.
type RootIndex ¶
type RootIndex struct {
Root string
ConfigPath string
ConfigFiles map[string]struct{}
DataFiles map[string][]string
Workspace *Workspace
}
RootIndex captures one detected mergeway root and its isolated file/index state.
func (*RootIndex) OwnsPath ¶
OwnsPath reports whether the file belongs to this root as either a config file or a configured data include target.
func (*RootIndex) TypesForFile ¶
TypesForFile reports the configured types that include the given file.
type RootRuntime ¶
type RootRuntime struct {
Index *RootIndex
Workspace *Workspace
LoadErr error
Validation *ValidationReport
}
RootRuntime tracks the current overlay-backed view of one detected root.
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
Runtime manages open documents and overlay-backed root reloads.
func NewRuntime ¶
NewRuntime constructs a runtime around a detected root set.
func (*Runtime) DidChange ¶
DidChange replaces the full document text and schedules a debounced recompute.
func (*Runtime) DidClose ¶
DidClose removes the in-memory buffer and schedules a debounced recompute.
func (*Runtime) DidOpen ¶
func (r *Runtime) DidOpen(doc *OpenDocument) error
DidOpen stores full-document content and schedules a debounced recompute.
func (*Runtime) Document ¶
func (r *Runtime) Document(path string) *OpenDocument
Document returns the currently open in-memory buffer, if any.
func (*Runtime) FlushReload ¶
FlushReload forces any pending debounced recompute to run immediately.
func (*Runtime) RootByPath ¶
func (r *Runtime) RootByPath(path string) *RootRuntime
RootByPath returns the current root runtime for the given file.
func (*Runtime) SetReloadHook ¶
func (r *Runtime) SetReloadHook(hook func())
SetReloadHook registers a callback that runs after each successful reload.
type Snapshot ¶
type Snapshot struct {
Roots map[string]*RootRuntime
Documents map[string]*OpenDocument
}
Snapshot captures a read-only copy of the runtime state used by callers that need a consistent view across roots and open documents.
type ValidationReport ¶
type ValidationReport struct {
Root string
ConfigPath string
Config *config.Config
Result *validation.Result
Workspace *Workspace
WorkspaceLoadError error
}
ValidationReport combines semantic validation output with the best-effort loaded workspace/index for callers that need both in one step.
func Validate ¶
func Validate(root, configPath string, opts validation.Options) (*ValidationReport, error)
Validate loads config, runs the existing semantic validator, and attaches a best-effort loaded workspace/index for valid callers that need both outputs.
func ValidateWithConfig ¶
func ValidateWithConfig(root, configPath string, cfg *config.Config, opts validation.Options) (*ValidationReport, error)
ValidateWithConfig runs the existing semantic validator with a caller-provided config and attaches a best-effort loaded workspace/index.
func ValidateWithConfigAndOps ¶
func ValidateWithConfigAndOps(root, configPath string, cfg *config.Config, opts validation.Options, ops fileutil.Ops) (*ValidationReport, error)
ValidateWithConfigAndOps runs semantic validation with caller-provided config and file operations.
func ValidateWithOps ¶
func ValidateWithOps(root, configPath string, opts validation.Options, ops fileutil.Ops) (*ValidationReport, error)
ValidateWithOps loads config and validates using the provided file operations.
type Workspace ¶
type Workspace struct {
Root string
ConfigPath string
Config *config.Config
ObjectsByType map[string][]*data.Object
Index *Index
}
Workspace captures a loaded mergeway workspace and a reusable entity index.
func Load ¶
Load reads the workspace config, loads all configured entities, and builds a per-type/per-identifier index without invoking CLI code.
func LoadWithConfig ¶
LoadWithConfig loads all configured entities and builds an entity index using a caller-provided config.
func LoadWithConfigAndOps ¶
func LoadWithConfigAndOps(root, configPath string, cfg *config.Config, ops fileutil.Ops) (*Workspace, error)
LoadWithConfigAndOps loads all configured entities and builds an entity index using a caller-provided config and file operations.
func LoadWithOps ¶
LoadWithOps reads the workspace config and builds an index using the provided file operations.